
# Makefile for NMAKE. Tools to be used:
# either JWASM and WLINK (default)
# or      MASM and MS LINK
# the tools must be found somewhere in PATH.

# to create the binary using JWASM/WLINK, just enter NMAKE
# to create the binary using MASM/MS LINK, enter NMAKE MASM=1

# USEDLL=1 use either MSVCRT.DLL or CRTDLL.DLL
# USEDLL=0 if static CRT is to be used

USEDLL=1

# MASM=1 use MASM, MASM=0 use JWASM

!ifndef MASM
MASM=0
MSLINK=0
!else
MSLINK=1
!endif

NAME=WinCUI2
DEBUG=0
OUTDIR=.

!if $(DEBUG)
LOPTD=/DEBUG:FULL
AOPTD=-Zi
!else
LOPTD=
AOPTD=
!endif

!if $(USEDLL)
#CLIB=msvcrt.lib
CLIB=crtdll.lib
AOPTC=-D_DLL
!else
CLIB=libc.lib
AOPTC=
!endif

ASMOPT= -c -nologo -coff -Sg -Fl$* -Fo$* -I..\..\Include $(AOPTD) $(AOPTC)
!if $(MASM)
ASM = @ml.exe $(ASMOPT)
!else
ASM = @jwasm.exe $(ASMOPT)
!endif

!if $(MSLINK)
LOPT=/LibPath:..\..\Lib /MAP:$*.map /SUBSYSTEM:CONSOLE $(LOPTD)
LIBS=kernel32.lib $(CLIB)
LINK=@link.exe $(LOPT) /OUT:$*.exe $*.obj $(LIBS) 
!else
LOPT= LibPath ..\..\Lib op MAP, quiet $(LOPTD)
LIBS=library kernel32.lib,$(CLIB)
LINK=@wlink.exe format windows nt file $(OUTDIR)\$(NAME).obj $(LOPT) $(LIBS)
!endif

$(OUTDIR)\$(NAME).exe: $(OUTDIR)\$(NAME).obj makefile
	$(LINK)

$(OUTDIR)\$(NAME).obj: $(NAME).asm makefile
	$(ASM) $(NAME).asm

CLEAN :
	-@erase "$(OUTDIR)\$(NAME).obj"
	-@erase "$(OUTDIR)\$(NAME).map"
	-@erase "$(OUTDIR)\$(NAME).lst"

