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) 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 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 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 regs.h version.h
220 exprlib.$(O): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h &
222 float.$(O): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h &
224 hashtbl.$(O): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h &
226 insnsa.$(O): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
228 insnsb.$(O): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
230 insnsd.$(O): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.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 regs.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 &
239 macros.$(O): macros.c compiler.h insnsi.h tables.h
240 nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h &
241 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h &
242 raa.h regs.h saa.h stdscan.h tokens.h version.h
243 nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h &
245 ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h &
246 nasmlib.h regs.h sync.h tokens.h version.h
247 outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h &
249 output\outaout.$(O): output\outaout.c compiler.h insnsi.h nasm.h nasmlib.h &
250 outform.h raa.h regs.h saa.h stdscan.h version.h
251 output\outas86.$(O): output\outas86.c compiler.h insnsi.h nasm.h nasmlib.h &
252 outform.h raa.h regs.h saa.h version.h
253 output\outbin.$(O): output\outbin.c compiler.h eval.h insnsi.h labels.h &
254 nasm.h nasmlib.h outform.h regs.h saa.h stdscan.h version.h
255 output\outcoff.$(O): output\outcoff.c compiler.h insnsi.h nasm.h nasmlib.h &
256 outform.h raa.h regs.h saa.h version.h
257 output\outdbg.$(O): output\outdbg.c compiler.h insnsi.h nasm.h nasmlib.h &
258 outform.h regs.h version.h
259 output\outelf32.$(O): output\outelf32.c compiler.h insnsi.h nasm.h nasmlib.h &
260 outform.h raa.h regs.h saa.h stdscan.h version.h
261 output\outelf64.$(O): output\outelf64.c compiler.h insnsi.h nasm.h nasmlib.h &
262 outform.h raa.h regs.h saa.h stdscan.h version.h
263 output\outieee.$(O): output\outieee.c compiler.h insnsi.h nasm.h nasmlib.h &
264 outform.h regs.h version.h
265 output\outmacho.$(O): output\outmacho.c compiler.h insnsi.h nasm.h nasmlib.h &
266 outform.h raa.h regs.h saa.h version.h
267 output\outobj.$(O): output\outobj.c compiler.h insnsi.h nasm.h nasmlib.h &
268 outform.h regs.h stdscan.h version.h
269 output\outrdf.$(O): output\outrdf.c compiler.h insnsi.h nasm.h nasmlib.h &
270 outform.h regs.h version.h
271 output\outrdf2.$(O): output\outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h &
272 outform.h rdoff\rdoff.h regs.h saa.h version.h
273 parser.$(O): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h &
274 parser.h regs.h stdscan.h tables.h tokens.h version.h
275 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
276 preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h &
277 pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h version.h
278 quote.$(O): quote.c compiler.h nasmlib.h quote.h
279 raa.$(O): raa.c compiler.h nasmlib.h raa.h
280 regdis.$(O): regdis.c regdis.h regs.h
281 regflags.$(O): regflags.c compiler.h insnsi.h nasm.h nasmlib.h regs.h &
283 regs.$(O): regs.c compiler.h insnsi.h tables.h
284 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
285 saa.$(O): saa.c compiler.h nasmlib.h saa.h
286 stdscan.$(O): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h quote.h &
287 regs.h stdscan.h tokens.h version.h
288 strfunc.$(O): strfunc.c compiler.h insnsi.h nasm.h nasmlib.h regs.h &
290 sync.$(O): sync.c compiler.h nasmlib.h sync.h
291 tokhash.$(O): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h &
292 nasmlib.h regs.h tokens.h version.h