eval: Use is_power2 helper instead of open code
[nasm.git] / Makefile.in
blob983ff6dbf1ba6831159b163bd9ce4a366140a641
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@
10 srcdir = @srcdir@
11 VPATH = @srcdir@
12 prefix = @prefix@
13 exec_prefix = @exec_prefix@
14 bindir = @bindir@
15 mandir = @mandir@
16 datarootdir = @datarootdir@
18 CC = @CC@
19 CFLAGS = @CFLAGS@
20 BUILD_CFLAGS = $(CFLAGS) @DEFS@
21 INTERNAL_CFLAGS = -I$(srcdir) -I.
22 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
23 LDFLAGS = @LDFLAGS@
24 LIBS = @LIBS@
25 PERL = perl -I$(srcdir)/perllib
27 XOBJS = @XOBJS@
29 INSTALL = @INSTALL@
30 INSTALL_PROGRAM = @INSTALL_PROGRAM@
31 INSTALL_DATA = @INSTALL_DATA@
33 NROFF = @NROFF@
34 ASCIIDOC = @ASCIIDOC@
35 XMLTO = @XMLTO@
37 MKDIR = mkdir
38 RM = rm
40 STRIP = strip
41 FIND = find
43 # Binary suffixes
44 O = @OBJEXT@
45 X = @EXEEXT@
47 # Debug stuff
48 ifeq ($(TRACE),1)
49 CFLAGS += -DNASM_TRACE
50 endif
52 .SUFFIXES: .c .i .s .$(O) .1 .txt
54 .PHONY: all doc rdf install clean distclean cleaner spotless install_rdf test
55 .PHONY: install_doc everything install_everything strip perlreq dist tags TAGS
57 .c.$(O):
58 $(CC) -c $(ALL_CFLAGS) -o $@ $<
60 .c.s:
61 $(CC) -S $(ALL_CFLAGS) -o $@ $<
63 .c.i:
64 $(CC) -E $(ALL_CFLAGS) -o $@ $<
66 .txt.1:
67 $(ASCIIDOC) -b docbook -d manpage -o $(patsubst %.1,%.xml,$@) $<
68 $(XMLTO) man --skip-validation $(patsubst %.1,%.xml,$@) 2>/dev/null
71 #-- Begin File Lists --#
72 NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \
73 raa.$(O) saa.$(O) rbtree.$(O) \
74 float.$(O) insnsa.$(O) insnsb.$(O) \
75 directiv.$(O) \
76 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
77 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
78 output/nullout.$(O) \
79 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
80 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
81 output/outelfx32.$(O) \
82 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
83 output/outdbg.$(O) output/outieee.$(O) output/outmac32.$(O) \
84 output/outmac64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
85 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
86 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) \
87 ilog2.$(O) \
88 lib/strlcpy.$(O) \
89 preproc-nop.$(O)
91 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
92 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
93 #-- End File Lists --#
95 all: nasm$(X) ndisasm$(X) nasm.1 ndisasm.1 rdf
97 nasm$(X): $(NASM) $(XOBJS)
98 $(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(XOBJS) $(LIBS)
100 ndisasm$(X): $(NDISASM) $(XOBJS)
101 $(CC) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(XOBJS) $(LIBS)
103 # These source files are automagically generated from a single
104 # instruction-table file by a Perl script. They're distributed,
105 # though, so it isn't necessary to have Perl just to recompile NASM
106 # from the distribution.
108 insnsb.c: insns.dat insns.pl
109 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
110 insnsa.c: insns.dat insns.pl
111 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
112 insnsd.c: insns.dat insns.pl
113 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
114 insnsi.h: insns.dat insns.pl
115 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
116 insnsn.c: insns.dat insns.pl
117 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
119 # These files contains all the standard macros that are derived from
120 # the version number.
121 version.h: version version.pl
122 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
123 version.mac: version version.pl
124 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
125 version.sed: version version.pl
126 $(PERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed
127 version.mak: version version.pl
128 $(PERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak
129 version.nsh: version version.pl
130 $(PERL) $(srcdir)/version.pl nsis < $(srcdir)/version > version.nsh
132 # This source file is generated from the standard macros file
133 # `standard.mac' by another Perl script. Again, it's part of the
134 # standard distribution.
135 macros.c: macros.pl pptok.ph standard.mac version.mac \
136 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
137 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
138 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
140 # These source files are generated from regs.dat by yet another
141 # perl script.
142 regs.c: regs.dat regs.pl
143 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
144 regflags.c: regs.dat regs.pl
145 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
146 regdis.c: regs.dat regs.pl
147 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
148 regdis.h: regs.dat regs.pl
149 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
150 regvals.c: regs.dat regs.pl
151 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
152 regs.h: regs.dat regs.pl
153 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
155 # Assembler token hash
156 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
157 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
158 $(srcdir)/tokens.dat > tokhash.c
160 # Assembler token metadata
161 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
162 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
163 $(srcdir)/tokens.dat > tokens.h
165 # Preprocessor token hash
166 pptok.h: pptok.dat pptok.pl perllib/phash.ph
167 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
168 pptok.c: pptok.dat pptok.pl perllib/phash.ph
169 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
170 pptok.ph: pptok.dat pptok.pl perllib/phash.ph
171 $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
173 # Directives hash
174 directiv.h: directiv.dat directiv.pl perllib/phash.ph
175 $(PERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
176 directiv.c: directiv.dat directiv.pl perllib/phash.ph
177 $(PERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
179 # This target generates all files that require perl.
180 # This allows easier generation of distribution (see dist target).
181 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
182 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
183 tokhash.c tokens.h pptok.h pptok.c pptok.ph \
184 directiv.c directiv.h \
185 version.h version.mac version.mak version.nsh
186 perlreq: $(PERLREQ)
188 install: nasm$(X) ndisasm$(X)
189 $(MKDIR) -p $(INSTALLROOT)$(bindir)
190 $(INSTALL_PROGRAM) nasm$(X) $(INSTALLROOT)$(bindir)/nasm$(X)
191 $(INSTALL_PROGRAM) ndisasm$(X) $(INSTALLROOT)$(bindir)/ndisasm$(X)
192 $(MKDIR) -p $(INSTALLROOT)$(mandir)/man1
193 $(INSTALL_DATA) $(srcdir)/nasm.1 $(INSTALLROOT)$(mandir)/man1/nasm.1
194 $(INSTALL_DATA) $(srcdir)/ndisasm.1 $(INSTALLROOT)$(mandir)/man1/ndisasm.1
196 clean:
197 $(RM) -f *.$(O) *.s *.i
198 $(RM) -f lib/*.$(O) lib/*.s lib/*.i
199 $(RM) -f output/*.$(O) output/*.s output/*.i
200 $(RM) -f nasm$(X) ndisasm$(X)
201 $(RM) -f tags TAGS
202 cd rdoff && $(MAKE) clean
204 distclean: clean
205 $(RM) -f config.h config.log config.status
206 $(RM) -f Makefile *~ *.bak *.lst *.bin
207 $(RM) -f output/*~ output/*.bak
208 $(RM) -f test/*.lst test/*.bin test/*.$(O) test/*.bin
209 $(RM) -rf autom4te*.cache
210 cd rdoff && $(MAKE) distclean
212 cleaner: clean
213 $(RM) -f $(PERLREQ) *.1 nasm.spec
214 cd doc && $(MAKE) clean
216 spotless: distclean cleaner
217 $(RM) -f doc/Makefile doc/*~ doc/*.bak
219 strip:
220 $(STRIP) --strip-unneeded nasm$(X) ndisasm$(X)
222 rdf: nasmlib.$(O)
223 cd rdoff && $(MAKE) all
225 TAGS:
226 $(RM) -f TAGS
227 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
229 tags:
230 $(RM) -f tags
231 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
233 cscope:
234 $(RM) -f cscope.out cscope.files
235 $(FIND) . -name '*.[hcS]' -print > cscope.files
236 cscope -b -f cscope.out
238 rdf_install install_rdf:
239 cd rdoff && $(MAKE) install
241 doc:
242 cd doc && $(MAKE) all
244 doc_install install_doc:
245 cd doc && $(MAKE) install
247 everything: all doc rdf
249 install_everything: everything install install_doc install_rdf
251 dist: spotless perlreq spec
252 autoheader
253 autoconf
254 $(RM) -rf ./autom4te*.cache
256 tar: dist
257 tar -cvj --exclude CVS -C .. -f ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 `basename \`pwd\``
259 spec: nasm.spec
261 nasm.spec: nasm.spec.in version.sed
262 sed -f version.sed < nasm.spec.in > nasm.spec
264 splint:
265 splint -weak *.c
267 test: nasm$(X)
268 cd test && $(PERL) performtest.pl --nasm=../nasm *.asm
271 # This build dependencies in *ALL* makefiles. Partially for that reason,
272 # it's expected to be invoked manually.
274 alldeps: perlreq
275 $(PERL) syncfiles.pl Makefile.in Mkfiles/*.mak
276 $(PERL) mkdep.pl -M Makefile.in Mkfiles/*.mak -- \
277 . output lib
278 ./config.status
280 #-- Magic hints to mkdep.pl --#
281 # @object-ending: ".$(O)"
282 # @path-separator: "/"
283 #-- Everything below is generated by mkdep.pl - do not edit --#
284 assemble.$(O): assemble.c assemble.h compiler.h config.h directiv.h insns.h \
285 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
286 tokens.h
287 crc64.$(O): crc64.c compiler.h config.h nasmlib.h
288 directiv.$(O): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
289 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
290 disasm.$(O): disasm.c compiler.h config.h directiv.h disasm.h insns.h \
291 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h \
292 sync.h tables.h tokens.h
293 eval.$(O): eval.c compiler.h config.h directiv.h eval.h float.h insnsi.h \
294 labels.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
295 exprlib.$(O): exprlib.c compiler.h config.h directiv.h insnsi.h nasm.h \
296 nasmlib.h opflags.h pptok.h preproc.h regs.h
297 float.$(O): float.c compiler.h config.h directiv.h float.h insnsi.h nasm.h \
298 nasmlib.h opflags.h pptok.h preproc.h regs.h
299 hashtbl.$(O): hashtbl.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
300 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
301 ilog2.$(O): ilog2.c compiler.h config.h nasmlib.h
302 insnsa.$(O): insnsa.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
303 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
304 insnsb.$(O): insnsb.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
305 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
306 insnsd.$(O): insnsd.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
307 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
308 insnsn.$(O): insnsn.c compiler.h config.h insnsi.h opflags.h tables.h
309 labels.$(O): labels.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
310 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
311 lib/snprintf.$(O): lib/snprintf.c compiler.h config.h nasmlib.h
312 lib/strlcpy.$(O): lib/strlcpy.c compiler.h config.h
313 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h config.h nasmlib.h
314 listing.$(O): listing.c compiler.h config.h directiv.h insnsi.h listing.h \
315 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
316 macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
317 nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
318 tables.h
319 nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
320 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
321 output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
322 tokens.h
323 nasmlib.$(O): nasmlib.c compiler.h config.h directiv.h insns.h insnsi.h \
324 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
325 ndisasm.$(O): ndisasm.c compiler.h config.h directiv.h disasm.h insns.h \
326 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
327 tokens.h
328 output/nulldbg.$(O): output/nulldbg.c compiler.h config.h directiv.h \
329 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
330 output/nullout.$(O): output/nullout.c compiler.h config.h directiv.h \
331 insnsi.h nasm.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h \
332 regs.h
333 output/outaout.$(O): output/outaout.c compiler.h config.h directiv.h eval.h \
334 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
335 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
336 output/outas86.$(O): output/outas86.c compiler.h config.h directiv.h \
337 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
338 pptok.h preproc.h raa.h regs.h saa.h
339 output/outbin.$(O): output/outbin.c compiler.h config.h directiv.h eval.h \
340 insnsi.h labels.h nasm.h nasmlib.h opflags.h output/outform.h \
341 output/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h
342 output/outcoff.$(O): output/outcoff.c compiler.h config.h directiv.h eval.h \
343 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
344 output/pecoff.h pptok.h preproc.h raa.h regs.h saa.h
345 output/outdbg.$(O): output/outdbg.c compiler.h config.h directiv.h insnsi.h \
346 nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h
347 output/outelf.$(O): output/outelf.c compiler.h config.h directiv.h insnsi.h \
348 nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
349 output/outform.h pptok.h preproc.h regs.h
350 output/outelf32.$(O): output/outelf32.c compiler.h config.h directiv.h \
351 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
352 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
353 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
354 output/outelf64.$(O): output/outelf64.c compiler.h config.h directiv.h \
355 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
356 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
357 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
358 output/outelfx32.$(O): output/outelfx32.c compiler.h config.h directiv.h \
359 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
360 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
361 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
362 output/outform.$(O): output/outform.c compiler.h config.h directiv.h \
363 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h \
364 regs.h
365 output/outieee.$(O): output/outieee.c compiler.h config.h directiv.h \
366 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
367 pptok.h preproc.h regs.h
368 output/outlib.$(O): output/outlib.c compiler.h config.h directiv.h insnsi.h \
369 nasm.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h
370 output/outmac32.$(O): output/outmac32.c compiler.h config.h directiv.h \
371 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
372 pptok.h preproc.h raa.h regs.h saa.h
373 output/outmac64.$(O): output/outmac64.c compiler.h config.h directiv.h \
374 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
375 pptok.h preproc.h raa.h regs.h saa.h
376 output/outobj.$(O): output/outobj.c compiler.h config.h directiv.h eval.h \
377 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
378 pptok.h preproc.h regs.h stdscan.h
379 output/outrdf2.$(O): output/outrdf2.c compiler.h config.h directiv.h \
380 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
381 pptok.h preproc.h rdoff/rdoff.h regs.h saa.h
382 parser.$(O): parser.c compiler.h config.h directiv.h eval.h float.h insns.h \
383 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h \
384 stdscan.h tables.h tokens.h
385 pptok.$(O): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
386 preproc.h
387 preproc-nop.$(O): preproc-nop.c compiler.h config.h directiv.h insnsi.h \
388 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
389 preproc.$(O): preproc.c compiler.h config.h directiv.h eval.h hashtbl.h \
390 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
391 stdscan.h tables.h tokens.h
392 quote.$(O): quote.c compiler.h config.h nasmlib.h quote.h
393 raa.$(O): raa.c compiler.h config.h nasmlib.h raa.h
394 rbtree.$(O): rbtree.c compiler.h config.h rbtree.h
395 regdis.$(O): regdis.c regdis.h regs.h
396 regflags.$(O): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h \
397 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
398 regs.$(O): regs.c compiler.h config.h insnsi.h opflags.h tables.h
399 regvals.$(O): regvals.c compiler.h config.h insnsi.h opflags.h tables.h
400 saa.$(O): saa.c compiler.h config.h nasmlib.h saa.h
401 stdscan.$(O): stdscan.c compiler.h config.h directiv.h insns.h insnsi.h \
402 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
403 tokens.h
404 strfunc.$(O): strfunc.c compiler.h config.h directiv.h insnsi.h nasm.h \
405 nasmlib.h opflags.h pptok.h preproc.h regs.h
406 sync.$(O): sync.c compiler.h config.h nasmlib.h sync.h
407 tokhash.$(O): tokhash.c compiler.h config.h directiv.h hashtbl.h insns.h \
408 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
409 ver.$(O): ver.c compiler.h config.h directiv.h insnsi.h nasm.h nasmlib.h \
410 opflags.h pptok.h preproc.h regs.h version.h