2 # Auto-configuring Makefile for the Netwide Assembler.
4 # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
5 # Julian Hall. All rights reserved. The software is
6 # redistributable under the license given in the file "LICENSE"
7 # distributed in the NASM archive.
9 top_srcdir = @top_srcdir@
13 exec_prefix = @exec_prefix@
16 datarootdir = @datarootdir@
20 BUILD_CFLAGS = $(CFLAGS) @DEFS@
21 INTERNAL_CFLAGS = -I$(srcdir) -I.
22 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
25 PERL = perl -I$(srcdir)/perllib
30 INSTALL_PROGRAM = @INSTALL_PROGRAM@
31 INSTALL_DATA = @INSTALL_DATA@
44 .SUFFIXES: .c .i .s .$(O) .1 .man
46 .PHONY: all doc rdf install clean distclean cleaner spotless install_rdf
47 .PHONY: install_doc everything install_everything strip perlreq dist
50 $(CC) -c $(ALL_CFLAGS) -o $@ $<
53 $(CC) -S $(ALL_CFLAGS) -o $@ $<
56 $(CC) -E $(ALL_CFLAGS) -o $@ $<
61 #-- Begin File Lists --#
62 NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \
63 raa.$(O) saa.$(O) rbtree.$(O) \
64 float.$(O) insnsa.$(O) insnsb.$(O) \
66 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
67 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
69 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
70 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
71 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
72 output/outdbg.$(O) output/outieee.$(O) output/outmacho32.$(O) \
73 output/outmacho64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
74 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
75 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O)
77 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
78 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
79 #-- End File Lists --#
81 all: nasm$(X) ndisasm$(X) nasm.man ndisasm.man
82 cd rdoff && $(MAKE) all
84 nasm$(X): $(NASM) $(XOBJS)
85 $(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(XOBJS) $(LIBS)
87 ndisasm$(X): $(NDISASM) $(XOBJS)
88 $(CC) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(XOBJS) $(LIBS)
90 # These source files are automagically generated from a single
91 # instruction-table file by a Perl script. They're distributed,
92 # though, so it isn't necessary to have Perl just to recompile NASM
93 # from the distribution.
95 insnsb.c: insns.dat insns.pl
96 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
97 insnsa.c: insns.dat insns.pl
98 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
99 insnsd.c: insns.dat insns.pl
100 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
101 insnsi.h: insns.dat insns.pl
102 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
103 insnsn.c: insns.dat insns.pl
104 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
106 # These files contains all the standard macros that are derived from
107 # the version number.
108 version.h: version version.pl
109 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
110 version.mac: version version.pl
111 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
112 version.sed: version version.pl
113 $(PERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed
114 version.mak: version version.pl
115 $(PERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak
116 version.nsh: version version.pl
117 $(PERL) $(srcdir)/version.pl nsis < $(srcdir)/version > version.nsh
119 # This source file is generated from the standard macros file
120 # `standard.mac' by another Perl script. Again, it's part of the
121 # standard distribution.
122 macros.c: macros.pl pptok.ph standard.mac version.mac \
123 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
124 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
125 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
127 # These source files are generated from regs.dat by yet another
129 regs.c: regs.dat regs.pl
130 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
131 regflags.c: regs.dat regs.pl
132 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
133 regdis.c: regs.dat regs.pl
134 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
135 regdis.h: regs.dat regs.pl
136 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
137 regvals.c: regs.dat regs.pl
138 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
139 regs.h: regs.dat regs.pl
140 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
142 # Assembler token hash
143 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
144 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
145 $(srcdir)/tokens.dat > tokhash.c
147 # Assembler token metadata
148 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
149 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
150 $(srcdir)/tokens.dat > tokens.h
152 # Preprocessor token hash
153 pptok.h: pptok.dat pptok.pl perllib/phash.ph
154 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
155 pptok.c: pptok.dat pptok.pl perllib/phash.ph
156 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
157 pptok.ph: pptok.dat pptok.pl perllib/phash.ph
158 $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
161 directives.h: directives.dat directives.pl perllib/phash.ph
162 $(PERL) $(srcdir)/directives.pl h $(srcdir)/directives.dat directives.h
163 directives.c: directives.dat directives.pl perllib/phash.ph
164 $(PERL) $(srcdir)/directives.pl c $(srcdir)/directives.dat directives.c
166 # This target generates all files that require perl.
167 # This allows easier generation of distribution (see dist target).
168 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
169 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
170 tokhash.c tokens.h pptok.h pptok.c pptok.ph \
171 directives.c directives.h \
172 version.h version.mac version.mak version.nsh
175 install: nasm$(X) ndisasm$(X)
176 $(MKDIR) -p $(INSTALLROOT)$(bindir)
177 $(INSTALL_PROGRAM) nasm$(X) $(INSTALLROOT)$(bindir)/nasm$(X)
178 $(INSTALL_PROGRAM) ndisasm$(X) $(INSTALLROOT)$(bindir)/ndisasm$(X)
179 $(MKDIR) -p $(INSTALLROOT)$(mandir)/man1
180 $(INSTALL_DATA) $(srcdir)/nasm.1 $(INSTALLROOT)$(mandir)/man1/nasm.1
181 $(INSTALL_DATA) $(srcdir)/ndisasm.1 $(INSTALLROOT)$(mandir)/man1/ndisasm.1
184 $(RM) -f *.$(O) *.s *.i
185 $(RM) -f output/*.$(O) output/*.s output/*.i
186 $(RM) -f nasm$(X) ndisasm$(X)
187 cd rdoff && $(MAKE) clean
190 $(RM) -f config.h config.log config.status
191 $(RM) -f Makefile *~ *.bak *.lst *.bin
192 $(RM) -f output/*~ output/*.bak
193 $(RM) -f test/*.lst test/*.bin test/*.$(O) test/*.bin
194 $(RM) -rf autom4te*.cache
195 cd rdoff && $(MAKE) distclean
198 $(RM) -f $(PERLREQ) *.man nasm.spec
199 cd doc && $(MAKE) clean
201 spotless: distclean cleaner
202 $(RM) -f doc/Makefile doc/*~ doc/*.bak
205 $(STRIP) --strip-unneeded nasm$(X) ndisasm$(X)
210 rdf_install install_rdf:
211 cd rdoff && $(MAKE) install
214 cd doc && $(MAKE) all
216 doc_install install_doc:
217 cd doc && $(MAKE) install
219 everything: all doc rdf
221 install_everything: everything install install_doc install_rdf
223 dist: spotless perlreq spec
226 $(RM) -rf ./autom4te*.cache
229 tar -cvj --exclude CVS -C .. -f ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 `basename \`pwd\``
233 nasm.spec: nasm.spec.in version.sed
234 sed -f version.sed < nasm.spec.in > nasm.spec
240 cd test && $(PERL) performtest.pl --nasm=../nasm *.asm
243 # This build dependencies in *ALL* makefiles. Partially for that reason,
244 # it's expected to be invoked manually.
247 $(PERL) syncfiles.pl Makefile.in Mkfiles/*.mak
248 $(PERL) mkdep.pl -M Makefile.in Mkfiles/*.mak -- \
252 #-- Magic hints to mkdep.pl --#
253 # @object-ending: ".$(O)"
254 # @path-separator: "/"
255 #-- Everything below is generated by mkdep.pl - do not edit --#
256 assemble.$(O): assemble.c assemble.h compiler.h config.h directives.h \
257 insns.h insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h tables.h \
259 crc64.$(O): crc64.c compiler.h config.h nasmlib.h
260 directives.$(O): directives.c compiler.h config.h directives.h hashtbl.h \
261 insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h
262 disasm.$(O): disasm.c compiler.h config.h directives.h disasm.h insns.h \
263 insnsi.h nasm.h nasmlib.h pptok.h preproc.h regdis.h regs.h sync.h tables.h \
265 eval.$(O): eval.c compiler.h config.h directives.h eval.h float.h insnsi.h \
266 labels.h nasm.h nasmlib.h pptok.h preproc.h regs.h
267 exprlib.$(O): exprlib.c compiler.h config.h directives.h insnsi.h nasm.h \
268 nasmlib.h pptok.h preproc.h regs.h
269 float.$(O): float.c compiler.h config.h directives.h float.h insnsi.h nasm.h \
270 nasmlib.h pptok.h preproc.h regs.h
271 hashtbl.$(O): hashtbl.c compiler.h config.h directives.h hashtbl.h insnsi.h \
272 nasm.h nasmlib.h pptok.h preproc.h regs.h
273 insnsa.$(O): insnsa.c compiler.h config.h directives.h insns.h insnsi.h \
274 nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
275 insnsb.$(O): insnsb.c compiler.h config.h directives.h insns.h insnsi.h \
276 nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
277 insnsd.$(O): insnsd.c compiler.h config.h directives.h insns.h insnsi.h \
278 nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
279 insnsn.$(O): insnsn.c compiler.h config.h insnsi.h tables.h
280 labels.$(O): labels.c compiler.h config.h directives.h hashtbl.h insnsi.h \
281 nasm.h nasmlib.h pptok.h preproc.h regs.h
282 lib/snprintf.$(O): lib/snprintf.c compiler.h config.h nasmlib.h
283 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h config.h nasmlib.h
284 listing.$(O): listing.c compiler.h config.h directives.h insnsi.h listing.h \
285 nasm.h nasmlib.h pptok.h preproc.h regs.h
286 macros.$(O): macros.c compiler.h config.h directives.h hashtbl.h insnsi.h \
287 nasm.h nasmlib.h output/outform.h pptok.h preproc.h regs.h tables.h
288 nasm.$(O): nasm.c assemble.h compiler.h config.h directives.h eval.h float.h \
289 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h output/outform.h \
290 parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
291 nasmlib.$(O): nasmlib.c compiler.h config.h directives.h insns.h insnsi.h \
292 nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
293 ndisasm.$(O): ndisasm.c compiler.h config.h directives.h disasm.h insns.h \
294 insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
295 output/nulldbg.$(O): output/nulldbg.c compiler.h config.h directives.h \
296 insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h
297 output/nullout.$(O): output/nullout.c compiler.h config.h directives.h \
298 insnsi.h nasm.h nasmlib.h output/outlib.h pptok.h preproc.h regs.h
299 output/outaout.$(O): output/outaout.c compiler.h config.h directives.h \
300 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
301 preproc.h raa.h regs.h saa.h stdscan.h
302 output/outas86.$(O): output/outas86.c compiler.h config.h directives.h \
303 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
304 preproc.h raa.h regs.h saa.h
305 output/outbin.$(O): output/outbin.c compiler.h config.h directives.h eval.h \
306 insnsi.h labels.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
307 preproc.h regs.h saa.h stdscan.h
308 output/outcoff.$(O): output/outcoff.c compiler.h config.h directives.h \
309 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
310 preproc.h raa.h regs.h saa.h
311 output/outdbg.$(O): output/outdbg.c compiler.h config.h directives.h \
312 insnsi.h nasm.h nasmlib.h output/outform.h pptok.h preproc.h regs.h
313 output/outelf.$(O): output/outelf.c compiler.h config.h directives.h \
314 insnsi.h nasm.h nasmlib.h output/dwarf.h output/elfcommon.h output/outelf.h \
315 output/outform.h pptok.h preproc.h regs.h
316 output/outelf32.$(O): output/outelf32.c compiler.h config.h directives.h \
317 insnsi.h nasm.h nasmlib.h output/dwarf.h output/elf32.h output/elfcommon.h \
318 output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
319 rbtree.h regs.h saa.h stdscan.h
320 output/outelf64.$(O): output/outelf64.c compiler.h config.h directives.h \
321 insnsi.h nasm.h nasmlib.h output/dwarf.h output/elf64.h output/elfcommon.h \
322 output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
323 rbtree.h regs.h saa.h stdscan.h
324 output/outexe.$(O): output/outexe.c compiler.h config.h directives.h \
325 insnsi.h nasm.h nasmlib.h output/outform.h pptok.h preproc.h regs.h
326 output/outform.$(O): output/outform.c compiler.h config.h directives.h \
327 insnsi.h nasm.h nasmlib.h output/outform.h pptok.h preproc.h regs.h
328 output/outieee.$(O): output/outieee.c compiler.h config.h directives.h \
329 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
331 output/outlib.$(O): output/outlib.c compiler.h config.h directives.h \
332 insnsi.h nasm.h nasmlib.h output/outlib.h pptok.h preproc.h regs.h
333 output/outmacho32.$(O): output/outmacho32.c compiler.h config.h directives.h \
334 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
335 preproc.h raa.h regs.h saa.h
336 output/outmacho64.$(O): output/outmacho64.c compiler.h config.h directives.h \
337 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
338 preproc.h raa.h regs.h saa.h
339 output/outobj.$(O): output/outobj.c compiler.h config.h directives.h \
340 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
341 preproc.h regs.h stdscan.h
342 output/outrdf.$(O): output/outrdf.c compiler.h config.h directives.h \
343 insnsi.h nasm.h nasmlib.h output/outform.h pptok.h preproc.h regs.h
344 output/outrdf2.$(O): output/outrdf2.c compiler.h config.h directives.h \
345 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
346 preproc.h rdoff/rdoff.h regs.h saa.h
347 parser.$(O): parser.c compiler.h config.h directives.h float.h insns.h \
348 insnsi.h nasm.h nasmlib.h parser.h pptok.h preproc.h regs.h stdscan.h \
350 pptok.$(O): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
352 preproc.$(O): preproc.c compiler.h config.h directives.h hashtbl.h insnsi.h \
353 nasm.h nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h \
355 quote.$(O): quote.c compiler.h config.h nasmlib.h quote.h
356 raa.$(O): raa.c compiler.h config.h nasmlib.h raa.h
357 rbtree.$(O): rbtree.c compiler.h config.h rbtree.h
358 regdis.$(O): regdis.c regdis.h regs.h
359 regflags.$(O): regflags.c compiler.h config.h directives.h insnsi.h nasm.h \
360 nasmlib.h pptok.h preproc.h regs.h tables.h
361 regs.$(O): regs.c compiler.h config.h insnsi.h tables.h
362 regvals.$(O): regvals.c compiler.h config.h insnsi.h tables.h
363 saa.$(O): saa.c compiler.h config.h nasmlib.h saa.h
364 stdscan.$(O): stdscan.c compiler.h config.h directives.h insns.h insnsi.h \
365 nasm.h nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
366 strfunc.$(O): strfunc.c compiler.h config.h directives.h insnsi.h nasm.h \
367 nasmlib.h pptok.h preproc.h regs.h
368 sync.$(O): sync.c compiler.h config.h nasmlib.h sync.h
369 tokhash.$(O): tokhash.c compiler.h config.h directives.h hashtbl.h insns.h \
370 insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
371 ver.$(O): ver.c compiler.h config.h directives.h insnsi.h nasm.h nasmlib.h \
372 pptok.h preproc.h regs.h version.h