name = ls2lf	# AvP[V

UseDebug = 0	# 1 Ȃ debug w
UseBCC = 1	# 1 Ȃ BCC32 , 0 Ȃ CL
UseTASM = 1	# 1 Ȃ TASMgp
UseIlink = 0	# 1 Ȃ ilink32(BCC 5.5ȍ~) gp
!ifndef UseUnicode
UseUnicode = 1	# 1 Ȃ UNICODE 
!endif
!ifndef VCTOOLKIT
VCTOOLKIT = 0	# VC TOOL KIT gȂLɁAVS2008Ȃ疳
!endif

#=======================================
!ifndef X64
X64 = 0		# 1 Ȃ x64(UNICODE)
TAIL	=
!else
X64 = 1
!endif

!if $(X64)
UseBCC	= 0
UseTASM = 0
UseUnicode	= 1
TAIL	= 64
!endif

!if $(UseUnicode)
  UnicodeCopt	= -DUNICODE
!endif
#=============================================================== Borland pݒ
!if $(UseBCC)
.autodepend
!if $(UseDebug)
  DebugCopt	= -R -v -DDEBUG	# ǉ C RpCIvV
  DebugLopt	= -v
  DebugRopt	= -DDEBUG
!endif
!if $(UseTASM)
 C0D	= TINYC0D
 C0DOBJ	= TINYC0D.OBJ
!else
 C0D	= $(C0DLL)
!endif
#-------------------------------------- RpCʎw
cc	= @BCC32 -4 -c -C -d -H -Hc -w -O -O1 -RT- -x- $(bc56opt) $(DebugCopt) $(UnicodeCopt) $(ExCopt)
#-------------------------------------- Jʎw
!if $(UseIlink)
 bc56opt = -Oc -q -a4
 linkopt = @ilink32 -c -m -P -V4.0 -Gn -q $(DebugLopt)
!else
 linkopt = @tlink32 -c -m -P -V4.0 $(DebugLopt)
!endif
  C0CON	= C0X32
  C0GUI	= C0W32
!if $(UseTASM)
  C0DLL	= TINYC0D
  C0DOBJ= TINYC0D.OBJ
!else
  C0DLL	= C0D32X
!endif
#-------------------------------------- J(GUI)
linkexe	= $(linkopt) -Tpe -aa
#-------------------------------------- J(CONSOLE)
linkcon	= $(linkopt) -Tpe -ap
#-------------------------------------- J(DLL)
linkdll	= $(linkopt) -Tpd -aa

#-------------------------------------- C|[g
implib  = @implib
#-------------------------------------- \[XRpC
rc	= @Brc32 -r $(DebugRopt)
#-------------------------------------- Öق̎w
.C.OBJ:
  $(cc) -o$@ $<

.CPP.OBJ:
  $(cc) -o$@ $<

.RC.RES:
  $(rc) -fo$@ $<

!if $(UseTASM)
.ASM.OBJ:
  @tasm32 /mx /w2 $&
!endif
#============================================================= Microsoft pݒ
!else
!if $(X64)
!if $(VCTOOLKIT)
LIB64	= bufferoverflowu.lib
!endif
LINK64	= /MACHINE:AMD64
RC64	= /d_WIN64
X64Copt	= /wd4244 /wd4267
# TCYႢx(ł邾̎wgȂ)
!endif
#-------------------------------------- RpC
cc	= @"cl" /GF /nologo /c /DWINVER=0x400 $(Dxopt) $(UnicodeCopt) $(WineCopt) $(X64Copt) /O2 /Os /Oy /W3 /wd4068 /wd4996
# 4068:s #pragma	4996:Â֐gp	/Wp64:64bitڐA`FbN

#-------------------------------------- Jʎw
linkopt = @"link" /NOLOGO /INCREMENTAL:NO $(DebugLopt) $(LINK64)
C0DLL	= Kernel32.Lib AdvAPI32.Lib Gdi32.Lib Shell32.Lib User32.Lib comctl32.lib $(LIB64) bcrypt.lib
C0GUI	= $(C0DLL)
C0CON	= $(C0DLL)
#-------------------------------------- J(GUI)
linkexe	= $(linkopt) /SUBSYSTEM:WINDOWS
#-------------------------------------- J(CONSOLE)
linkcon	= $(linkopt) /SUBSYSTEM:CONSOLE
#-------------------------------------- J(DLL)
linkdll	= $(linkopt) /DLL
#-------------------------------------- \[XRpC
rc	= @%COMSPEC% /C RC /dSDKRC $(RC64) $(UnicodeCopt)

#-------------------------------------- Öق̎w
.C.OBJ:
  $(cc) /Fo$@ $<

.CPP.OBJ:
  $(cc) /Fo$@ $<

.RC.RES:
  $(rc) $<
!endif
#------------------------------------------------------------------------------
allFiles:	makefile CODE$(TAIL).OBJ $(name)$(TAIL).exe

#------------------------------------------------------ coděn؊p
CODE$(TAIL).OBJ:
  -@del *.obj 2> nul
  -@del *.res 2> nul
  -@if exist %CSM% del %CSM%\*.CSM
  @copy nul CODE$(TAIL).OBJ > nul
#---------------------------------------------------------------------
objs	= $(name).obj chrtype.obj

$(name)$(TAIL).exe:	$(objs)	RESOURCE.RES
!if $(UseBCC)
  $(linkcon) $(C0CON) $(objs),$<,$*,$(DebugLib) NOEH32 IMPORT32 CW32,,RESOURCE
!else
  $(linkcon) $(C0CON) $(objs) /OUT:$. RESOURCE.RES
!endif
