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