
# NMAKE makefile to create PATCHPE.EXE
# uses JWasm

!include <..\dirs>

!ifndef DEBUG
DEBUG=0
!endif

!if $(DEBUG)
OUTDIR=DEBUG
!else
OUTDIR=RELEASE
!endif

PGM=PATCHPE

ALL: $(OUTDIR) $(OUTDIR)\$(PGM).EXE

$(OUTDIR):
	@mkdir $(OUTDIR)

!if 1

$(OUTDIR)\$(PGM).EXE: $*.obj makefile
	@jwlink format win pe file $*.obj name $*.EXE libpath $(LIBCOFF) lib dkrnl32,$(CRTLIB) op q,map=$*.MAP,stub=dpmist32.bin,start=_mainCRTStartup, stack=0x2000, heap=0x1000

$(OUTDIR)\$(PGM).obj: $(PGM).asm makefile
	@$(ASM) -c -coff -nologo -Sg -Fl$* -Fo$* -I$(INC32DIR) $(PGM).asm

!else

$(OUTDIR)\$(PGM).EXE: $(PGM).asm makefile
	@$(ASM) -pe -c -nologo -Sg -Fl$* -Fo$*.EXE -I$(INC32DIR) $(PGM).asm

!endif

clean:
	@del $(OUTDIR)\*.exe
#	@del $(OUTDIR)\*.obj
	@del $(OUTDIR)\*.lst
#	@del $(OUTDIR)\*.map
