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\outelf32.$(OBJ) output\outelf64.$(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 preproc.h insns.h pptok.h regs.h regflags.c \
160 config.h version.h nasmlib.h nasm.h regvals.c insnsi.h assemble.h
161 disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
162 version.h nasm.h insnsn.c names.c insnsi.h disasm.h
163 eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
165 float.$(OBJ): float.c regs.h config.h version.h nasm.h
166 insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
167 insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
168 insnsn.$(OBJ): insnsn.c
169 labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h
170 listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
172 macros.$(OBJ): macros.c
173 names.$(OBJ): names.c regs.c insnsn.c
174 nasm.$(OBJ): nasm.c labels.h preproc.h insns.h parser.h eval.h pptok.h \
175 regs.h outform.h config.h version.h nasmlib.h nasm.h stdscan.h assemble.h \
177 nasmlib.$(OBJ): nasmlib.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
179 ndisasm.$(OBJ): ndisasm.c insns.h sync.h regs.h config.h version.h nasmlib.h \
180 nasm.h insnsi.h disasm.h
181 outform.$(OBJ): outform.c regs.h config.h outform.h version.h nasm.h
182 output\outaout.$(OBJ): output\outaout.c regs.h outform.h config.h version.h \
183 nasmlib.h nasm.h stdscan.h
184 output\outas86.$(OBJ): output\outas86.c regs.h outform.h config.h version.h \
186 output\outbin.$(OBJ): output\outbin.c labels.h eval.h regs.h outform.h \
187 config.h version.h nasmlib.h nasm.h stdscan.h
188 output\outcoff.$(OBJ): output\outcoff.c regs.h outform.h config.h version.h \
190 output\outdbg.$(OBJ): output\outdbg.c regs.h outform.h config.h version.h \
192 output\outelf32.$(OBJ): output\outelf32.c regs.h outform.h config.h \
193 version.h nasmlib.h nasm.h stdscan.h
194 output\outelf64.$(OBJ): output\outelf64.c regs.h outform.h config.h \
195 version.h nasmlib.h nasm.h stdscan.h
196 output\outieee.$(OBJ): output\outieee.c regs.h outform.h config.h version.h \
198 output\outmacho.$(OBJ): output\outmacho.c compiler.h regs.h outform.h \
199 config.h version.h nasmlib.h nasm.h
200 output\outobj.$(OBJ): output\outobj.c regs.h outform.h config.h version.h \
201 nasmlib.h nasm.h stdscan.h
202 output\outrdf.$(OBJ): output\outrdf.c regs.h outform.h config.h version.h \
204 output\outrdf2.$(OBJ): output\outrdf2.c rdoff\rdoff.h regs.h outform.h \
205 config.h version.h nasmlib.h nasm.h
206 parser.$(OBJ): parser.c insns.h parser.h float.h regs.h regflags.c config.h \
207 version.h nasmlib.h nasm.h stdscan.h insnsi.h
208 pptok.$(OBJ): pptok.c
209 preproc.$(OBJ): preproc.c preproc.h macros.c pptok.h regs.h config.h \
210 version.h nasmlib.h nasm.h
211 regdis.$(OBJ): regdis.c
212 regflags.$(OBJ): regflags.c
214 regvals.$(OBJ): regvals.c
215 stdscan.$(OBJ): stdscan.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
217 sync.$(OBJ): sync.c sync.h
218 tokhash.$(OBJ): tokhash.c insns.h regs.h config.h version.h nasm.h insnsi.h