1 # Makefile for the Netwide Assembler under 16-bit DOS
3 # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
4 # Julian Hall. All rights reserved. The software is
5 # redistributable under the licence given in the file "Licence"
6 # distributed in the NASM archive.
8 # This Makefile is designed to build NASM using a 16-bit DOS C
9 # compiler such as Microsoft C, provided you have a compatible MAKE.
10 # It's been tested with Microsoft C 5.x plus Borland Make. (Yes, I
11 # know it's silly, but...)
13 # update: MSC 5.1 will not compile 'nasmlib.c' (arg lists don't match)
14 # MSC 6.00A will not compile 'insnsa.c' (qcl is required)
15 # MSC 7.00 will compile all
17 # GNU software compiled by DJGPP is also required:
22 # Source and DOS/Windows binaries may be downloaded from:
24 # ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/
26 # Compilation has been tested under Windows 98 & Windows 2000
27 # MSC 7.00 & DJGPP applications require a DPMI interface, which is
28 # a part of MSC 7.00 under DOS. It is also a part of Windows.
31 # For a 16-bit compiler, we don't need all the formats
33 CONFIG = -DOF_ONLY -DOF_BIN -DOF_OBJ -DOF_WIN32 -DOF_AS86
35 #CC = cl /c /O /AL /Gt
36 # Compile for a 286, ain't nobody using an 8086 anymore
37 CC = cl /c /Oz /AL /Gt256 /G2 /I.. # MSC 7.00
40 QCL = $(CC) # MSC 7.00
43 LINKFLAGS = /F4000 /Fm
49 $(CC) $(CONFIG) /Fo$@ $*.c
51 NASMOBJS1 = nasm.$(OBJ) nasmlib.$(OBJ) float.$(OBJ) insnsa.$(OBJ) \
52 assemble.$(OBJ) labels.$(OBJ) parser.$(OBJ) outform.$(OBJ)
53 NASMOBJS2 = output\outbin.$(OBJ) output\outaout.$(OBJ) output\outcoff.$(OBJ)
54 NASMOBJS3 = output\outelf.$(OBJ) output\outobj.$(OBJ) output\outas86.$(OBJ)
55 NASMOBJS4 = output\outrdf.$(OBJ) output\outrdf2.$(OBJ) output\outieee.$(OBJ)
56 NASMOBJS5 = output\outdbg.$(OBJ) preproc.$(OBJ) listing.$(OBJ) eval.$(OBJ)
58 NASMOBJS = $(NASMOBJS1) $(NASMOBJS2) $(NASMOBJS3) $(NASMOBJS4) $(NASMOBJS5)
60 NDISASMOBJS = ndisasm.$(OBJ) disasm.$(OBJ) sync.$(OBJ) nasmlib.$(OBJ) \
63 all : nasm$(EXE) ndisasm$(EXE)
65 # We have to have a horrible kludge here to get round the 128 character
67 LINKOBJS = a*.obj e*.obj f*.obj insnsa.obj l*.obj na*.obj o*.obj p*.obj
68 nasm$(EXE): $(NASMOBJS)
69 echo $(NASMOBJS1) + >foo
70 echo $(NASMOBJS2) + >>foo
71 echo $(NASMOBJS3) + >>foo
72 echo $(NASMOBJS4) + >>foo
73 echo $(NASMOBJS5) >> foo
74 $(LINK) /st:4096 @foo,nasm;
76 ndisasm$(EXE): $(NDISASMOBJS)
77 $(LINK) $(NDISASMOBJS), ndisasm;
79 output\version.h: version.h
85 output\insnsi.h: insnsi.h
88 output\nasmlib.h: nasmlib.h
91 output\outform.h: outform.h
94 # These files contains all the standard macros that are derived from
96 version.h: version version.pl
97 perl version.pl h < version > version.h
99 version.mac: version version.pl
100 perl version.pl mac < version > version.mac
102 # This source file is generated from the standard macros file
103 # `standard.mac' by another Perl script. Again, it's part of the
104 # standard distribution.
106 macros.c: macros.pl standard.mac version.mac
107 perl macros.pl standard.mac version.mac
109 insnsa.c insnsd.c insnsi.h insnsn.c: insns16.dat insns.pl
110 perl insns.pl insns16.dat
112 insns16.dat: insns.dat
113 grep -v WILLAMETTE insns.dat | grep -v KATMAI | grep -v SSE | \
114 grep -v MMX | grep -v 3DNOW | grep -v UNDOC >insns16.dat
116 # These source files are generated from regs.dat by yet another
118 regs.c: regs.dat regs.pl
119 perl regs.pl c regs.dat > regs.c
120 regflags.c: regs.dat regs.pl
121 perl regs.pl fc regs.dat > regflags.c
122 regdis.c: regs.dat regs.pl
123 perl regs.pl dc regs.dat > regdis.c
124 regvals.c: regs.dat regs.pl
125 perl regs.pl vc regs.dat > regvals.c
126 regs.h: regs.dat regs.pl
127 perl regs.pl h regs.dat > regs.h
129 # Another grotty hack: QC is less likely to run out of memory than
130 # CL proper; and we don't need any optimisation in these modules
131 # since they're just data.
132 insnsa.$(OBJ): insnsa.c nasm.h version.h insnsi.h insns.h
135 insnsd.$(OBJ): insnsd.c nasm.h version.h insnsi.h insns.h
155 #-- Magic hints to mkdep.pl --#
156 # @object-ending: ".$(OBJ)"
157 # @path-separator: "\"
158 #-- Everything below is generated by mkdep.pl - do not edit --#
159 assemble.$(OBJ): assemble.c insns.h assemble.h regvals.c nasm.h regs.h \
160 insnsi.h nasmlib.h version.h
161 disasm.$(OBJ): disasm.c insns.h regs.c sync.h names.c nasm.h disasm.h regs.h \
162 insnsn.c insnsi.h version.h regdis.c
163 eval.$(OBJ): eval.c nasm.h regs.h labels.h nasmlib.h version.h eval.h
164 float.$(OBJ): float.c nasm.h regs.h version.h
165 insnsa.$(OBJ): insnsa.c insns.h nasm.h regs.h insnsi.h version.h
166 insnsd.$(OBJ): insnsd.c insns.h nasm.h regs.h insnsi.h version.h
167 insnsn.$(OBJ): insnsn.c
168 labels.$(OBJ): labels.c nasm.h regs.h nasmlib.h version.h
169 listing.$(OBJ): listing.c listing.h nasm.h regs.h nasmlib.h version.h
170 macros.$(OBJ): macros.c
171 names.$(OBJ): names.c regs.c insnsn.c
172 nasm.$(OBJ): nasm.c listing.h preproc.h insns.h outform.h assemble.h \
173 parser.h nasm.h regs.h labels.h insnsi.h nasmlib.h version.h eval.h
174 nasmlib.$(OBJ): nasmlib.c insns.h regs.c names.c nasm.h regs.h insnsn.c \
175 insnsi.h nasmlib.h version.h
176 ndisasm.$(OBJ): ndisasm.c insns.h sync.h nasm.h disasm.h regs.h insnsi.h \
178 outform.$(OBJ): outform.c outform.h nasm.h regs.h version.h
179 output\outaout.$(OBJ): output\outaout.c outform.h nasm.h regs.h nasmlib.h \
181 output\outas86.$(OBJ): output\outas86.c outform.h nasm.h regs.h nasmlib.h \
183 output\outbin.$(OBJ): output\outbin.c outform.h nasm.h regs.h nasmlib.h \
185 output\outcoff.$(OBJ): output\outcoff.c outform.h nasm.h regs.h nasmlib.h \
187 output\outdbg.$(OBJ): output\outdbg.c outform.h nasm.h regs.h nasmlib.h \
189 output\outelf.$(OBJ): output\outelf.c outform.h nasm.h regs.h nasmlib.h \
191 output\outieee.$(OBJ): output\outieee.c outform.h nasm.h regs.h nasmlib.h \
193 output\outobj.$(OBJ): output\outobj.c outform.h nasm.h regs.h nasmlib.h \
195 output\outrdf.$(OBJ): output\outrdf.c outform.h nasm.h regs.h nasmlib.h \
197 output\outrdf2.$(OBJ): output\outrdf2.c outform.h nasm.h regs.h nasmlib.h \
199 parser.$(OBJ): parser.c insns.h parser.h nasm.h regs.h insnsi.h regflags.c \
200 float.h nasmlib.h version.h
201 preproc.$(OBJ): preproc.c nasm.h macros.c regs.h nasmlib.h version.h
202 regdis.$(OBJ): regdis.c
203 regflags.$(OBJ): regflags.c
205 regvals.$(OBJ): regvals.c
206 sync.$(OBJ): sync.c sync.h