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