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