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@
49 CFLAGS
+= -DNASM_TRACE
52 .SUFFIXES
: .c .i .s .
$(O
) .1 .txt .xml
54 .PHONY
: all doc rdf
install clean distclean cleaner spotless install_rdf
test
55 .PHONY
: install_doc everything install_everything
strip perlreq
dist tags TAGS
58 $(CC
) -c
$(ALL_CFLAGS
) -o
$@
$<
61 $(CC
) -S
$(ALL_CFLAGS
) -o
$@
$<
64 $(CC
) -E
$(ALL_CFLAGS
) -o
$@
$<
68 #-- Begin File Lists --#
69 NASM
= nasm.
$(O
) nasmlib.
$(O
) ver.
$(O
) \
70 raa.
$(O
) saa.
$(O
) rbtree.
$(O
) \
71 float.
$(O
) insnsa.
$(O
) insnsb.
$(O
) \
73 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) \
74 output
/outform.
$(O
) output
/outlib.
$(O
) output
/nulldbg.
$(O
) \
76 output
/outbin.
$(O
) output
/outaout.
$(O
) output
/outcoff.
$(O
) \
77 output
/outelf.
$(O
) output
/outelf32.
$(O
) output
/outelf64.
$(O
) \
78 output
/outelfx32.
$(O
) \
79 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
80 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmac32.
$(O
) \
81 output
/outmac64.
$(O
) preproc.
$(O
) quote.
$(O
) pptok.
$(O
) \
82 macros.
$(O
) listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) \
83 strfunc.
$(O
) tokhash.
$(O
) regvals.
$(O
) regflags.
$(O
) \
88 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) ver.
$(O
) \
89 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
90 #-- End File Lists --#
92 all: nasm
$(X
) ndisasm
$(X
) nasm
.1 ndisasm
.1 rdf
94 nasm
$(X
): $(NASM
) $(XOBJS
)
95 $(CC
) $(LDFLAGS
) -o nasm
$(X
) $(NASM
) $(XOBJS
) $(LIBS
)
97 ndisasm
$(X
): $(NDISASM
) $(XOBJS
)
98 $(CC
) $(LDFLAGS
) -o ndisasm
$(X
) $(NDISASM
) $(XOBJS
) $(LIBS
)
100 # These source files are automagically generated from a single
101 # instruction-table file by a Perl script. They're distributed,
102 # though, so it isn't necessary to have Perl just to recompile NASM
103 # from the distribution.
105 insnsb.c
: insns.dat insns.pl
106 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
107 insnsa.c
: insns.dat insns.pl
108 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
109 insnsd.c
: insns.dat insns.pl
110 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
111 insnsi.h
: insns.dat insns.pl
112 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
113 insnsn.c
: insns.dat insns.pl
114 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
116 # These files contains all the standard macros that are derived from
117 # the version number.
118 version.h
: version version.pl
119 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
120 version.mac
: version version.pl
121 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
122 version.sed
: version version.pl
123 $(PERL
) $(srcdir)/version.pl sed
< $(srcdir)/version
> version.sed
124 version.mak
: version version.pl
125 $(PERL
) $(srcdir)/version.pl make
< $(srcdir)/version
> version.mak
126 version.nsh
: version version.pl
127 $(PERL
) $(srcdir)/version.pl nsis
< $(srcdir)/version
> version.nsh
129 # This source file is generated from the standard macros file
130 # `standard.mac' by another Perl script. Again, it's part of the
131 # standard distribution.
132 macros.c
: macros.pl pptok.ph standard.mac version.mac \
133 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
134 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac \
135 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
137 # These source files are generated from regs.dat by yet another
139 regs.c
: regs.dat regs.pl
140 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
141 regflags.c
: regs.dat regs.pl
142 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
143 regdis.c
: regs.dat regs.pl
144 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
145 regdis.h
: regs.dat regs.pl
146 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
147 regvals.c
: regs.dat regs.pl
148 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
149 regs.h
: regs.dat regs.pl
150 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
152 # Assembler token hash
153 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
154 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
155 $(srcdir)/tokens.dat
> tokhash.c
157 # Assembler token metadata
158 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
159 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
160 $(srcdir)/tokens.dat
> tokens.h
162 # Preprocessor token hash
163 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
164 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
165 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
166 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
167 pptok.ph
: pptok.dat pptok.pl perllib
/phash.ph
168 $(PERL
) $(srcdir)/pptok.pl ph
$(srcdir)/pptok.dat pptok.ph
171 directiv.h
: directiv.dat directiv.pl perllib
/phash.ph
172 $(PERL
) $(srcdir)/directiv.pl h
$(srcdir)/directiv.dat directiv.h
173 directiv.c
: directiv.dat directiv.pl perllib
/phash.ph
174 $(PERL
) $(srcdir)/directiv.pl c
$(srcdir)/directiv.dat directiv.c
176 # This target generates all files that require perl.
177 # This allows easier generation of distribution (see dist target).
178 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
179 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
180 tokhash.c tokens.h pptok.h pptok.c pptok.ph \
181 directiv.c directiv.h \
182 version.h version.mac version.mak version.nsh
185 install: nasm
$(X
) ndisasm
$(X
)
186 $(MKDIR
) -p
$(INSTALLROOT
)$(bindir)
187 $(INSTALL_PROGRAM
) nasm
$(X
) $(INSTALLROOT
)$(bindir)/nasm
$(X
)
188 $(INSTALL_PROGRAM
) ndisasm
$(X
) $(INSTALLROOT
)$(bindir)/ndisasm
$(X
)
189 $(MKDIR
) -p
$(INSTALLROOT
)$(mandir)/man1
190 $(INSTALL_DATA
) $(srcdir)/nasm
.1 $(INSTALLROOT
)$(mandir)/man1
/nasm
.1
191 $(INSTALL_DATA
) $(srcdir)/ndisasm
.1 $(INSTALLROOT
)$(mandir)/man1
/ndisasm
.1
194 $(RM
) -f
*.
$(O
) *.s
*.i
195 $(RM
) -f lib
/*.
$(O
) lib
/*.s lib
/*.i
196 $(RM
) -f output
/*.
$(O
) output
/*.s output
/*.i
197 $(RM
) -f nasm
$(X
) ndisasm
$(X
)
199 cd rdoff
&& $(MAKE
) clean
202 $(RM
) -f config.h config.log config.status
203 $(RM
) -f Makefile
*~
*.bak
*.lst
*.bin
204 $(RM
) -f output
/*~ output
/*.bak
205 $(RM
) -f
test/*.lst
test/*.bin
test/*.
$(O
) test/*.bin
206 $(RM
) -rf autom4te
*.cache
207 cd rdoff
&& $(MAKE
) distclean
210 $(RM
) -f
$(PERLREQ
) *.1 nasm.spec
211 cd doc
&& $(MAKE
) clean
213 spotless
: distclean cleaner
214 $(RM
) -f doc
/Makefile doc
/*~ doc
/*.bak
217 $(STRIP
) --strip-unneeded nasm
$(X
) ndisasm
$(X
)
220 cd rdoff
&& $(MAKE
) all
224 $(FIND
) .
-name
'*.[hcS]' -print | xargs etags
-a
228 $(FIND
) .
-name
'*.[hcS]' -print | xargs ctags
-a
231 $(RM
) -f cscope.out cscope.files
232 $(FIND
) .
-name
'*.[hcS]' -print > cscope.files
233 cscope
-b
-f cscope.out
235 rdf_install install_rdf
:
236 cd rdoff
&& $(MAKE
) install
239 cd doc
&& $(MAKE
) all
241 doc_install install_doc
:
242 cd doc
&& $(MAKE
) install
244 everything
: all doc rdf
246 install_everything
: everything
install install_doc install_rdf
248 dist: spotless perlreq spec
251 $(RM
) -rf .
/autom4te
*.cache
254 tar -cvj
--exclude CVS
-C ..
-f ..
/nasm-
`cat version`-`date +%Y%m%d`.
tar.bz2
`basename \`pwd\
``
258 nasm.spec
: nasm.spec.in version.sed
259 sed
-f version.sed
< nasm.spec.in
> nasm.spec
265 cd
test && $(PERL
) performtest.pl
--nasm
=..
/nasm
*.asm
268 # This build dependencies in *ALL* makefiles. Partially for that reason,
269 # it's expected to be invoked manually.
272 $(PERL
) syncfiles.pl Makefile.in Mkfiles
/*.mak
273 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles
/*.mak
-- \
277 #-- Magic hints to mkdep.pl --#
278 # @object-ending: ".$(O)"
279 # @path-separator: "/"
280 #-- Everything below is generated by mkdep.pl - do not edit --#
281 assemble.
$(O
): assemble.c assemble.h compiler.h config.h directiv.h insns.h \
282 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
284 crc64.
$(O
): crc64.c compiler.h config.h nasmlib.h
285 directiv.
$(O
): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
286 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
287 disasm.
$(O
): disasm.c compiler.h config.h directiv.h disasm.h insns.h \
288 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h \
289 sync.h tables.h tokens.h
290 eval.
$(O
): eval.c compiler.h config.h directiv.h eval.h float.h insnsi.h \
291 labels.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
292 exprlib.
$(O
): exprlib.c compiler.h config.h directiv.h insnsi.h nasm.h \
293 nasmlib.h opflags.h pptok.h preproc.h regs.h
294 float.
$(O
): float.c compiler.h config.h directiv.h float.h insnsi.h nasm.h \
295 nasmlib.h opflags.h pptok.h preproc.h regs.h
296 hashtbl.
$(O
): hashtbl.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
297 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
298 ilog2.
$(O
): ilog2.c compiler.h config.h nasmlib.h
299 insnsa.
$(O
): insnsa.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
300 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
301 insnsb.
$(O
): insnsb.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
302 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
303 insnsd.
$(O
): insnsd.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
304 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
305 insnsn.
$(O
): insnsn.c compiler.h config.h insnsi.h opflags.h tables.h
306 labels.
$(O
): labels.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
307 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
308 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h config.h nasmlib.h
309 lib
/strlcpy.
$(O
): lib
/strlcpy.c compiler.h config.h
310 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h config.h nasmlib.h
311 listing.
$(O
): listing.c compiler.h config.h directiv.h insnsi.h listing.h \
312 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
313 macros.
$(O
): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
314 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h \
316 nasm.
$(O
): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
317 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
318 output
/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
320 nasmlib.
$(O
): nasmlib.c compiler.h config.h directiv.h insns.h insnsi.h \
321 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
322 ndisasm.
$(O
): ndisasm.c compiler.h config.h directiv.h disasm.h insns.h \
323 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
325 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h config.h directiv.h \
326 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
327 output
/nullout.
$(O
): output
/nullout.c compiler.h config.h directiv.h \
328 insnsi.h nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h \
330 output
/outaout.
$(O
): output
/outaout.c compiler.h config.h directiv.h eval.h \
331 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
332 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
333 output
/outas86.
$(O
): output
/outas86.c compiler.h config.h directiv.h \
334 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
335 pptok.h preproc.h raa.h regs.h saa.h
336 output
/outbin.
$(O
): output
/outbin.c compiler.h config.h directiv.h eval.h \
337 insnsi.h labels.h nasm.h nasmlib.h opflags.h output
/outform.h \
338 output
/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h
339 output
/outcoff.
$(O
): output
/outcoff.c compiler.h config.h directiv.h eval.h \
340 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
341 output
/pecoff.h pptok.h preproc.h raa.h regs.h saa.h
342 output
/outdbg.
$(O
): output
/outdbg.c compiler.h config.h directiv.h insnsi.h \
343 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h
344 output
/outelf.
$(O
): output
/outelf.c compiler.h config.h directiv.h insnsi.h \
345 nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h output
/outelf.h \
346 output
/outform.h pptok.h preproc.h regs.h
347 output
/outelf32.
$(O
): output
/outelf32.c compiler.h config.h directiv.h \
348 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
349 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
350 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
351 output
/outelf64.
$(O
): output
/outelf64.c compiler.h config.h directiv.h \
352 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
353 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
354 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
355 output
/outelfx32.
$(O
): output
/outelfx32.c compiler.h config.h directiv.h \
356 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
357 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
358 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
359 output
/outform.
$(O
): output
/outform.c compiler.h config.h directiv.h \
360 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h \
362 output
/outieee.
$(O
): output
/outieee.c compiler.h config.h directiv.h \
363 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
364 pptok.h preproc.h regs.h
365 output
/outlib.
$(O
): output
/outlib.c compiler.h config.h directiv.h insnsi.h \
366 nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h
367 output
/outmac32.
$(O
): output
/outmac32.c compiler.h config.h directiv.h \
368 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
369 pptok.h preproc.h raa.h regs.h saa.h
370 output
/outmac64.
$(O
): output
/outmac64.c compiler.h config.h directiv.h \
371 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
372 pptok.h preproc.h raa.h regs.h saa.h
373 output
/outobj.
$(O
): output
/outobj.c compiler.h config.h directiv.h eval.h \
374 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
375 pptok.h preproc.h regs.h stdscan.h
376 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h config.h directiv.h \
377 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
378 pptok.h preproc.h rdoff
/rdoff.h regs.h saa.h
379 parser.
$(O
): parser.c compiler.h config.h directiv.h eval.h float.h insns.h \
380 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h \
381 stdscan.h tables.h tokens.h
382 pptok.
$(O
): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
384 preproc-nop.
$(O
): preproc-nop.c compiler.h config.h directiv.h insnsi.h \
385 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
386 preproc.
$(O
): preproc.c compiler.h config.h directiv.h eval.h hashtbl.h \
387 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
388 stdscan.h tables.h tokens.h
389 quote.
$(O
): quote.c compiler.h config.h nasmlib.h quote.h
390 raa.
$(O
): raa.c compiler.h config.h nasmlib.h raa.h
391 rbtree.
$(O
): rbtree.c compiler.h config.h rbtree.h
392 regdis.
$(O
): regdis.c regdis.h regs.h
393 regflags.
$(O
): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h \
394 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
395 regs.
$(O
): regs.c compiler.h config.h insnsi.h opflags.h tables.h
396 regvals.
$(O
): regvals.c compiler.h config.h insnsi.h opflags.h tables.h
397 saa.
$(O
): saa.c compiler.h config.h nasmlib.h saa.h
398 stdscan.
$(O
): stdscan.c compiler.h config.h directiv.h insns.h insnsi.h \
399 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
401 strfunc.
$(O
): strfunc.c compiler.h config.h directiv.h insnsi.h nasm.h \
402 nasmlib.h opflags.h pptok.h preproc.h regs.h
403 sync.
$(O
): sync.c compiler.h config.h nasmlib.h sync.h
404 tokhash.
$(O
): tokhash.c compiler.h config.h directiv.h hashtbl.h insns.h \
405 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
406 ver.
$(O
): ver.c compiler.h config.h directiv.h insnsi.h nasm.h nasmlib.h \
407 opflags.h pptok.h preproc.h regs.h version.h