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 licence given in the file "Licence"
7 # distributed in the NASM archive.
9 top_srcdir
= @top_srcdir@
13 exec_prefix = @
exec_prefix@
19 BUILD_CFLAGS
= $(CFLAGS
) @DEFS@
20 INTERNAL_CFLAGS
= -I
$(srcdir) -I.
21 ALL_CFLAGS
= $(BUILD_CFLAGS
) $(INTERNAL_CFLAGS
)
24 PERL
= perl
-I
$(srcdir)/perllib
29 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
30 INSTALL_DATA
= @INSTALL_DATA@
43 .SUFFIXES
: .c .i .s .
$(O
) .1 .man
45 .PHONY
: all doc rdf
install clean distclean cleaner spotless install_rdf
46 .PHONY
: install_doc everything install_everything
strip perlreq
dist
49 $(CC
) -c
$(ALL_CFLAGS
) -o
$@
$<
52 $(CC
) -S
$(ALL_CFLAGS
) -o
$@
$<
55 $(CC
) -E
$(ALL_CFLAGS
) -o
$@
$<
60 NASM
= nasm.
$(O
) nasmlib.
$(O
) float.
$(O
) insnsa.
$(O
) assemble.
$(O
) \
61 labels.
$(O
) hashtbl.
$(O
) crc64.
$(O
) parser.
$(O
) \
62 outform.
$(O
) output
/outbin.
$(O
) \
63 output
/outaout.
$(O
) output
/outcoff.
$(O
) \
64 output
/outelf32.
$(O
) output
/outelf64.
$(O
) \
65 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
66 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho.
$(O
) \
67 preproc.
$(O
) pptok.
$(O
) \
68 listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) tokhash.
$(O
)
70 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) insnsd.
$(O
)
72 all: nasm
$(X
) ndisasm
$(X
) nasm.man ndisasm.man
73 cd rdoff
&& $(MAKE
) all
75 nasm
$(X
): $(NASM
) $(XOBJS
)
76 $(CC
) $(LDFLAGS
) -o nasm
$(X
) $(NASM
) $(XOBJS
) $(LIBS
)
78 ndisasm
$(X
): $(NDISASM
) $(XOBJS
)
79 $(CC
) $(LDFLAGS
) -o ndisasm
$(X
) $(NDISASM
) $(XOBJS
) $(LIBS
)
81 # These source files are automagically generated from a single
82 # instruction-table file by a Perl script. They're distributed,
83 # though, so it isn't necessary to have Perl just to recompile NASM
84 # from the distribution.
86 insnsa.c
: insns.dat insns.pl
87 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
88 insnsd.c
: insns.dat insns.pl
89 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
90 insnsi.h
: insns.dat insns.pl
91 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
92 insnsn.c
: insns.dat insns.pl
93 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
95 # These files contains all the standard macros that are derived from
97 version.h
: version version.pl
98 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
100 version.mac
: version version.pl
101 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
103 version.sed
: version version.pl
104 $(PERL
) $(srcdir)/version.pl sed
< $(srcdir)/version
> version.sed
106 # This source file is generated from the standard macros file
107 # `standard.mac' by another Perl script. Again, it's part of the
108 # standard distribution.
110 macros.c
: macros.pl standard.mac version.mac
111 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
113 # These source files are generated from regs.dat by yet another
115 regs.c
: regs.dat regs.pl
116 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
117 regflags.c
: regs.dat regs.pl
118 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
119 regdis.c
: regs.dat regs.pl
120 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
121 regvals.c
: regs.dat regs.pl
122 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
123 regs.h
: regs.dat regs.pl
124 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
126 # Assembler token hash
127 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
128 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
129 $(srcdir)/tokens.dat
> tokhash.c
131 # Assembler token metadata
132 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
133 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
134 $(srcdir)/tokens.dat
> tokens.h
136 # Preprocessor token hash
137 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
138 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
139 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
140 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
142 # This target generates all files that require perl.
143 # This allows easier generation of distribution (see dist target).
144 PERLREQ
= macros.c insnsa.c insnsd.c insnsi.h insnsn.c \
145 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
146 version.h version.mac pptok.h pptok.c
149 install: nasm
$(X
) ndisasm
$(X
)
150 $(MKDIR
) -p
$(INSTALLROOT
)$(bindir)
151 $(INSTALL_PROGRAM
) nasm
$(X
) $(INSTALLROOT
)$(bindir)/nasm
$(X
)
152 $(INSTALL_PROGRAM
) ndisasm
$(X
) $(INSTALLROOT
)$(bindir)/ndisasm
$(X
)
153 $(MKDIR
) -p
$(INSTALLROOT
)$(mandir)/man1
154 $(INSTALL_DATA
) $(srcdir)/nasm
.1 $(INSTALLROOT
)$(mandir)/man1
/nasm
.1
155 $(INSTALL_DATA
) $(srcdir)/ndisasm
.1 $(INSTALLROOT
)$(mandir)/man1
/ndisasm
.1
158 $(RM
) -f
*.
$(O
) *.s
*.i
159 $(RM
) -f output
/*.
$(O
) output
/*.s output
/*.i
160 $(RM
) -f nasm
$(X
) ndisasm
$(X
)
161 cd rdoff
&& $(MAKE
) clean
164 $(RM
) -f config.h config.log config.status
165 $(RM
) -f Makefile
*~
*.bak
*.lst
*.bin
166 $(RM
) -f output
/*~ output
/*.bak
167 $(RM
) -f
test/*.lst
test/*.bin
test/*.
$(O
) test/*.bin
168 $(RM
) -rf autom4te
*.cache
169 cd rdoff
&& $(MAKE
) distclean
172 $(RM
) -f
$(PERLREQ
) *.man nasm.spec
173 cd doc
&& $(MAKE
) clean
175 spotless
: distclean cleaner
176 $(RM
) -f doc
/Makefile doc
/*~ doc
/*.bak
179 $(STRIP
) --strip-unneeded nasm
$(X
) ndisasm
$(X
)
184 rdf_install install_rdf
:
185 cd rdoff
&& $(MAKE
) install
188 cd doc
&& $(MAKE
) all
190 doc_install install_doc
:
191 cd doc
&& $(MAKE
) install
193 everything
: all doc rdf
195 install_everything
: everything
install install_doc install_rdf
197 dist: spotless perlreq spec
200 $(RM
) -rf .
/autom4te
*.cache
203 tar -cvj
--exclude CVS
-C ..
-f ..
/nasm-
`cat version`-`date +%Y%m%d`.
tar.bz2
`basename \`pwd\
``
207 nasm.spec
: nasm.spec.in version.sed
208 sed
-f version.sed
< nasm.spec.in
> nasm.spec
214 # This build dependencies in *ALL* makefiles. Partially for that reason,
215 # it's expected to be invoked manually.
218 $(PERL
) mkdep.pl
-M Makefile.in Mkfiles
/*.mak
-- \
222 #-- Magic hints to mkdep.pl --#
223 # @object-ending: ".$(O)"
224 # @path-separator: "/"
225 #-- Everything below is generated by mkdep.pl - do not edit --#
226 assemble.
$(O
): assemble.c assemble.h compiler.h config.h insns.h insnsi.h \
227 nasm.h nasmlib.h pptok.h preproc.h regflags.c regs.h regvals.c tokens.h \
229 crc64.
$(O
): crc64.c compiler.h config.h
230 disasm.
$(O
): disasm.c compiler.h config.h disasm.h insns.h insnsi.h insnsn.c \
231 names.c nasm.h nasmlib.h regdis.c regs.c regs.h sync.h tokens.h version.h
232 eval.
$(O
): eval.c compiler.h config.h eval.h float.h insnsi.h labels.h \
233 nasm.h nasmlib.h regs.h version.h
234 exprlib.
$(O
): exprlib.c compiler.h config.h insnsi.h nasm.h nasmlib.h regs.h \
236 float.
$(O
): float.c compiler.h config.h insnsi.h nasm.h nasmlib.h regs.h \
238 hashtbl.
$(O
): hashtbl.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
239 nasmlib.h regs.h version.h
240 insnsa.
$(O
): insnsa.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
241 regs.h tokens.h version.h
242 insnsd.
$(O
): insnsd.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
243 regs.h tokens.h version.h
244 insnsn.
$(O
): insnsn.c
245 labels.
$(O
): labels.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
246 nasmlib.h regs.h version.h
247 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h config.h nasmlib.h
248 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h config.h nasmlib.h
249 listing.
$(O
): listing.c compiler.h config.h insnsi.h listing.h nasm.h \
250 nasmlib.h regs.h version.h
251 macros.
$(O
): macros.c compiler.h config.h
252 names.
$(O
): names.c compiler.h config.h insnsn.c regs.c
253 nasm.
$(O
): nasm.c assemble.h compiler.h config.h eval.h insns.h insnsi.h \
254 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
255 regs.h stdscan.h tokens.h version.h
256 nasmlib.
$(O
): nasmlib.c compiler.h config.h insns.h insnsi.h nasm.h \
257 nasmlib.h regs.h tokens.h version.h
258 ndisasm.
$(O
): ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
259 nasmlib.h regs.h sync.h tokens.h version.h
260 outform.
$(O
): outform.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
261 outform.h regs.h version.h
262 output
/outaout.
$(O
): output
/outaout.c compiler.h config.h insnsi.h nasm.h \
263 nasmlib.h outform.h regs.h stdscan.h version.h
264 output
/outas86.
$(O
): output
/outas86.c compiler.h config.h insnsi.h nasm.h \
265 nasmlib.h outform.h regs.h version.h
266 output
/outbin.
$(O
): output
/outbin.c compiler.h config.h eval.h insnsi.h \
267 labels.h nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
268 output
/outcoff.
$(O
): output
/outcoff.c compiler.h config.h insnsi.h nasm.h \
269 nasmlib.h outform.h regs.h version.h
270 output
/outdbg.
$(O
): output
/outdbg.c compiler.h config.h insnsi.h nasm.h \
271 nasmlib.h outform.h regs.h version.h
272 output
/outelf32.
$(O
): output
/outelf32.c compiler.h config.h insnsi.h nasm.h \
273 nasmlib.h outform.h regs.h stdscan.h version.h
274 output
/outelf64.
$(O
): output
/outelf64.c compiler.h config.h insnsi.h nasm.h \
275 nasmlib.h outform.h regs.h stdscan.h version.h
276 output
/outieee.
$(O
): output
/outieee.c compiler.h config.h insnsi.h nasm.h \
277 nasmlib.h outform.h regs.h version.h
278 output
/outmacho.
$(O
): output
/outmacho.c compiler.h config.h insnsi.h nasm.h \
279 nasmlib.h outform.h regs.h version.h
280 output
/outobj.
$(O
): output
/outobj.c compiler.h config.h insnsi.h nasm.h \
281 nasmlib.h outform.h regs.h stdscan.h version.h
282 output
/outrdf.
$(O
): output
/outrdf.c compiler.h config.h insnsi.h nasm.h \
283 nasmlib.h outform.h regs.h version.h
284 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h config.h insnsi.h nasm.h \
285 nasmlib.h outform.h rdoff
/rdoff.h regs.h version.h
286 parser.
$(O
): parser.c compiler.h config.h float.h insns.h insnsi.h nasm.h \
287 nasmlib.h parser.h regflags.c regs.h stdscan.h tokens.h version.h
288 pptok.
$(O
): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
290 preproc.
$(O
): preproc.c compiler.h config.h hashtbl.h insnsi.h macros.c \
291 nasm.h nasmlib.h pptok.h preproc.h regs.h version.h
292 regdis.
$(O
): regdis.c
293 regflags.
$(O
): regflags.c
294 regs.
$(O
): regs.c compiler.h config.h
295 regvals.
$(O
): regvals.c
296 stdscan.
$(O
): stdscan.c compiler.h config.h insns.h insnsi.h nasm.h \
297 nasmlib.h regs.h stdscan.h tokens.h version.h
298 sync.
$(O
): sync.c compiler.h config.h nasmlib.h sync.h
299 tokhash.
$(O
): tokhash.c compiler.h config.h hashtbl.h insns.h insnsi.h \
300 nasm.h nasmlib.h regs.h tokens.h version.h