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