diff --git a/src/OWDOS16.mak b/src/OWDOS16.mak old mode 100644 new mode 100755 index d8af995..f4e687b --- a/src/OWDOS16.mak +++ b/src/OWDOS16.mak @@ -1,13 +1,29 @@ # this makefile creates a DOS 16-bit real-mode version of JWasm (JWASMR.EXE). -# tools used: -# - Open Watcom v1.8/v1.9 +# Open Watcom v1.8-v1.9 may be used. name = JWasm -!ifndef WATCOM -WATCOM = \Watcom +# Detect which platform we're _running_ on, to use proper +# directory separator. + +!ifdef __LINUX__ +DS=/ +!else +DS=\ +!endif + +# When building _on_ Linux, use the script in the Watcom root +# directory to set up the proper environment variables. Call +# this script as ¨. owsetevn.sh¨ The WATCOM directory +# declarations should not end with a / or \. + +!ifndef %WATCOM +WATCOM=$(DS)Watcom +!else +WATCOM=$(%WATCOM) !endif + !ifndef DEBUG DEBUG=0 !endif @@ -18,16 +34,23 @@ OUTD=OWDOS16D OUTD=OWDOS16R !endif -inc_dirs = -IH -I$(WATCOM)\H +# Linux is case-sensitive, so use lower case h for the Watcom includes. +inc_dirs = -IH -I$(WATCOM)$(DS)h # to track memory leaks, the Open Watcom TRMEM module can be included. -# it's useful only if FASTMEM=0 is set, though, otherwise most allocs +# it's useful only if FASTMEM=0 is set, though, otherwise most allocs # won't use the C heap. !ifndef TRMEM TRMEM=0 !endif -LINK = $(WATCOM)\binnt\wlink.exe +!ifdef JWLINK +LINK = jwlink.exe +c_flags = -zc +!else +LINK = wlink +c_flags = -zc +!endif #cflags stuff ######### @@ -42,49 +65,48 @@ extra_c_flags += -od -d2 -DDEBUG_OUT extra_c_flags += -obmilrs -s -DNDEBUG !endif -######### - !if $(DEBUG) LOPTD = debug dwarf op symfile !endif lflagsd = $(LOPTD) sys dos op map=$^*, stack=0x8400 -CC=$(WATCOM)\binnt\wcc -q -0 -w3 -zc -ml -bc -bt=dos $(inc_dirs) $(extra_c_flags) -fo$@ -DFASTMEM=0 -DFASTPASS=0 -DCOFF_SUPPORT=0 -DELF_SUPPORT=0 -DAMD64_SUPPORT=0 -DSSSE3SUPP=0 -DSSE4SUPP=0 -DOWFC_SUPPORT=0 -DDLLIMPORT=0 -DAVXSUPP=0 -DPE_SUPPORT=0 -DVMXSUPP=0 -DSVMSUPP=0 -DCVOSUPP=0 -DCOMDATSUPP=0 -DSTACKBASESUPP=0 -zt=12000 +CC = wcc -q -0 -w3 -zc -ml -bc -bt=dos $(inc_dirs) $(extra_c_flags) -fo$@ -DFASTMEM=0 -DFASTPASS=0 -DCOFF_SUPPORT=0 -DELF_SUPPORT=0 -DAMD64_SUPPORT=0 -DSSSE3SUPP=0 -DSSE4SUPP=0 -DOWFC_SUPPORT=0 -DDLLIMPORT=0 -DAVXSUPP=0 -DPE_SUPPORT=0 -DVMXSUPP=0 -DSVMSUPP=0 -DCVOSUPP=0 -DCOMDATSUPP=0 -DSTACKBASESUPP=0 -zt=12000 .c{$(OUTD)}.obj: - @$(CC) $< + $(CC) $< proj_obj = & !include owmod.inc !if $(TRMEM) -proj_obj += $(OUTD)/trmem.obj +proj_obj += $(OUTD)$(DS)trmem.obj !endif -ALL: $(OUTD) $(OUTD)/$(name)r.exe +ALL: $(OUTD) $(OUTD)$(DS)$(name)r.exe $(OUTD): - @if not exist $(OUTD) mkdir $(OUTD) + @if not exist $(OUTD) mkdir $(OUTD) -$(OUTD)/$(name)r.exe: $(OUTD)/$(name).lib $(OUTD)/main.obj - @set LIB=$(WATCOM)\Lib286;$(WATCOM)\Lib286\DOS - @$(LINK) $(lflagsd) file $(OUTD)/main.obj name $@ lib $(OUTD)/$(name).lib +$(OUTD)$(DS)$(name)r.exe: $(OUTD)$(DS)$(name).lib $(OUTD)$(DS)main.obj + @set LIB=$(WATCOM)$(DS)Lib286;$(WATCOM)$(DS)Lib286$(DS)DOS + $(LINK) $(lflagsd) file $(OUTD)$(DS)main.obj name $@ lib $(OUTD)$(DS)$(name).lib -$(OUTD)/$(name).lib: $(proj_obj) - @cd $(OUTD) - @wlib -q -n $(name).lib $(proj_obj:$(OUTD)/=+) - @cd .. +$(OUTD)$(DS)$(name).lib: $(proj_obj) + @cd $(OUTD) + wlib -q -n $(name).lib $(proj_obj:$(OUTD)$(DS)=+) + @cd .. -$(OUTD)/msgtext.obj: msgtext.c H/msgdef.h H/globals.h - @$(CC) msgtext.c +$(OUTD)$(DS)msgtext.obj: msgtext.c H$(DS)msgdef.h H$(DS)globals.h + @$(CC) msgtext.c -$(OUTD)/reswords.obj: reswords.c H/instruct.h H/special.h H/directve.h - @$(CC) reswords.c +$(OUTD)$(DS)reswords.obj: reswords.c H$(DS)instruct.h H$(DS)special.h H$(DS)directve.h + @$(CC) reswords.c ###### clean: .SYMBOLIC - @if exist $(OUTD)\*.obj erase $(OUTD)\*.obj - @if exist $(OUTD)\$(name)r.exe erase $(OUTD)\$(name)r.exe - @if exist $(OUTD)\$(name)r.map erase $(OUTD)\$(name)r.map + @if exist $(OUTD)$(DS)*.obj -rm $(OUTD)$(DS)*.obj + @if exist $(OUTD)$(DS)$(name)r.exe -rm $(OUTD)$(DS)$(name)r.exe + @if exist $(OUTD)$(DS)$(name)r.map -rm $(OUTD)$(DS)$(name)r.map + @if exist $(OUTD)$(DS)$(name).lib -rm $(OUTD)$(DS)$(name).lib diff --git a/src/OWLinux.mak b/src/OWLinux.mak old mode 100644 new mode 100755 index 434088e..3abddef --- a/src/OWLinux.mak +++ b/src/OWLinux.mak @@ -1,98 +1,127 @@ - -# this makefile (WMake) creates the Linux binary of JWasm. -# Open Watcom v1.8-v1.9 may be used. - -name = jwasm - -!ifndef WATCOM -WATCOM=\Watcom -!endif -!ifndef DEBUG -DEBUG=0 -!endif - -!ifndef OUTD -!if $(DEBUG) -OUTD=OWLinuxD -!else -OUTD=OWLinuxR -!endif -!endif - -# calling convention for compiler: s=Stack, r=Register -CCV=r - -inc_dirs = -IH -I$(WATCOM)\LH - -# to track memory leaks, the Open Watcom TRMEM module can be included -!ifndef TRMEM -TRMEM=0 -!endif - -!ifdef JWLINK -LINK = jwlink.exe -c_flags = -zc -!else -LINK = $(WATCOM)\Binnt\wlink.exe -c_flags = -zc -!endif - -#cflags stuff -######### -extra_c_flags = -!if $(DEBUG) -extra_c_flags += -od -d2 -DDEBUG_OUT -!else -extra_c_flags += -ot -s -DNDEBUG -!endif - -!if $(TRMEM) -extra_c_flags += -DTRMEM -DFASTMEM=0 -!endif - -#lflags stuff -######### -!if $(DEBUG) -LOPTD = debug dwarf op symfile -!endif - -CC = $(WATCOM)\Binnt\wcc386 -q -3$(CCV) $(c_flags) -bc -bt=linux $(inc_dirs) $(extra_c_flags) -fo$@ - -.c{$(OUTD)}.obj: - $(CC) $< - -proj_obj = & -!include owmod.inc - -!if $(TRMEM) -proj_obj += $(OUTD)/trmem.obj -!endif - -ALL: $(OUTD) $(OUTD)/$(name) - -$(OUTD): - @if not exist $(OUTD) mkdir $(OUTD) - -$(OUTD)/$(name) : $(OUTD)/main.obj $(proj_obj) - $(LINK) @<< -format elf runtime linux -$(LOPTD) -libpath $(WATCOM)/lib386 -libpath $(WATCOM)/lib386/linux -op map=$^*, norelocs, quiet, stack=0x20000 -file { $(OUTD)/main.obj $(proj_obj) } -name $@. -<< - -$(OUTD)/msgtext.obj: msgtext.c H/msgdef.h H/globals.h - $(CC) msgtext.c - -$(OUTD)/reswords.obj: reswords.c H/instruct.h H/special.h H/directve.h - $(CC) reswords.c - -###### - -clean: .SYMBOLIC - @if exist $(OUTD)\*. erase $(OUTD)\*. - @if exist $(OUTD)\*.obj erase $(OUTD)\*.obj - @if exist $(OUTD)\*.map erase $(OUTD)\*.map + +# this makefile (WMake) creates the Linux binary of JWasm (jwasm) +# Open Watcom v1.8-v1.9 may be used. + +# Note that this makefile assumes that the OW environment is +# set - the OW tools are to be found in the PATH and the INCLUDE +# environment variable is set correctly. + +name = jwasm + +# Detect which platform we're _running_ on, to use proper +# directory separator. + +!ifdef __LINUX__ +DS=/ +!else +DS=\ +!endif + +# When building _on_ Linux, use the script in the Watcom root +# directory to set up the proper environment variables. Call +# this script as ¨. owsetevn.sh¨ The WATCOM directory +# declarations should not end with a / or \. + +!ifndef %WATCOM +WATCOM=$(DS)Watcom +!else +WATCOM=$(%WATCOM) +!endif + +!ifndef DEBUG +DEBUG=0 +!endif + +!if $(DEBUG) +OUTD=OWLinuxD +!else +OUTD=OWLinuxR +!endif + +# calling convention for compiler: s=Stack, r=Register +CCV=r + +# Linux is case-sensitive, so use lower case h for the Watcom includes. +inc_dirs = -IH -I$(WATCOM)$(DS)lh + +# to track memory leaks, the Open Watcom TRMEM module can be included +# it's useful only if FASTMEM=0 is set, though, otherwise most allocs +# won't use the C heap. +!ifndef TRMEM +TRMEM=0 +!endif + +!ifdef JWLINK +LINK = jwlink.exe +c_flags = -zc +!else +LINK = wlink +c_flags = -zc +!endif + +#cflags stuff +######### +extra_c_flags = +!if $(DEBUG) +extra_c_flags += -od -d2 -DDEBUG_OUT +!else +extra_c_flags += -ot -s -DNDEBUG +!endif + +!if $(TRMEM) +extra_c_flags += -DTRMEM -DFASTMEM=0 +!endif + +!if $(DEBUG) +LOPTD = debug dwarf op symfile +!endif + +CC = wcc386 -q -3$(CCV) $(c_flags) -bc -bt=linux $(inc_dirs) $(extra_c_flags) -fo$@ + +.c{$(OUTD)}.obj: + $(CC) $< + +proj_obj = & +!include owmod.inc + +!if $(TRMEM) +proj_obj += $(OUTD)$(DS)trmem.obj +!endif + +ALL: $(OUTD) $(OUTD)$(DS)$(name) + +$(OUTD): + @if not exist $(OUTD) mkdir $(OUTD) + +$(OUTD)$(DS)$(name) : $(OUTD)$(DS)main.obj $(proj_obj) + $(LINK) @<< +format elf runtime linux +!if $(DEBUG) +$(LOPTD) +!endif +libpath $(WATCOM)$(DS)lib386 +libpath $(WATCOM)$(DS)lib386$(DS)linux +op map=$^*, norelocs, quiet, stack=0x20000 +file { $(OUTD)/main.obj $(proj_obj) } +name $@ +<< + +$(OUTD)$(DS)msgtext.obj: msgtext.c H$(DS)msgdef.h H$(DS)globals.h + $(CC) msgtext.c + +$(OUTD)$(DS)reswords.obj: reswords.c H$(DS)instruct.h H$(DS)special.h H$(DS)directve.h + $(CC) reswords.c + +###### +# Under non-Linux, the link format "elf" forces a file name extension of .elf. +# While this can be prevented by the NOEXTENSION link option, the resulting +# file without extension will not be detected by the "exist" below, so a "clean" +# leaves the file in place. Under Linux this detection works properly. +# Watcom ought to have a internal (=platform independent) command to detect +# the presence of such a file. E.g. %exist alllowing wildcards. + +clean: .SYMBOLIC + @if exist $(OUTD)$(DS)* -rm $(OUTD)$(DS)* + @if exist $(OUTD)$(DS)*.elf -rm $(OUTD)$(DS)*.elf + @if exist $(OUTD)$(DS)*.obj -rm $(OUTD)$(DS)*.obj + @if exist $(OUTD)$(DS)*.map -rm $(OUTD)$(DS)*.map diff --git a/src/OWOS2.mak b/src/OWOS2.mak old mode 100644 new mode 100755 index e75bdcb..7c09758 --- a/src/OWOS2.mak +++ b/src/OWOS2.mak @@ -8,16 +8,35 @@ # environment variable is set correctly. # 2011-07-09 -- rousseau at ecomstation.com -- fixed some stuff. -# - Removed a trailing space after the '&' in the object-list on the +# - Removed a trailing space after the '&' in the object-list on the # line with '$(OUTD)/omffixup.obj' that breaks wmake v1.9. # - Added '.SYMBOLIC' to 'clean:' to supress dependency checking. -# - Added check for existence of files to 'clean:' to supress +# - Added check for existence of files to 'clean:' to supress # abort when files are not found. # - Replaced 'erase' with 'del' in 'clean:' as this is the more common name. - name = JWasm +# Detect which platform we're _running_ on, to use proper +# directory separator. + +!ifdef __LINUX__ +DS=/ +!else +DS=\ +!endif + +# When building _on_ Linux, use the script in the Watcom root +# directory to set up the proper environment variables. Call +# this script as ¨. owsetevn.sh¨ The WATCOM directory +# declarations should not end with a / or \. + +!ifndef %WATCOM +WATCOM=$(DS)Watcom +!else +WATCOM=$(%WATCOM) +!endif + !ifndef DEBUG DEBUG=0 !endif @@ -32,9 +51,10 @@ OUTD=OWOS2R # r will create a slightly smaller binary CCV=r -inc_dirs = -IH +# Linux is case-sensitive, so use lower case h for the Watcom includes. +inc_dirs = -IH -I$(WATCOM)$(DS)h -I$(WATCOM)$(DS)h$(DS)os2 -LINK = wlink.exe +LINK = wlink #cflags stuff ######### @@ -47,7 +67,7 @@ extra_c_flags += -obmilrt -s -DNDEBUG ######### -LOPT = op quiet +#LOPT = op quiet !if $(DEBUG) LOPTD = debug dwarf op symfile !endif @@ -62,27 +82,27 @@ CC=wcc386 -q -3$(CCV) -bc -bt=os2 $(inc_dirs) $(extra_c_flags) -fo$@ proj_obj = & !include owmod.inc -TARGET1=$(OUTD)/$(name).exe +TARGET1=$(OUTD)$(DS)$(name).exe ALL: $(OUTD) $(TARGET1) $(OUTD): - @if not exist $(OUTD) mkdir $(OUTD) + @if not exist $(OUTD) mkdir $(OUTD) -$(TARGET1): $(OUTD)/main.obj $(proj_obj) - $(LINK) @<< -$(lflagso) file { $(OUTD)/main.obj $(proj_obj) } name $@ op stack=0x20000 +$(TARGET1): $(OUTD)$(DS)main.obj $(proj_obj) + $(LINK) @<< +$(lflagso) file { $(OUTD)$(DS)main.obj $(proj_obj) } name $@ op stack=0x20000 << -$(OUTD)/msgtext.obj: msgtext.c H/msgdef.h H/globals.h - $(CC) msgtext.c +$(OUTD)$(DS)msgtext.obj: msgtext.c H$(DS)msgdef.h H$(DS)globals.h + $(CC) msgtext.c -$(OUTD)/reswords.obj: reswords.c H/instruct.h H/special.h H/directve.h - $(CC) reswords.c +$(OUTD)$(DS)reswords.obj: reswords.c H$(DS)instruct.h H$(DS)special.h H$(DS)directve.h + $(CC) reswords.c ###### clean: .SYMBOLIC - @if exist $(OUTD)\*.exe del $(OUTD)\*.exe - @if exist $(OUTD)\*.obj del $(OUTD)\*.obj - @if exist $(OUTD)\*.map del $(OUTD)\*.map + @if exist $(OUTD)$(DS)*.exe -rm $(OUTD)$(DS)*.exe + @if exist $(OUTD)$(DS)*.obj -rm $(OUTD)$(DS)*.obj + @if exist $(OUTD)$(DS)*.map -rm $(OUTD)$(DS)*.map diff --git a/src/owmod.inc b/src/owmod.inc index 7668ba5..1c10e5c 100644 --- a/src/owmod.inc +++ b/src/owmod.inc @@ -1,56 +1,56 @@ -$(OUTD)/apiemu.obj & -$(OUTD)/assemble.obj & -$(OUTD)/assume.obj & -$(OUTD)/atofloat.obj & -$(OUTD)/backptch.obj & -$(OUTD)/bin.obj & -$(OUTD)/branch.obj & -$(OUTD)/cmdline.obj & -$(OUTD)/codegen.obj & -$(OUTD)/coff.obj & -$(OUTD)/condasm.obj & -$(OUTD)/context.obj & -$(OUTD)/cpumodel.obj & -$(OUTD)/data.obj & -$(OUTD)/dbgcv.obj & -$(OUTD)/directiv.obj & -$(OUTD)/elf.obj & -$(OUTD)/end.obj & -$(OUTD)/equate.obj & -$(OUTD)/errmsg.obj & -$(OUTD)/expans.obj & -$(OUTD)/expreval.obj & -$(OUTD)/extern.obj & -$(OUTD)/fastpass.obj & -$(OUTD)/fixup.obj & -$(OUTD)/fpfixup.obj & -$(OUTD)/hll.obj & -$(OUTD)/input.obj & -$(OUTD)/invoke.obj & -$(OUTD)/label.obj & -$(OUTD)/linnum.obj & -$(OUTD)/listing.obj & -$(OUTD)/loop.obj & -$(OUTD)/lqueue.obj & -$(OUTD)/macro.obj & -$(OUTD)/mangle.obj & -$(OUTD)/memalloc.obj & -$(OUTD)/msgtext.obj & -$(OUTD)/omf.obj & -$(OUTD)/omffixup.obj & -$(OUTD)/omfint.obj & -$(OUTD)/option.obj & -$(OUTD)/parser.obj & -$(OUTD)/posndir.obj & -$(OUTD)/preproc.obj & -$(OUTD)/proc.obj & -$(OUTD)/queue.obj & -$(OUTD)/reswords.obj & -$(OUTD)/safeseh.obj & -$(OUTD)/segment.obj & -$(OUTD)/simsegm.obj & -$(OUTD)/string.obj & -$(OUTD)/symbols.obj & -$(OUTD)/tbyte.obj & -$(OUTD)/tokenize.obj & -$(OUTD)/types.obj +$(OUTD)$(DS)apiemu.obj & +$(OUTD)$(DS)assemble.obj & +$(OUTD)$(DS)assume.obj & +$(OUTD)$(DS)atofloat.obj & +$(OUTD)$(DS)backptch.obj & +$(OUTD)$(DS)bin.obj & +$(OUTD)$(DS)branch.obj & +$(OUTD)$(DS)cmdline.obj & +$(OUTD)$(DS)codegen.obj & +$(OUTD)$(DS)coff.obj & +$(OUTD)$(DS)condasm.obj & +$(OUTD)$(DS)context.obj & +$(OUTD)$(DS)cpumodel.obj & +$(OUTD)$(DS)data.obj & +$(OUTD)$(DS)dbgcv.obj & +$(OUTD)$(DS)directiv.obj & +$(OUTD)$(DS)elf.obj & +$(OUTD)$(DS)end.obj & +$(OUTD)$(DS)equate.obj & +$(OUTD)$(DS)errmsg.obj & +$(OUTD)$(DS)expans.obj & +$(OUTD)$(DS)expreval.obj & +$(OUTD)$(DS)extern.obj & +$(OUTD)$(DS)fastpass.obj & +$(OUTD)$(DS)fixup.obj & +$(OUTD)$(DS)fpfixup.obj & +$(OUTD)$(DS)hll.obj & +$(OUTD)$(DS)input.obj & +$(OUTD)$(DS)invoke.obj & +$(OUTD)$(DS)label.obj & +$(OUTD)$(DS)linnum.obj & +$(OUTD)$(DS)listing.obj & +$(OUTD)$(DS)loop.obj & +$(OUTD)$(DS)lqueue.obj & +$(OUTD)$(DS)macro.obj & +$(OUTD)$(DS)mangle.obj & +$(OUTD)$(DS)memalloc.obj & +$(OUTD)$(DS)msgtext.obj & +$(OUTD)$(DS)omf.obj & +$(OUTD)$(DS)omffixup.obj & +$(OUTD)$(DS)omfint.obj & +$(OUTD)$(DS)option.obj & +$(OUTD)$(DS)parser.obj & +$(OUTD)$(DS)posndir.obj & +$(OUTD)$(DS)preproc.obj & +$(OUTD)$(DS)proc.obj & +$(OUTD)$(DS)queue.obj & +$(OUTD)$(DS)reswords.obj & +$(OUTD)$(DS)safeseh.obj & +$(OUTD)$(DS)segment.obj & +$(OUTD)$(DS)simsegm.obj & +$(OUTD)$(DS)string.obj & +$(OUTD)$(DS)symbols.obj & +$(OUTD)$(DS)tbyte.obj & +$(OUTD)$(DS)tokenize.obj & +$(OUTD)$(DS)types.obj