Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make OpenWatcon file multiplatform, so they work on Linux and OS/2. #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 50 additions & 28 deletions src/OWDOS16.mak
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
#########
Expand All @@ -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
225 changes: 127 additions & 98 deletions src/OWLinux.mak
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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
Loading