Support building 16-bit DOS binaries using OpenWatcom

This commit is contained in:
H. Peter Anvin 2003-08-30 03:49:30 +00:00
parent e68699287c
commit cefdfbc070
3 changed files with 149 additions and 2 deletions

138
Mkfiles/Makefile.wcd Normal file
View File

@ -0,0 +1,138 @@
# host: watcom c (dos, windows, os/2)
# target: dos 16bit
# Makefile for the Netwide Assembler
#
# The Netwide Assembler is copyright (C) 1996 Simon Tatham and
# Julian Hall. All rights reserved. The software is
# redistributable under the licence given in the file "Licence"
# distributed in the NASM archive.
#
# this makefile is designed for use with the OpenWatcom C
# compiler, it generates dos 16 bit executable
# it has been tested with
# OpenWatcom wmake.exe /u 1.1-rc1 (remember about that /u option :)
#
# Tested with OpenWatcom 1.1-rc1.
# MAKE SURE THE "WATCOM" ENVIRONMENT VARIABLE IS SET TO THE
# OPENWATCOM INCLUDE DIRECTORY!
# output formats
OUTFORMS = -DOF_ONLY -DOF_BIN -DOF_OBJ -DOF_WIN32 -DOF_AS86
# compiler flags
CFLAGS = -fpi -ml -j -s -bt=dos -ohk -zp1 -os -zt32 -I$(%WATCOM)\h $(OUTFORMS)
# -fpi inline math + emulation
# -ml large model
# -j signed char
# -s no stack checking
# -bt=dos target system - dos
# -ohk optimizations
# -zp1 don't align structure members
# -os optimize for size
# -zt32 put objects > 32 bytes in separate segments
# compiler
CC = wcc $(CFLAGS)
# linker flags
LDFLAGS =
# linker
LD = wcl
# object file extension
OBJ = obj
# Where C directories live
.c : .;.\output\
.c.obj:
$(CC) -fo=$@ $[@
NASMOBJS = nasm.$(OBJ) nasmlib.$(OBJ) float.$(OBJ) insnsa.$(OBJ) \
assemble.$(OBJ) labels.$(OBJ) parser.$(OBJ) outform.$(OBJ) \
outbin.$(OBJ) outaout.$(OBJ) outcoff.$(OBJ) \
outelf.$(OBJ) outobj.$(OBJ) outas86.$(OBJ) \
outrdf.$(OBJ) outdbg.$(OBJ) \
preproc.$(OBJ) listing.$(OBJ) eval.$(OBJ) outrdf2.$(OBJ) \
outieee.$(OBJ)
NDISASMOBJS = ndisasm.$(OBJ) disasm.$(OBJ) sync.$(OBJ) nasmlib.$(OBJ) \
insnsd.$(OBJ)
.NOCHECK
all : nasm.exe ndisasm.exe
rem This is dummy command for dumb make
nasm.exe: $(NASMOBJS)
$(LD) $(LDFLAGS) -fe=nasm.exe $(NASMOBJS)
ndisasm.exe: $(NDISASMOBJS)
$(LD) $(LDFLAGS) -fe=ndisasm.exe $(NDISASMOBJS)
# linker response files
nasm.lnk: $(NASMOBJS)
%create $@
%append $@ N nasm.exe
for %i in ($(NASMOBJS)) do %append $@ F %i
ndisasm.lnk:
%create $@
%append $@ N nasm.exe
for %i in ($(NDISASMOBJS)) do %append $@ F %i
clean : .SYMBOLIC
-del *.obj
-del *.lnk
-del nasm.exe
-del ndisasm.exe
#-- Magic hints to mkdep.pl --#
# @object-ending: ".$(OBJ)"
# @path-separator: "" # This means kill the path completely
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c insns.h assemble.h regvals.c nasm.h regs.h \
insnsi.h nasmlib.h version.h
disasm.$(OBJ): disasm.c insns.h regs.c sync.h names.c nasm.h disasm.h regs.h \
insnsn.c insnsi.h version.h regdis.c
eval.$(OBJ): eval.c nasm.h regs.h labels.h nasmlib.h version.h eval.h
float.$(OBJ): float.c nasm.h regs.h version.h
insnsa.$(OBJ): insnsa.c insns.h nasm.h regs.h insnsi.h version.h
insnsd.$(OBJ): insnsd.c insns.h nasm.h regs.h insnsi.h version.h
insnsn.$(OBJ): insnsn.c
labels.$(OBJ): labels.c nasm.h regs.h nasmlib.h version.h
listing.$(OBJ): listing.c listing.h nasm.h regs.h nasmlib.h version.h
macros.$(OBJ): macros.c
names.$(OBJ): names.c regs.c insnsn.c
nasm.$(OBJ): nasm.c listing.h preproc.h insns.h outform.h assemble.h \
parser.h nasm.h regs.h labels.h insnsi.h nasmlib.h version.h eval.h
nasmlib.$(OBJ): nasmlib.c insns.h regs.c names.c nasm.h regs.h insnsn.c \
insnsi.h nasmlib.h version.h
ndisasm.$(OBJ): ndisasm.c insns.h sync.h nasm.h disasm.h regs.h insnsi.h \
nasmlib.h version.h
outform.$(OBJ): outform.c outform.h nasm.h regs.h version.h
outaout.$(OBJ): outaout.c outform.h nasm.h regs.h nasmlib.h \
version.h
outas86.$(OBJ): outas86.c outform.h nasm.h regs.h nasmlib.h \
version.h
outbin.$(OBJ): outbin.c outform.h nasm.h regs.h nasmlib.h \
version.h
outcoff.$(OBJ): outcoff.c outform.h nasm.h regs.h nasmlib.h \
version.h
outdbg.$(OBJ): outdbg.c outform.h nasm.h regs.h nasmlib.h \
version.h
outelf.$(OBJ): outelf.c outform.h nasm.h regs.h nasmlib.h \
version.h
outieee.$(OBJ): outieee.c outform.h nasm.h regs.h nasmlib.h \
version.h
outobj.$(OBJ): outobj.c outform.h nasm.h regs.h nasmlib.h \
version.h
outrdf.$(OBJ): outrdf.c outform.h nasm.h regs.h nasmlib.h \
version.h
outrdf2.$(OBJ): outrdf2.c outform.h nasm.h regs.h nasmlib.h \
version.h
parser.$(OBJ): parser.c insns.h parser.h nasm.h regs.h insnsi.h regflags.c \
float.h nasmlib.h version.h
preproc.$(OBJ): preproc.c nasm.h macros.c regs.h nasmlib.h version.h
regdis.$(OBJ): regdis.c
regflags.$(OBJ): regflags.c
regs.$(OBJ): regs.c
regvals.$(OBJ): regvals.c
sync.$(OBJ): sync.c sync.h

View File

@ -28,7 +28,9 @@ The Makefiles are:
Makefile.scw Win32 Symantec C++ 7
Makefile.unx Unix Any(*) use only if "configure" fails
Makefile.vc Win32 MS Visual C++ OK as of NASM 0.98.32
Makefile.wcw Win32 Watcom C
Makefile.wc 32-bit DOS Watcom C (**)
Makefile.wcd 16-bit DOS OpenWatcom C OK as of NASM 0.98.37
Makefile.wcw Win32 Watcom C (**)
(*) = This Makefile should work with any compiler which is ANSI

View File

@ -67,7 +67,14 @@ sub convert_file($$) {
unshift(@fspec, basename($file));
}
return join($sep, @fspec);
if ( $sep eq '' ) {
# This means kill path completely. Used with Makes who do
# path searches, but doesn't handle output files in subdirectories,
# like OpenWatcom WMAKE.
return $fspec[scalar(@fspec)-1];
} else {
return join($sep, @fspec);
}
}
#