
# to create hxhelp.exe enter: nmake
# ignore MS linker warning L4096 saying /BASE value being invalid for
# win95. This is no win32 app.

# switch MAKEMZ must remain 0. Currently there is no support for 
# hxhelp.exe in MZ file format.

# the HX.TRP file is generated in HX.TRP subdirectory
# it expects \WATCOM\TRP_SRC tree to exist!
# since that source is protected by copyrights, it is not included here!

!include <..\dirs>

!ifndef DEBUG
DEBUG=0
!endif

NAME=HXHELP
#OWPATH=$(OWDIR)
MAKEMZ=0

!if $(MAKEMZ)==0

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

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

# trap files have changed with v2.0
#ASMOPT=-c -coff -nologo -D?FLAT=1 -D?DEBUGLEVEL=$(DEBUG) -Sg -Fl$* -Fo$* -I$(INC32DIR)
ASMOPT=-c -coff -nologo -D?FLAT=1 -D?V19=1 -D?DEBUGLEVEL=$(DEBUG) -Sg -Fl$* -Fo$* -I$(INC32DIR)

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

$(OUTDIR):
	@mkdir $(OUTDIR)

$(OUTDIR)\$(NAME).EXE: $(OUTDIR)\hxhelp.obj Makefile $(OUTDIR)\privprof.obj ..\DPMILDR\STUB32\dpmild32.bin
!if $(MSLINK)
	$(LINKBIN) @<<
$*.obj $(OUTDIR)\privprof.obj
/base:0x3E0000
/fixed:no
/heap:0x0
/map
/out:$*.EXE 
/subsystem:console
/stack:0x2000
/stub:..\DPMILDR\STUB32\dpmild32.bin
<<
!else
	@$(LINKBIN) format win pe hx ru console name $*.EXE @<<
file $*.obj, $(OUTDIR)\privprof.obj
op q, offset=0x3E0000, stack=0x2000, heap=0x1000, map=$*.MAP, stub=..\DPMILDR\STUB32\dpmild32.bin
<<
!endif

!else

OUTDIR=OMF
ASMOPT=

$(OUTDIR)\$(NAME).EXE: $(OUTDIR)\hxhelp.obj Makefile $(OUTDIR)\privprof.obj
	@$(LINK16BIN) format dos file $(HXINST)\LibOMF\jmppm32.obj, $*.obj, $(OUTDIR)\privprof.obj name $*.exe op map=$*.map lib $(HXINST)\LibOMF\jmppm32.lib

!endif

$(OUTDIR)\$(NAME).obj: $(NAME).asm hxhelp.inc rmdbghlp.inc version.inc Makefile
	@$(ASM) $(ASMOPT) $(NAME).asm

$(OUTDIR)\privprof.obj: privprof.asm Makefile
	@$(ASM) $(ASMOPT) privprof.asm

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