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
223 rdf_install install_rdf
:
224 cd rdoff
&& $(MAKE
) install
227 cd doc
&& $(MAKE
) all
229 doc_install install_doc
:
230 cd doc
&& $(MAKE
) install
232 everything
: all doc rdf
234 install_everything
: everything
install install_doc install_rdf
236 dist: spotless perlreq spec
239 $(RM
) -rf .
/autom4te
*.cache
242 tar -cvj
--exclude CVS
-C ..
-f ..
/nasm-
`cat version`-`date +%Y%m%d`.
tar.bz2
`basename \`pwd\
``
246 nasm.spec
: nasm.spec.in version.sed
247 sed
-f version.sed
< nasm.spec.in
> nasm.spec
253 cd
test && $(PERL
) performtest.pl
--nasm
=..
/nasm
*.asm
256 # This build dependencies in *ALL* makefiles. Partially for that reason,
257 # it's expected to be invoked manually.
260 $(PERL
) syncfiles.pl Makefile.in Mkfiles
/*.mak
261 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles
/*.mak
-- \
265 #-- Magic hints to mkdep.pl --#
266 # @object-ending: ".$(O)"
267 # @path-separator: "/"
268 #-- Everything below is generated by mkdep.pl - do not edit --#
269 assemble.
$(O
): assemble.c assemble.h compiler.h config.h directiv.h insns.h \
270 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
272 crc64.
$(O
): crc64.c compiler.h config.h nasmlib.h
273 directiv.
$(O
): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
274 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
275 disasm.
$(O
): disasm.c compiler.h config.h directiv.h disasm.h insns.h \
276 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h \
277 sync.h tables.h tokens.h
278 eval.
$(O
): eval.c compiler.h config.h directiv.h eval.h float.h insnsi.h \
279 labels.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
280 exprlib.
$(O
): exprlib.c compiler.h config.h directiv.h insnsi.h nasm.h \
281 nasmlib.h opflags.h pptok.h preproc.h regs.h
282 float.
$(O
): float.c compiler.h config.h directiv.h float.h insnsi.h nasm.h \
283 nasmlib.h opflags.h pptok.h preproc.h regs.h
284 hashtbl.
$(O
): hashtbl.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
285 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
286 ilog2.
$(O
): ilog2.c compiler.h config.h nasmlib.h
287 insnsa.
$(O
): insnsa.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
288 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
289 insnsb.
$(O
): insnsb.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
290 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
291 insnsd.
$(O
): insnsd.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
292 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
293 insnsn.
$(O
): insnsn.c compiler.h config.h insnsi.h opflags.h tables.h
294 labels.
$(O
): labels.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
295 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
296 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h config.h nasmlib.h
297 lib
/strlcpy.
$(O
): lib
/strlcpy.c compiler.h config.h
298 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h config.h nasmlib.h
299 listing.
$(O
): listing.c compiler.h config.h directiv.h insnsi.h listing.h \
300 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
301 macros.
$(O
): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
302 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h \
304 nasm.
$(O
): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
305 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
306 output
/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
308 nasmlib.
$(O
): nasmlib.c compiler.h config.h directiv.h insns.h insnsi.h \
309 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
310 ndisasm.
$(O
): ndisasm.c compiler.h config.h directiv.h disasm.h insns.h \
311 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
313 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h config.h directiv.h \
314 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
315 output
/nullout.
$(O
): output
/nullout.c compiler.h config.h directiv.h \
316 insnsi.h nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h \
318 output
/outaout.
$(O
): output
/outaout.c compiler.h config.h directiv.h eval.h \
319 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
320 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
321 output
/outas86.
$(O
): output
/outas86.c compiler.h config.h directiv.h \
322 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
323 pptok.h preproc.h raa.h regs.h saa.h
324 output
/outbin.
$(O
): output
/outbin.c compiler.h config.h directiv.h eval.h \
325 insnsi.h labels.h nasm.h nasmlib.h opflags.h output
/outform.h \
326 output
/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h
327 output
/outcoff.
$(O
): output
/outcoff.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 output
/pecoff.h pptok.h preproc.h raa.h regs.h saa.h
330 output
/outdbg.
$(O
): output
/outdbg.c compiler.h config.h directiv.h insnsi.h \
331 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h
332 output
/outelf.
$(O
): output
/outelf.c compiler.h config.h directiv.h insnsi.h \
333 nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h output
/outelf.h \
334 output
/outform.h pptok.h preproc.h regs.h
335 output
/outelf32.
$(O
): output
/outelf32.c compiler.h config.h directiv.h \
336 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
337 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
338 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
339 output
/outelf64.
$(O
): output
/outelf64.c compiler.h config.h directiv.h \
340 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
341 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
342 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
343 output
/outform.
$(O
): output
/outform.c compiler.h config.h directiv.h \
344 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h \
346 output
/outieee.
$(O
): output
/outieee.c compiler.h config.h directiv.h \
347 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
348 pptok.h preproc.h regs.h
349 output
/outlib.
$(O
): output
/outlib.c compiler.h config.h directiv.h insnsi.h \
350 nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h
351 output
/outmac32.
$(O
): output
/outmac32.c compiler.h config.h directiv.h \
352 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
353 pptok.h preproc.h raa.h regs.h saa.h
354 output
/outmac64.
$(O
): output
/outmac64.c compiler.h config.h directiv.h \
355 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
356 pptok.h preproc.h raa.h regs.h saa.h
357 output
/outobj.
$(O
): output
/outobj.c compiler.h config.h directiv.h eval.h \
358 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
359 pptok.h preproc.h regs.h stdscan.h
360 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h config.h directiv.h \
361 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
362 pptok.h preproc.h rdoff
/rdoff.h regs.h saa.h
363 parser.
$(O
): parser.c compiler.h config.h directiv.h eval.h float.h insns.h \
364 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h \
365 stdscan.h tables.h tokens.h
366 pptok.
$(O
): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
368 preproc.
$(O
): preproc.c compiler.h config.h directiv.h eval.h hashtbl.h \
369 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
370 stdscan.h tables.h tokens.h
371 quote.
$(O
): quote.c compiler.h config.h nasmlib.h quote.h
372 raa.
$(O
): raa.c compiler.h config.h nasmlib.h raa.h
373 rbtree.
$(O
): rbtree.c compiler.h config.h rbtree.h
374 regdis.
$(O
): regdis.c regdis.h regs.h
375 regflags.
$(O
): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h \
376 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
377 regs.
$(O
): regs.c compiler.h config.h insnsi.h opflags.h tables.h
378 regvals.
$(O
): regvals.c compiler.h config.h insnsi.h opflags.h tables.h
379 saa.
$(O
): saa.c compiler.h config.h nasmlib.h saa.h
380 stdscan.
$(O
): stdscan.c compiler.h config.h directiv.h insns.h insnsi.h \
381 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
383 strfunc.
$(O
): strfunc.c compiler.h config.h directiv.h insnsi.h nasm.h \
384 nasmlib.h opflags.h pptok.h preproc.h regs.h
385 sync.
$(O
): sync.c compiler.h config.h nasmlib.h sync.h
386 tokhash.
$(O
): tokhash.c compiler.h config.h directiv.h hashtbl.h insns.h \
387 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
388 ver.
$(O
): ver.c compiler.h config.h directiv.h insnsi.h nasm.h nasmlib.h \
389 opflags.h pptok.h preproc.h regs.h version.h