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 NASM
= nasm.
$(O
) nasmlib.
$(O
) float.
$(O
) insnsa.
$(O
) insnsb.
$(O
) \
62 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) \
63 outform.
$(O
) output
/outbin.
$(O
) \
64 output
/outaout.
$(O
) output
/outcoff.
$(O
) \
65 output
/outelf32.
$(O
) output
/outelf64.
$(O
) \
66 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
67 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho.
$(O
) \
68 preproc.
$(O
) quote.
$(O
) pptok.
$(O
) macros.
$(O
) \
69 listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) tokhash.
$(O
) \
70 regvals.
$(O
) regflags.
$(O
)
72 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) \
73 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
)
75 all: nasm
$(X
) ndisasm
$(X
) nasm.man ndisasm.man
76 cd rdoff
&& $(MAKE
) all
78 nasm
$(X
): $(NASM
) $(XOBJS
)
79 $(CC
) $(LDFLAGS
) -o nasm
$(X
) $(NASM
) $(XOBJS
) $(LIBS
)
81 ndisasm
$(X
): $(NDISASM
) $(XOBJS
)
82 $(CC
) $(LDFLAGS
) -o ndisasm
$(X
) $(NDISASM
) $(XOBJS
) $(LIBS
)
84 # These source files are automagically generated from a single
85 # instruction-table file by a Perl script. They're distributed,
86 # though, so it isn't necessary to have Perl just to recompile NASM
87 # from the distribution.
89 insnsb.c
: insns.dat insns.pl
90 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
91 insnsa.c
: insns.dat insns.pl
92 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
93 insnsd.c
: insns.dat insns.pl
94 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
95 insnsi.h
: insns.dat insns.pl
96 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
97 insnsn.c
: insns.dat insns.pl
98 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
100 # These files contains all the standard macros that are derived from
101 # the version number.
102 version.h
: version version.pl
103 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
105 version.mac
: version version.pl
106 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
108 version.sed
: version version.pl
109 $(PERL
) $(srcdir)/version.pl sed
< $(srcdir)/version
> version.sed
111 # This source file is generated from the standard macros file
112 # `standard.mac' by another Perl script. Again, it's part of the
113 # standard distribution.
115 macros.c
: macros.pl standard.mac version.mac
116 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
118 # These source files are generated from regs.dat by yet another
120 regs.c
: regs.dat regs.pl
121 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
122 regflags.c
: regs.dat regs.pl
123 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
124 regdis.c
: regs.dat regs.pl
125 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
126 regdis.h
: regs.dat regs.pl
127 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
128 regvals.c
: regs.dat regs.pl
129 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
130 regs.h
: regs.dat regs.pl
131 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
133 # Assembler token hash
134 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
135 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
136 $(srcdir)/tokens.dat
> tokhash.c
138 # Assembler token metadata
139 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
140 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
141 $(srcdir)/tokens.dat
> tokens.h
143 # Preprocessor token hash
144 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
145 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
146 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
147 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
149 # This target generates all files that require perl.
150 # This allows easier generation of distribution (see dist target).
151 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
152 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
153 tokhash.c tokens.h pptok.h pptok.c \
154 version.h version.mac
157 install: nasm
$(X
) ndisasm
$(X
)
158 $(MKDIR
) -p
$(INSTALLROOT
)$(bindir)
159 $(INSTALL_PROGRAM
) nasm
$(X
) $(INSTALLROOT
)$(bindir)/nasm
$(X
)
160 $(INSTALL_PROGRAM
) ndisasm
$(X
) $(INSTALLROOT
)$(bindir)/ndisasm
$(X
)
161 $(MKDIR
) -p
$(INSTALLROOT
)$(mandir)/man1
162 $(INSTALL_DATA
) $(srcdir)/nasm
.1 $(INSTALLROOT
)$(mandir)/man1
/nasm
.1
163 $(INSTALL_DATA
) $(srcdir)/ndisasm
.1 $(INSTALLROOT
)$(mandir)/man1
/ndisasm
.1
166 $(RM
) -f
*.
$(O
) *.s
*.i
167 $(RM
) -f output
/*.
$(O
) output
/*.s output
/*.i
168 $(RM
) -f nasm
$(X
) ndisasm
$(X
)
169 cd rdoff
&& $(MAKE
) clean
172 $(RM
) -f config.h config.log config.status
173 $(RM
) -f Makefile
*~
*.bak
*.lst
*.bin
174 $(RM
) -f output
/*~ output
/*.bak
175 $(RM
) -f
test/*.lst
test/*.bin
test/*.
$(O
) test/*.bin
176 $(RM
) -rf autom4te
*.cache
177 cd rdoff
&& $(MAKE
) distclean
180 $(RM
) -f
$(PERLREQ
) *.man nasm.spec
181 cd doc
&& $(MAKE
) clean
183 spotless
: distclean cleaner
184 $(RM
) -f doc
/Makefile doc
/*~ doc
/*.bak
187 $(STRIP
) --strip-unneeded nasm
$(X
) ndisasm
$(X
)
192 rdf_install install_rdf
:
193 cd rdoff
&& $(MAKE
) install
196 cd doc
&& $(MAKE
) all
198 doc_install install_doc
:
199 cd doc
&& $(MAKE
) install
201 everything
: all doc rdf
203 install_everything
: everything
install install_doc install_rdf
205 dist: spotless perlreq spec
208 $(RM
) -rf .
/autom4te
*.cache
211 tar -cvj
--exclude CVS
-C ..
-f ..
/nasm-
`cat version`-`date +%Y%m%d`.
tar.bz2
`basename \`pwd\
``
215 nasm.spec
: nasm.spec.in version.sed
216 sed
-f version.sed
< nasm.spec.in
> nasm.spec
222 # This build dependencies in *ALL* makefiles. Partially for that reason,
223 # it's expected to be invoked manually.
226 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles
/*.mak
-- \
230 #-- Magic hints to mkdep.pl --#
231 # @object-ending: ".$(O)"
232 # @path-separator: "/"
233 #-- Everything below is generated by mkdep.pl - do not edit --#
234 assemble.
$(O
): assemble.c assemble.h compiler.h config.h insns.h insnsi.h \
235 nasm.h nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h version.h
236 crc64.
$(O
): crc64.c compiler.h config.h
237 disasm.
$(O
): disasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
238 nasmlib.h regdis.h regs.h sync.h tables.h tokens.h version.h
239 eval.
$(O
): eval.c compiler.h config.h eval.h float.h insnsi.h labels.h \
240 nasm.h nasmlib.h regs.h version.h
241 exprlib.
$(O
): exprlib.c compiler.h config.h insnsi.h nasm.h nasmlib.h regs.h \
243 float.
$(O
): float.c compiler.h config.h float.h insnsi.h nasm.h nasmlib.h \
245 hashtbl.
$(O
): hashtbl.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
246 nasmlib.h regs.h version.h
247 insnsa.
$(O
): insnsa.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
248 regs.h tokens.h version.h
249 insnsb.
$(O
): insnsb.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
250 regs.h tokens.h version.h
251 insnsd.
$(O
): insnsd.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
252 regs.h tokens.h version.h
253 insnsn.
$(O
): insnsn.c compiler.h config.h insnsi.h tables.h
254 labels.
$(O
): labels.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
255 nasmlib.h regs.h version.h
256 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h config.h nasmlib.h
257 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h config.h nasmlib.h
258 listing.
$(O
): listing.c compiler.h config.h insnsi.h listing.h nasm.h \
259 nasmlib.h regs.h version.h
260 macros.
$(O
): macros.c compiler.h config.h insnsi.h tables.h
261 nasm.
$(O
): nasm.c assemble.h compiler.h config.h eval.h float.h insns.h \
262 insnsi.h labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h \
263 preproc.h regs.h stdscan.h tokens.h version.h
264 nasmlib.
$(O
): nasmlib.c compiler.h config.h insns.h insnsi.h nasm.h \
265 nasmlib.h regs.h tokens.h version.h
266 ndisasm.
$(O
): ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
267 nasmlib.h regs.h sync.h tokens.h version.h
268 outform.
$(O
): outform.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
269 outform.h regs.h version.h
270 output
/outaout.
$(O
): output
/outaout.c compiler.h config.h insnsi.h nasm.h \
271 nasmlib.h outform.h regs.h stdscan.h version.h
272 output
/outas86.
$(O
): output
/outas86.c compiler.h config.h insnsi.h nasm.h \
273 nasmlib.h outform.h regs.h version.h
274 output
/outbin.
$(O
): output
/outbin.c compiler.h config.h eval.h insnsi.h \
275 labels.h nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
276 output
/outcoff.
$(O
): output
/outcoff.c compiler.h config.h insnsi.h nasm.h \
277 nasmlib.h outform.h regs.h version.h
278 output
/outdbg.
$(O
): output
/outdbg.c compiler.h config.h insnsi.h nasm.h \
279 nasmlib.h outform.h regs.h version.h
280 output
/outelf32.
$(O
): output
/outelf32.c compiler.h config.h insnsi.h nasm.h \
281 nasmlib.h outform.h regs.h stdscan.h version.h wsaa.h
282 output
/outelf64.
$(O
): output
/outelf64.c compiler.h config.h insnsi.h nasm.h \
283 nasmlib.h outform.h regs.h stdscan.h version.h wsaa.h
284 output
/outieee.
$(O
): output
/outieee.c compiler.h config.h insnsi.h nasm.h \
285 nasmlib.h outform.h regs.h version.h
286 output
/outmacho.
$(O
): output
/outmacho.c compiler.h config.h insnsi.h nasm.h \
287 nasmlib.h outform.h regs.h version.h
288 output
/outobj.
$(O
): output
/outobj.c compiler.h config.h insnsi.h nasm.h \
289 nasmlib.h outform.h regs.h stdscan.h version.h
290 output
/outrdf.
$(O
): output
/outrdf.c compiler.h config.h insnsi.h nasm.h \
291 nasmlib.h outform.h regs.h version.h
292 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h config.h insnsi.h nasm.h \
293 nasmlib.h outform.h rdoff
/rdoff.h regs.h version.h
294 parser.
$(O
): parser.c compiler.h config.h float.h insns.h insnsi.h nasm.h \
295 nasmlib.h parser.h regs.h stdscan.h tables.h tokens.h version.h
296 pptok.
$(O
): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
298 preproc.
$(O
): preproc.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
299 nasmlib.h pptok.h preproc.h regs.h stdscan.h tables.h tokens.h version.h
300 regdis.
$(O
): regdis.c regdis.h regs.h
301 regflags.
$(O
): regflags.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
302 regs.h tables.h version.h
303 regs.
$(O
): regs.c compiler.h config.h insnsi.h tables.h
304 regvals.
$(O
): regvals.c compiler.h config.h insnsi.h tables.h
305 stdscan.
$(O
): stdscan.c compiler.h config.h insns.h insnsi.h nasm.h \
306 nasmlib.h regs.h stdscan.h tokens.h version.h
307 sync.
$(O
): sync.c compiler.h config.h nasmlib.h sync.h
308 tokhash.
$(O
): tokhash.c compiler.h config.h hashtbl.h insns.h insnsi.h \
309 nasm.h nasmlib.h regs.h tokens.h version.h