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
) \
65 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) \
66 output
/outform.
$(O
) output
/outlib.
$(O
) output
/nulldbg.
$(O
) \
67 output
/outbin.
$(O
) output
/outaout.
$(O
) output
/outcoff.
$(O
) \
68 output
/outelf.
$(O
) output
/outelf32.
$(O
) output
/outelf64.
$(O
) \
69 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
70 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho32.
$(O
) \
71 output
/outmacho64.
$(O
) preproc.
$(O
) quote.
$(O
) pptok.
$(O
) \
72 macros.
$(O
) listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) \
73 strfunc.
$(O
) tokhash.
$(O
) regvals.
$(O
) regflags.
$(O
)
75 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) ver.
$(O
) \
76 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
77 #-- End File Lists --#
79 all: nasm
$(X
) ndisasm
$(X
) nasm.man ndisasm.man
80 cd rdoff
&& $(MAKE
) all
82 nasm
$(X
): $(NASM
) $(XOBJS
)
83 $(CC
) $(LDFLAGS
) -o nasm
$(X
) $(NASM
) $(XOBJS
) $(LIBS
)
85 ndisasm
$(X
): $(NDISASM
) $(XOBJS
)
86 $(CC
) $(LDFLAGS
) -o ndisasm
$(X
) $(NDISASM
) $(XOBJS
) $(LIBS
)
88 # These source files are automagically generated from a single
89 # instruction-table file by a Perl script. They're distributed,
90 # though, so it isn't necessary to have Perl just to recompile NASM
91 # from the distribution.
93 insnsb.c
: insns.dat insns.pl
94 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
95 insnsa.c
: insns.dat insns.pl
96 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
97 insnsd.c
: insns.dat insns.pl
98 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
99 insnsi.h
: insns.dat insns.pl
100 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
101 insnsn.c
: insns.dat insns.pl
102 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
104 # These files contains all the standard macros that are derived from
105 # the version number.
106 version.h
: version version.pl
107 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
108 version.mac
: version version.pl
109 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
110 version.sed
: version version.pl
111 $(PERL
) $(srcdir)/version.pl sed
< $(srcdir)/version
> version.sed
112 version.mak
: version version.pl
113 $(PERL
) $(srcdir)/version.pl make
< $(srcdir)/version
> version.mak
114 version.nsh
: version version.pl
115 $(PERL
) $(srcdir)/version.pl nsis
< $(srcdir)/version
> version.nsh
117 # This source file is generated from the standard macros file
118 # `standard.mac' by another Perl script. Again, it's part of the
119 # standard distribution.
120 macros.c
: macros.pl pptok.ph standard.mac version.mac \
121 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
122 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac \
123 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
125 # These source files are generated from regs.dat by yet another
127 regs.c
: regs.dat regs.pl
128 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
129 regflags.c
: regs.dat regs.pl
130 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
131 regdis.c
: regs.dat regs.pl
132 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
133 regdis.h
: regs.dat regs.pl
134 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
135 regvals.c
: regs.dat regs.pl
136 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
137 regs.h
: regs.dat regs.pl
138 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
140 # Assembler token hash
141 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
142 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
143 $(srcdir)/tokens.dat
> tokhash.c
145 # Assembler token metadata
146 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
147 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
148 $(srcdir)/tokens.dat
> tokens.h
150 # Preprocessor token hash
151 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
152 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
153 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
154 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
155 pptok.ph
: pptok.dat pptok.pl perllib
/phash.ph
156 $(PERL
) $(srcdir)/pptok.pl ph
$(srcdir)/pptok.dat pptok.ph
158 # This target generates all files that require perl.
159 # This allows easier generation of distribution (see dist target).
160 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
161 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
162 tokhash.c tokens.h pptok.h pptok.c pptok.ph \
163 version.h version.mac version.mak version.nsh
166 install: nasm
$(X
) ndisasm
$(X
)
167 $(MKDIR
) -p
$(INSTALLROOT
)$(bindir)
168 $(INSTALL_PROGRAM
) nasm
$(X
) $(INSTALLROOT
)$(bindir)/nasm
$(X
)
169 $(INSTALL_PROGRAM
) ndisasm
$(X
) $(INSTALLROOT
)$(bindir)/ndisasm
$(X
)
170 $(MKDIR
) -p
$(INSTALLROOT
)$(mandir)/man1
171 $(INSTALL_DATA
) $(srcdir)/nasm
.1 $(INSTALLROOT
)$(mandir)/man1
/nasm
.1
172 $(INSTALL_DATA
) $(srcdir)/ndisasm
.1 $(INSTALLROOT
)$(mandir)/man1
/ndisasm
.1
175 $(RM
) -f
*.
$(O
) *.s
*.i
176 $(RM
) -f output
/*.
$(O
) output
/*.s output
/*.i
177 $(RM
) -f nasm
$(X
) ndisasm
$(X
)
178 cd rdoff
&& $(MAKE
) clean
181 $(RM
) -f config.h config.log config.status
182 $(RM
) -f Makefile
*~
*.bak
*.lst
*.bin
183 $(RM
) -f output
/*~ output
/*.bak
184 $(RM
) -f
test/*.lst
test/*.bin
test/*.
$(O
) test/*.bin
185 $(RM
) -rf autom4te
*.cache
186 cd rdoff
&& $(MAKE
) distclean
189 $(RM
) -f
$(PERLREQ
) *.man nasm.spec
190 cd doc
&& $(MAKE
) clean
192 spotless
: distclean cleaner
193 $(RM
) -f doc
/Makefile doc
/*~ doc
/*.bak
196 $(STRIP
) --strip-unneeded nasm
$(X
) ndisasm
$(X
)
201 rdf_install install_rdf
:
202 cd rdoff
&& $(MAKE
) install
205 cd doc
&& $(MAKE
) all
207 doc_install install_doc
:
208 cd doc
&& $(MAKE
) install
210 everything
: all doc rdf
212 install_everything
: everything
install install_doc install_rdf
214 dist: spotless perlreq spec
217 $(RM
) -rf .
/autom4te
*.cache
220 tar -cvj
--exclude CVS
-C ..
-f ..
/nasm-
`cat version`-`date +%Y%m%d`.
tar.bz2
`basename \`pwd\
``
224 nasm.spec
: nasm.spec.in version.sed
225 sed
-f version.sed
< nasm.spec.in
> nasm.spec
231 cd
test && $(PERL
) performtest.pl
--nasm
=..
/nasm
*.asm
234 # This build dependencies in *ALL* makefiles. Partially for that reason,
235 # it's expected to be invoked manually.
238 $(PERL
) syncfiles.pl Makefile.in Mkfiles
/*.mak
239 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles
/*.mak
-- \
243 #-- Magic hints to mkdep.pl --#
244 # @object-ending: ".$(O)"
245 # @path-separator: "/"
246 #-- Everything below is generated by mkdep.pl - do not edit --#
247 assemble.
$(O
): assemble.c assemble.h compiler.h config.h insns.h insnsi.h \
248 nasm.h nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h
249 crc64.
$(O
): crc64.c compiler.h config.h nasmlib.h
250 disasm.
$(O
): disasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
251 nasmlib.h pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
252 eval.
$(O
): eval.c compiler.h config.h eval.h float.h insnsi.h labels.h \
253 nasm.h nasmlib.h pptok.h preproc.h regs.h
254 exprlib.
$(O
): exprlib.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
255 pptok.h preproc.h regs.h
256 float.
$(O
): float.c compiler.h config.h float.h insnsi.h nasm.h nasmlib.h \
257 pptok.h preproc.h regs.h
258 hashtbl.
$(O
): hashtbl.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
259 nasmlib.h pptok.h preproc.h regs.h
260 insnsa.
$(O
): insnsa.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
261 pptok.h preproc.h regs.h tokens.h
262 insnsb.
$(O
): insnsb.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
263 pptok.h preproc.h regs.h tokens.h
264 insnsd.
$(O
): insnsd.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
265 pptok.h preproc.h regs.h tokens.h
266 insnsn.
$(O
): insnsn.c compiler.h config.h insnsi.h tables.h
267 labels.
$(O
): labels.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
268 nasmlib.h pptok.h preproc.h regs.h
269 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h config.h nasmlib.h
270 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h config.h nasmlib.h
271 listing.
$(O
): listing.c compiler.h config.h insnsi.h listing.h nasm.h \
272 nasmlib.h pptok.h preproc.h regs.h
273 macros.
$(O
): macros.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
274 nasmlib.h output
/outform.h pptok.h preproc.h regs.h tables.h
275 nasm.
$(O
): nasm.c assemble.h compiler.h config.h eval.h float.h insns.h \
276 insnsi.h labels.h listing.h nasm.h nasmlib.h output
/outform.h parser.h \
277 pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
278 nasmlib.
$(O
): nasmlib.c compiler.h config.h insns.h insnsi.h nasm.h \
279 nasmlib.h pptok.h preproc.h regs.h tokens.h
280 ndisasm.
$(O
): ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
281 nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
282 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h config.h insnsi.h nasm.h \
283 nasmlib.h pptok.h preproc.h regs.h
284 output
/outaout.
$(O
): output
/outaout.c compiler.h config.h insnsi.h nasm.h \
285 nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h regs.h \
287 output
/outas86.
$(O
): output
/outas86.c compiler.h config.h insnsi.h nasm.h \
288 nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h regs.h \
290 output
/outbin.
$(O
): output
/outbin.c compiler.h config.h eval.h insnsi.h \
291 labels.h nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h \
292 preproc.h regs.h saa.h stdscan.h
293 output
/outcoff.
$(O
): output
/outcoff.c compiler.h config.h insnsi.h nasm.h \
294 nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h regs.h \
296 output
/outdbg.
$(O
): output
/outdbg.c compiler.h config.h insnsi.h nasm.h \
297 nasmlib.h output
/outform.h pptok.h preproc.h regs.h
298 output
/outelf.
$(O
): output
/outelf.c compiler.h config.h insnsi.h nasm.h \
299 nasmlib.h output
/dwarf.h output
/elfcommon.h output
/outelf.h \
300 output
/outform.h pptok.h preproc.h regs.h
301 output
/outelf32.
$(O
): output
/outelf32.c compiler.h config.h insnsi.h nasm.h \
302 nasmlib.h output
/dwarf.h output
/elf32.h output
/elfcommon.h output
/outelf.h \
303 output
/outform.h output
/outlib.h pptok.h preproc.h raa.h rbtree.h regs.h \
305 output
/outelf64.
$(O
): output
/outelf64.c compiler.h config.h insnsi.h nasm.h \
306 nasmlib.h output
/dwarf.h output
/elf64.h output
/elfcommon.h output
/outelf.h \
307 output
/outform.h output
/outlib.h pptok.h preproc.h raa.h rbtree.h regs.h \
309 output
/outform.
$(O
): output
/outform.c compiler.h config.h insnsi.h nasm.h \
310 nasmlib.h output
/outform.h pptok.h preproc.h regs.h
311 output
/outieee.
$(O
): output
/outieee.c compiler.h config.h insnsi.h nasm.h \
312 nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h regs.h
313 output
/outlib.
$(O
): output
/outlib.c compiler.h config.h insnsi.h nasm.h \
314 nasmlib.h output
/outlib.h pptok.h preproc.h regs.h
315 output
/outmacho32.
$(O
): output
/outmacho32.c compiler.h config.h insnsi.h \
316 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
318 output
/outmacho64.
$(O
): output
/outmacho64.c compiler.h config.h insnsi.h \
319 nasm.h nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h raa.h \
321 output
/outobj.
$(O
): output
/outobj.c compiler.h config.h insnsi.h nasm.h \
322 nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h regs.h \
324 output
/outrdf.
$(O
): output
/outrdf.c compiler.h config.h insnsi.h nasm.h \
325 nasmlib.h output
/outform.h pptok.h preproc.h regs.h
326 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h config.h insnsi.h nasm.h \
327 nasmlib.h output
/outform.h output
/outlib.h pptok.h preproc.h rdoff
/rdoff.h \
329 owtest.
$(O
): owtest.c
330 parser.
$(O
): parser.c compiler.h config.h float.h insns.h insnsi.h nasm.h \
331 nasmlib.h parser.h pptok.h preproc.h regs.h stdscan.h tables.h tokens.h
332 pptok.
$(O
): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
334 preproc.
$(O
): preproc.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
335 nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h
336 quote.
$(O
): quote.c compiler.h config.h nasmlib.h quote.h
337 raa.
$(O
): raa.c compiler.h config.h nasmlib.h raa.h
338 rbtree.
$(O
): rbtree.c compiler.h config.h rbtree.h
339 regdis.
$(O
): regdis.c regdis.h regs.h
340 regflags.
$(O
): regflags.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
341 pptok.h preproc.h regs.h tables.h
342 regs.
$(O
): regs.c compiler.h config.h insnsi.h tables.h
343 regvals.
$(O
): regvals.c compiler.h config.h insnsi.h tables.h
344 saa.
$(O
): saa.c compiler.h config.h nasmlib.h saa.h
345 stdscan.
$(O
): stdscan.c compiler.h config.h insns.h insnsi.h nasm.h \
346 nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
347 strfunc.
$(O
): strfunc.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
348 pptok.h preproc.h regs.h
349 sync.
$(O
): sync.c compiler.h config.h nasmlib.h sync.h
350 tokhash.
$(O
): tokhash.c compiler.h config.h hashtbl.h insns.h insnsi.h \
351 nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
352 ver.
$(O
): ver.c compiler.h config.h insnsi.h nasm.h nasmlib.h pptok.h \
353 preproc.h regs.h version.h