3 # Makefile for building NASM using OpenWatcom 1.7
4 # building on a DOS/Win/OS2 platform host (backslashes
11 prefix = C:\Program Files\NASM
12 exec_prefix = $(prefix)
13 bindir = $(prefix)\bin
14 mandir = $(prefix)\man
18 CFLAGS = -6 -ox -wx -ze -fpi $(DEBUG)
19 BUILD_CFLAGS = $(CFLAGS) $(TARGET_FLAGS) # -I$(srcdir)/inttypes
20 INTERNAL_CFLAGS = -I$(srcdir) -I. -DHAVE_SNPRINTF -DHAVE_VSNPRINTF
21 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
23 LDFLAGS = $(ALL_CFLAGS)
25 PERL = perl -I$(srcdir)/perllib
33 # WMAKE errors out if a suffix is declared more than once, including
34 # its own built-in declarations. Thus, we need to explicitly clear the list
35 # first. Also, WMAKE only allows implicit rules that point "to the left"
38 .SUFFIXES: .man .1 .$(O) .i .c
40 # Needed to find C files anywhere but in the current directory
44 $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
46 # Note: wcl386 is broken if forward slashes are used as path separators.
47 #-- Begin File Lists --#
48 # Edit in Makefile.in, not here!
49 NASM = nasm.$(O) nasmlib.$(O) raa.$(O) saa.$(O) &
50 float.$(O) insnsa.$(O) insnsb.$(O) &
51 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) &
52 outform.$(O) outlib.$(O) output\outbin.$(O) &
53 output\outaout.$(O) output\outcoff.$(O) &
54 output\outelf32.$(O) output\outelf64.$(O) &
55 output\outobj.$(O) output\outas86.$(O) output\outrdf2.$(O) &
56 output\outdbg.$(O) output\outieee.$(O) output\outmacho.$(O) &
57 preproc.$(O) quote.$(O) pptok.$(O) macros.$(O) &
58 listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) strfunc.$(O) &
59 tokhash.$(O) regvals.$(O) regflags.$(O)
61 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) &
62 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
63 #-- End File Lists --#
66 @echo Please build "dos", "win32" or "os2"
69 $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=DOS -l=DOS4G"
72 $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=NT -l=NT"
75 $(MAKE) /f $(__MAKEFILES__) all TARGET_FLAGS="-bt=OS2 -l=OS2V2"
77 all: nasm$(X) ndisasm$(X) .SYMBOLIC
78 rem cd rdoff && $(MAKE) all
81 $(LD) $(LDFLAGS) -fe=nasm$(X) $(NASM) $(LIBS)
83 ndisasm$(X): $(NDISASM)
84 $(LD) $(LDFLAGS) -fe=ndisasm$(X) $(NDISASM) $(LIBS)
86 # These source files are automagically generated from a single
87 # instruction-table file by a Perl script. They're distributed,
88 # though, so it isn't necessary to have Perl just to recompile NASM
89 # from the distribution.
91 insnsb.c: insns.dat insns.pl
92 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
93 insnsa.c: insns.dat insns.pl
94 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
95 insnsd.c: insns.dat insns.pl
96 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
97 insnsi.h: insns.dat insns.pl
98 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
99 insnsn.c: insns.dat insns.pl
100 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
102 # These files contains all the standard macros that are derived from
103 # the version number.
104 version.h: version version.pl
105 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
107 version.mac: version version.pl
108 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
110 # This source file is generated from the standard macros file
111 # `standard.mac' by another Perl script. Again, it's part of the
112 # standard distribution.
114 macros.c: macros.pl standard.mac version.mac
115 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
117 # These source files are generated from regs.dat by yet another
119 regs.c: regs.dat regs.pl
120 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
121 regflags.c: regs.dat regs.pl
122 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
123 regdis.c: regs.dat regs.pl
124 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
125 regdis.h: regs.dat regs.pl
126 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
127 regvals.c: regs.dat regs.pl
128 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
129 regs.h: regs.dat regs.pl
130 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
132 # Assembler token hash
133 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
134 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat &
135 $(srcdir)/tokens.dat > tokhash.c
137 # Assembler token metadata
138 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
139 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat &
140 $(srcdir)/tokens.dat > tokens.h
142 # Preprocessor token hash
143 pptok.h: pptok.dat pptok.pl perllib/phash.ph
144 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
145 pptok.c: pptok.dat pptok.pl perllib/phash.ph
146 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
148 # This target generates all files that require perl.
149 # This allows easier generation of distribution (see dist target).
150 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c &
151 regs.c regs.h regflags.c regdis.c regdis.h regvals.c &
152 tokhash.c tokens.h pptok.h pptok.c &
153 version.h version.mac
160 -del /f output\*.$(O)
165 rem cd rdoff && $(MAKE) clean
167 distclean: clean .SYMBOLIC
170 -del /f config.status
182 -del /f/s autom4te*.cache
183 rem cd rdoff && $(MAKE) distclean
185 cleaner: clean .SYMBOLIC
189 rem cd doc && $(MAKE) clean
191 spotless: distclean cleaner .SYMBOLIC
200 # cd rdoff && $(MAKE)
203 # cd doc && $(MAKE) all
205 everything: all doc rdf
207 #-- Magic hints to mkdep.pl --#
208 # @object-ending: ".$(O)"
209 # @path-separator: "\"
210 # @exclude: "config.h"
212 #-- Everything below is generated by mkdep.pl - do not edit --#
213 assemble.$(O): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h &
214 nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h version.h
215 crc64.$(O): crc64.c compiler.h nasmlib.h
216 disasm.$(O): disasm.c compiler.h disasm.h insns.h insnsi.h nasm.h nasmlib.h &
217 pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h version.h
218 eval.$(O): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h &
219 nasmlib.h pptok.h preproc.h regs.h version.h
220 exprlib.$(O): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h &
221 preproc.h regs.h version.h
222 float.$(O): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h pptok.h &
223 preproc.h regs.h version.h
224 hashtbl.$(O): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h &
225 pptok.h preproc.h regs.h version.h
226 insnsa.$(O): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h &
227 preproc.h regs.h tokens.h version.h
228 insnsb.$(O): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h &
229 preproc.h regs.h tokens.h version.h
230 insnsd.$(O): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h &
231 preproc.h regs.h tokens.h version.h
232 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
233 labels.$(O): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h pptok.h &
234 preproc.h regs.h version.h
235 lib\snprintf.$(O): lib\snprintf.c compiler.h nasmlib.h
236 lib\vsnprintf.$(O): lib\vsnprintf.c compiler.h nasmlib.h
237 listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h &
238 pptok.h preproc.h regs.h version.h
239 macros.$(O): macros.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h &
240 outform.h pptok.h preproc.h regs.h tables.h version.h
241 nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h &
242 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h &
243 raa.h regs.h saa.h stdscan.h tokens.h version.h
244 nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h &
245 preproc.h regs.h tokens.h version.h
246 ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h &
247 nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h version.h
248 outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h &
249 pptok.h preproc.h regs.h version.h
250 outlib.$(O): outlib.c compiler.h insnsi.h nasm.h nasmlib.h outlib.h pptok.h &
251 preproc.h regs.h version.h
252 output\outaout.$(O): output\outaout.c compiler.h insnsi.h nasm.h nasmlib.h &
253 outform.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h version.h
254 output\outas86.$(O): output\outas86.c compiler.h insnsi.h nasm.h nasmlib.h &
255 outform.h pptok.h preproc.h raa.h regs.h saa.h version.h
256 output\outbin.$(O): output\outbin.c compiler.h eval.h insnsi.h labels.h &
257 nasm.h nasmlib.h outform.h pptok.h preproc.h regs.h saa.h stdscan.h &
259 output\outcoff.$(O): output\outcoff.c compiler.h insnsi.h nasm.h nasmlib.h &
260 outform.h pptok.h preproc.h raa.h regs.h saa.h version.h
261 output\outdbg.$(O): output\outdbg.c compiler.h insnsi.h nasm.h nasmlib.h &
262 outform.h pptok.h preproc.h regs.h version.h
263 output\outelf32.$(O): output\outelf32.c compiler.h insnsi.h nasm.h nasmlib.h &
264 outform.h outlib.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h version.h
265 output\outelf64.$(O): output\outelf64.c compiler.h insnsi.h nasm.h nasmlib.h &
266 outform.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h version.h
267 output\outieee.$(O): output\outieee.c compiler.h insnsi.h nasm.h nasmlib.h &
268 outform.h pptok.h preproc.h regs.h version.h
269 output\outmacho.$(O): output\outmacho.c compiler.h insnsi.h nasm.h nasmlib.h &
270 outform.h pptok.h preproc.h raa.h regs.h saa.h version.h
271 output\outobj.$(O): output\outobj.c compiler.h insnsi.h nasm.h nasmlib.h &
272 outform.h pptok.h preproc.h regs.h stdscan.h version.h
273 output\outrdf.$(O): output\outrdf.c compiler.h insnsi.h nasm.h nasmlib.h &
274 outform.h pptok.h preproc.h regs.h version.h
275 output\outrdf2.$(O): output\outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h &
276 outform.h pptok.h preproc.h rdoff\rdoff.h regs.h saa.h version.h
277 parser.$(O): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h &
278 parser.h pptok.h preproc.h regs.h stdscan.h tables.h tokens.h version.h
279 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
280 preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h &
281 pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
282 quote.$(O): quote.c compiler.h nasmlib.h quote.h
283 raa.$(O): raa.c compiler.h nasmlib.h raa.h
284 regdis.$(O): regdis.c regdis.h regs.h
285 regflags.$(O): regflags.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h &
286 preproc.h regs.h tables.h version.h
287 regs.$(O): regs.c compiler.h insnsi.h tables.h
288 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
289 saa.$(O): saa.c compiler.h nasmlib.h saa.h
290 stdscan.$(O): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h &
291 preproc.h quote.h regs.h stdscan.h tokens.h version.h
292 strfunc.$(O): strfunc.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h &
293 preproc.h regs.h version.h
294 sync.$(O): sync.c compiler.h nasmlib.h sync.h
295 tokhash.$(O): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h &
296 nasmlib.h pptok.h preproc.h regs.h tokens.h version.h