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
/outmac32.
$(O
) \
73 output
/outmac64.
$(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
) \
79 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) ver.
$(O
) \
80 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
81 #-- End File Lists --#
83 all: nasm
$(X
) ndisasm
$(X
) nasm.man ndisasm.man rdf
85 nasm
$(X
): $(NASM
) $(XOBJS
)
86 $(CC
) $(LDFLAGS
) -o nasm
$(X
) $(NASM
) $(XOBJS
) $(LIBS
)
88 ndisasm
$(X
): $(NDISASM
) $(XOBJS
)
89 $(CC
) $(LDFLAGS
) -o ndisasm
$(X
) $(NDISASM
) $(XOBJS
) $(LIBS
)
91 # These source files are automagically generated from a single
92 # instruction-table file by a Perl script. They're distributed,
93 # though, so it isn't necessary to have Perl just to recompile NASM
94 # from the distribution.
96 insnsb.c
: insns.dat insns.pl
97 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
98 insnsa.c
: insns.dat insns.pl
99 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
100 insnsd.c
: insns.dat insns.pl
101 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
102 insnsi.h
: insns.dat insns.pl
103 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
104 insnsn.c
: insns.dat insns.pl
105 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
107 # These files contains all the standard macros that are derived from
108 # the version number.
109 version.h
: version version.pl
110 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
111 version.mac
: version version.pl
112 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
113 version.sed
: version version.pl
114 $(PERL
) $(srcdir)/version.pl sed
< $(srcdir)/version
> version.sed
115 version.mak
: version version.pl
116 $(PERL
) $(srcdir)/version.pl make
< $(srcdir)/version
> version.mak
117 version.nsh
: version version.pl
118 $(PERL
) $(srcdir)/version.pl nsis
< $(srcdir)/version
> version.nsh
120 # This source file is generated from the standard macros file
121 # `standard.mac' by another Perl script. Again, it's part of the
122 # standard distribution.
123 macros.c
: macros.pl pptok.ph standard.mac version.mac \
124 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
125 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac \
126 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
128 # These source files are generated from regs.dat by yet another
130 regs.c
: regs.dat regs.pl
131 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
132 regflags.c
: regs.dat regs.pl
133 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
134 regdis.c
: regs.dat regs.pl
135 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
136 regdis.h
: regs.dat regs.pl
137 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
138 regvals.c
: regs.dat regs.pl
139 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
140 regs.h
: regs.dat regs.pl
141 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
143 # Assembler token hash
144 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
145 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
146 $(srcdir)/tokens.dat
> tokhash.c
148 # Assembler token metadata
149 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
150 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
151 $(srcdir)/tokens.dat
> tokens.h
153 # Preprocessor token hash
154 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
155 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
156 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
157 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
158 pptok.ph
: pptok.dat pptok.pl perllib
/phash.ph
159 $(PERL
) $(srcdir)/pptok.pl ph
$(srcdir)/pptok.dat pptok.ph
162 directiv.h
: directiv.dat directiv.pl perllib
/phash.ph
163 $(PERL
) $(srcdir)/directiv.pl h
$(srcdir)/directiv.dat directiv.h
164 directiv.c
: directiv.dat directiv.pl perllib
/phash.ph
165 $(PERL
) $(srcdir)/directiv.pl c
$(srcdir)/directiv.dat directiv.c
167 # This target generates all files that require perl.
168 # This allows easier generation of distribution (see dist target).
169 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
170 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
171 tokhash.c tokens.h pptok.h pptok.c pptok.ph \
172 directiv.c directiv.h \
173 version.h version.mac version.mak version.nsh
176 install: nasm
$(X
) ndisasm
$(X
)
177 $(MKDIR
) -p
$(INSTALLROOT
)$(bindir)
178 $(INSTALL_PROGRAM
) nasm
$(X
) $(INSTALLROOT
)$(bindir)/nasm
$(X
)
179 $(INSTALL_PROGRAM
) ndisasm
$(X
) $(INSTALLROOT
)$(bindir)/ndisasm
$(X
)
180 $(MKDIR
) -p
$(INSTALLROOT
)$(mandir)/man1
181 $(INSTALL_DATA
) $(srcdir)/nasm
.1 $(INSTALLROOT
)$(mandir)/man1
/nasm
.1
182 $(INSTALL_DATA
) $(srcdir)/ndisasm
.1 $(INSTALLROOT
)$(mandir)/man1
/ndisasm
.1
185 $(RM
) -f
*.
$(O
) *.s
*.i
186 $(RM
) -f lib
/*.
$(O
) lib
/*.s lib
/*.i
187 $(RM
) -f output
/*.
$(O
) output
/*.s output
/*.i
188 $(RM
) -f nasm
$(X
) ndisasm
$(X
)
189 cd rdoff
&& $(MAKE
) clean
192 $(RM
) -f config.h config.log config.status
193 $(RM
) -f Makefile
*~
*.bak
*.lst
*.bin
194 $(RM
) -f output
/*~ output
/*.bak
195 $(RM
) -f
test/*.lst
test/*.bin
test/*.
$(O
) test/*.bin
196 $(RM
) -rf autom4te
*.cache
197 cd rdoff
&& $(MAKE
) distclean
200 $(RM
) -f
$(PERLREQ
) *.man nasm.spec
201 cd doc
&& $(MAKE
) clean
203 spotless
: distclean cleaner
204 $(RM
) -f doc
/Makefile doc
/*~ doc
/*.bak
207 $(STRIP
) --strip-unneeded nasm
$(X
) ndisasm
$(X
)
210 cd rdoff
&& $(MAKE
) all
212 rdf_install install_rdf
:
213 cd rdoff
&& $(MAKE
) install
216 cd doc
&& $(MAKE
) all
218 doc_install install_doc
:
219 cd doc
&& $(MAKE
) install
221 everything
: all doc rdf
223 install_everything
: everything
install install_doc install_rdf
225 dist: spotless perlreq spec
228 $(RM
) -rf .
/autom4te
*.cache
231 tar -cvj
--exclude CVS
-C ..
-f ..
/nasm-
`cat version`-`date +%Y%m%d`.
tar.bz2
`basename \`pwd\
``
235 nasm.spec
: nasm.spec.in version.sed
236 sed
-f version.sed
< nasm.spec.in
> nasm.spec
242 cd
test && $(PERL
) performtest.pl
--nasm
=..
/nasm
*.asm
245 # This build dependencies in *ALL* makefiles. Partially for that reason,
246 # it's expected to be invoked manually.
249 $(PERL
) syncfiles.pl Makefile.in Mkfiles
/*.mak
250 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles
/*.mak
-- \
254 #-- Magic hints to mkdep.pl --#
255 # @object-ending: ".$(O)"
256 # @path-separator: "/"
257 #-- Everything below is generated by mkdep.pl - do not edit --#
258 assemble.
$(O
): assemble.c assemble.h compiler.h config.h directiv.h insns.h \
259 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
261 crc64.
$(O
): crc64.c compiler.h config.h nasmlib.h
262 directiv.
$(O
): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
263 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
264 disasm.
$(O
): disasm.c compiler.h config.h directiv.h disasm.h insns.h \
265 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h \
266 sync.h tables.h tokens.h
267 eval.
$(O
): eval.c compiler.h config.h directiv.h eval.h float.h insnsi.h \
268 labels.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
269 exprlib.
$(O
): exprlib.c compiler.h config.h directiv.h insnsi.h nasm.h \
270 nasmlib.h opflags.h pptok.h preproc.h regs.h
271 float.
$(O
): float.c compiler.h config.h directiv.h float.h insnsi.h nasm.h \
272 nasmlib.h opflags.h pptok.h preproc.h regs.h
273 hashtbl.
$(O
): hashtbl.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 ilog2.
$(O
): ilog2.c compiler.h config.h nasmlib.h
276 insnsa.
$(O
): insnsa.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
277 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
278 insnsb.
$(O
): insnsb.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
279 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
280 insnsd.
$(O
): insnsd.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
281 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
282 insnsn.
$(O
): insnsn.c compiler.h config.h insnsi.h opflags.h tables.h
283 labels.
$(O
): labels.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
284 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
285 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h config.h nasmlib.h
286 lib
/strlcpy.
$(O
): lib
/strlcpy.c compiler.h config.h
287 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h config.h nasmlib.h
288 listing.
$(O
): listing.c compiler.h config.h directiv.h insnsi.h listing.h \
289 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
290 macros.
$(O
): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
291 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h \
293 nasm.
$(O
): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
294 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
295 output
/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
297 nasmlib.
$(O
): nasmlib.c compiler.h config.h directiv.h insns.h insnsi.h \
298 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
299 ndisasm.
$(O
): ndisasm.c compiler.h config.h directiv.h disasm.h insns.h \
300 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
302 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h config.h directiv.h \
303 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
304 output
/nullout.
$(O
): output
/nullout.c compiler.h config.h directiv.h \
305 insnsi.h nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h \
307 output
/outaout.
$(O
): output
/outaout.c compiler.h config.h directiv.h eval.h \
308 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
309 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
310 output
/outas86.
$(O
): output
/outas86.c compiler.h config.h directiv.h \
311 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
312 pptok.h preproc.h raa.h regs.h saa.h
313 output
/outbin.
$(O
): output
/outbin.c compiler.h config.h directiv.h eval.h \
314 insnsi.h labels.h nasm.h nasmlib.h opflags.h output
/outform.h \
315 output
/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h
316 output
/outcoff.
$(O
): output
/outcoff.c compiler.h config.h directiv.h eval.h \
317 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
318 output
/pecoff.h pptok.h preproc.h raa.h regs.h saa.h
319 output
/outdbg.
$(O
): output
/outdbg.c compiler.h config.h directiv.h insnsi.h \
320 nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h
321 output
/outelf.
$(O
): output
/outelf.c compiler.h config.h directiv.h insnsi.h \
322 nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h output
/outelf.h \
323 output
/outform.h pptok.h preproc.h regs.h
324 output
/outelf32.
$(O
): output
/outelf32.c compiler.h config.h directiv.h \
325 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
326 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
327 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
328 output
/outelf64.
$(O
): output
/outelf64.c compiler.h config.h directiv.h \
329 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
330 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
331 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
332 output
/outform.
$(O
): output
/outform.c compiler.h config.h directiv.h \
333 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h \
335 output
/outieee.
$(O
): output
/outieee.c compiler.h config.h directiv.h \
336 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
337 pptok.h preproc.h regs.h
338 output
/outlib.
$(O
): output
/outlib.c compiler.h config.h directiv.h insnsi.h \
339 nasm.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h
340 output
/outmac32.
$(O
): output
/outmac32.c compiler.h config.h directiv.h \
341 eval.h insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
342 pptok.h preproc.h raa.h regs.h saa.h
343 output
/outmac64.
$(O
): output
/outmac64.c compiler.h config.h directiv.h \
344 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
345 pptok.h preproc.h raa.h regs.h saa.h
346 output
/outobj.
$(O
): output
/outobj.c compiler.h config.h directiv.h eval.h \
347 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
348 pptok.h preproc.h regs.h stdscan.h
349 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h config.h directiv.h \
350 insnsi.h nasm.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
351 pptok.h preproc.h rdoff
/rdoff.h regs.h saa.h
352 parser.
$(O
): parser.c compiler.h config.h directiv.h eval.h float.h insns.h \
353 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h \
354 stdscan.h tables.h tokens.h
355 pptok.
$(O
): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
357 preproc.
$(O
): preproc.c compiler.h config.h directiv.h eval.h hashtbl.h \
358 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
359 stdscan.h tables.h tokens.h
360 quote.
$(O
): quote.c compiler.h config.h nasmlib.h quote.h
361 raa.
$(O
): raa.c compiler.h config.h nasmlib.h raa.h
362 rbtree.
$(O
): rbtree.c compiler.h config.h rbtree.h
363 regdis.
$(O
): regdis.c regdis.h regs.h
364 regflags.
$(O
): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h \
365 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
366 regs.
$(O
): regs.c compiler.h config.h insnsi.h opflags.h tables.h
367 regvals.
$(O
): regvals.c compiler.h config.h insnsi.h opflags.h tables.h
368 saa.
$(O
): saa.c compiler.h config.h nasmlib.h saa.h
369 stdscan.
$(O
): stdscan.c compiler.h config.h directiv.h insns.h insnsi.h \
370 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
372 strfunc.
$(O
): strfunc.c compiler.h config.h directiv.h insnsi.h nasm.h \
373 nasmlib.h opflags.h pptok.h preproc.h regs.h
374 sync.
$(O
): sync.c compiler.h config.h nasmlib.h sync.h
375 tokhash.
$(O
): tokhash.c compiler.h config.h directiv.h hashtbl.h insns.h \
376 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
377 ver.
$(O
): ver.c compiler.h config.h directiv.h insnsi.h nasm.h nasmlib.h \
378 opflags.h pptok.h preproc.h regs.h version.h