BR3392231: Fix get_closest_section_symbol_by_offset
[nasm.git] / Makefile.in
blobd7b4e2246d0bd80b64596891a2152f72c059f859
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) \
85 preproc-nop.$(O)
87 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
88 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
89 #-- End File Lists --#
91 all: nasm$(X) ndisasm$(X) nasm.man ndisasm.man rdf
93 nasm$(X): $(NASM) $(XOBJS)
94 $(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(XOBJS) $(LIBS)
96 ndisasm$(X): $(NDISASM) $(XOBJS)
97 $(CC) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(XOBJS) $(LIBS)
99 # These source files are automagically generated from a single
100 # instruction-table file by a Perl script. They're distributed,
101 # though, so it isn't necessary to have Perl just to recompile NASM
102 # from the distribution.
104 insnsb.c: insns.dat insns.pl
105 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
106 insnsa.c: insns.dat insns.pl
107 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
108 insnsd.c: insns.dat insns.pl
109 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
110 insnsi.h: insns.dat insns.pl
111 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
112 insnsn.c: insns.dat insns.pl
113 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
115 # These files contains all the standard macros that are derived from
116 # the version number.
117 version.h: version version.pl
118 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
119 version.mac: version version.pl
120 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
121 version.sed: version version.pl
122 $(PERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed
123 version.mak: version version.pl
124 $(PERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak
125 version.nsh: version version.pl
126 $(PERL) $(srcdir)/version.pl nsis < $(srcdir)/version > version.nsh
128 # This source file is generated from the standard macros file
129 # `standard.mac' by another Perl script. Again, it's part of the
130 # standard distribution.
131 macros.c: macros.pl pptok.ph standard.mac version.mac \
132 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
133 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
134 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
136 # These source files are generated from regs.dat by yet another
137 # perl script.
138 regs.c: regs.dat regs.pl
139 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
140 regflags.c: regs.dat regs.pl
141 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
142 regdis.c: regs.dat regs.pl
143 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
144 regdis.h: regs.dat regs.pl
145 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
146 regvals.c: regs.dat regs.pl
147 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
148 regs.h: regs.dat regs.pl
149 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
151 # Assembler token hash
152 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
153 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
154 $(srcdir)/tokens.dat > tokhash.c
156 # Assembler token metadata
157 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
158 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
159 $(srcdir)/tokens.dat > tokens.h
161 # Preprocessor token hash
162 pptok.h: pptok.dat pptok.pl perllib/phash.ph
163 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
164 pptok.c: pptok.dat pptok.pl perllib/phash.ph
165 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
166 pptok.ph: pptok.dat pptok.pl perllib/phash.ph
167 $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
169 # Directives hash
170 directiv.h: directiv.dat directiv.pl perllib/phash.ph
171 $(PERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
172 directiv.c: directiv.dat directiv.pl perllib/phash.ph
173 $(PERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
175 # This target generates all files that require perl.
176 # This allows easier generation of distribution (see dist target).
177 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
178 regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
179 tokhash.c tokens.h pptok.h pptok.c pptok.ph \
180 directiv.c directiv.h \
181 version.h version.mac version.mak version.nsh
182 perlreq: $(PERLREQ)
184 install: nasm$(X) ndisasm$(X)
185 $(MKDIR) -p $(INSTALLROOT)$(bindir)
186 $(INSTALL_PROGRAM) nasm$(X) $(INSTALLROOT)$(bindir)/nasm$(X)
187 $(INSTALL_PROGRAM) ndisasm$(X) $(INSTALLROOT)$(bindir)/ndisasm$(X)
188 $(MKDIR) -p $(INSTALLROOT)$(mandir)/man1
189 $(INSTALL_DATA) $(srcdir)/nasm.1 $(INSTALLROOT)$(mandir)/man1/nasm.1
190 $(INSTALL_DATA) $(srcdir)/ndisasm.1 $(INSTALLROOT)$(mandir)/man1/ndisasm.1
192 clean:
193 $(RM) -f *.$(O) *.s *.i
194 $(RM) -f lib/*.$(O) lib/*.s lib/*.i
195 $(RM) -f output/*.$(O) output/*.s output/*.i
196 $(RM) -f nasm$(X) ndisasm$(X)
197 $(RM) -f tags TAGS
198 cd rdoff && $(MAKE) clean
200 distclean: clean
201 $(RM) -f config.h config.log config.status
202 $(RM) -f Makefile *~ *.bak *.lst *.bin
203 $(RM) -f output/*~ output/*.bak
204 $(RM) -f test/*.lst test/*.bin test/*.$(O) test/*.bin
205 $(RM) -rf autom4te*.cache
206 cd rdoff && $(MAKE) distclean
208 cleaner: clean
209 $(RM) -f $(PERLREQ) *.man nasm.spec
210 cd doc && $(MAKE) clean
212 spotless: distclean cleaner
213 $(RM) -f doc/Makefile doc/*~ doc/*.bak
215 strip:
216 $(STRIP) --strip-unneeded nasm$(X) ndisasm$(X)
218 rdf: nasmlib.$(O)
219 cd rdoff && $(MAKE) all
221 TAGS:
222 $(RM) -f TAGS
223 $(FIND) . -name '*.[hcS]' -print | xargs etags -a
225 tags:
226 $(RM) -f tags
227 $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
229 cscope:
230 $(RM) -f cscope.out cscope.files
231 $(FIND) . -name '*.[hcS]' -print > cscope.files
232 cscope -b -f cscope.out
234 rdf_install install_rdf:
235 cd rdoff && $(MAKE) install
237 doc:
238 cd doc && $(MAKE) all
240 doc_install install_doc:
241 cd doc && $(MAKE) install
243 everything: all doc rdf
245 install_everything: everything install install_doc install_rdf
247 dist: spotless perlreq spec
248 autoheader
249 autoconf
250 $(RM) -rf ./autom4te*.cache
252 tar: dist
253 tar -cvj --exclude CVS -C .. -f ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 `basename \`pwd\``
255 spec: nasm.spec
257 nasm.spec: nasm.spec.in version.sed
258 sed -f version.sed < nasm.spec.in > nasm.spec
260 splint:
261 splint -weak *.c
263 test: nasm$(X)
264 cd test && $(PERL) performtest.pl --nasm=../nasm *.asm
267 # This build dependencies in *ALL* makefiles. Partially for that reason,
268 # it's expected to be invoked manually.
270 alldeps: perlreq
271 $(PERL) syncfiles.pl Makefile.in Mkfiles/*.mak
272 $(PERL) mkdep.pl -M Makefile.in Mkfiles/*.mak -- \
273 . output lib
274 ./config.status
276 #-- Magic hints to mkdep.pl --#
277 # @object-ending: ".$(O)"
278 # @path-separator: "/"
279 #-- Everything below is generated by mkdep.pl - do not edit --#
280 assemble.$(O): assemble.c assemble.h compiler.h config.h directiv.h insns.h \
281 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
282 tokens.h
283 crc64.$(O): crc64.c compiler.h config.h nasmlib.h
284 directiv.$(O): directiv.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
285 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
286 disasm.$(O): disasm.c compiler.h config.h directiv.h disasm.h insns.h \
287 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h \
288 sync.h tables.h tokens.h
289 eval.$(O): eval.c compiler.h config.h directiv.h eval.h float.h insnsi.h \
290 labels.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
291 exprlib.$(O): exprlib.c compiler.h config.h directiv.h insnsi.h nasm.h \
292 nasmlib.h opflags.h pptok.h preproc.h regs.h
293 float.$(O): float.c compiler.h config.h directiv.h float.h insnsi.h nasm.h \
294 nasmlib.h opflags.h pptok.h preproc.h regs.h
295 hashtbl.$(O): hashtbl.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
296 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
297 ilog2.$(O): ilog2.c compiler.h config.h nasmlib.h
298 insnsa.$(O): insnsa.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
299 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
300 insnsb.$(O): insnsb.c compiler.h config.h directiv.h insns.h insnsi.h nasm.h \
301 nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
302 insnsd.$(O): insnsd.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 insnsn.$(O): insnsn.c compiler.h config.h insnsi.h opflags.h tables.h
305 labels.$(O): labels.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
306 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
307 lib/snprintf.$(O): lib/snprintf.c compiler.h config.h nasmlib.h
308 lib/strlcpy.$(O): lib/strlcpy.c compiler.h config.h
309 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h config.h nasmlib.h
310 listing.$(O): listing.c compiler.h config.h directiv.h insnsi.h listing.h \
311 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
312 macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
313 nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
314 tables.h
315 nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
316 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
317 output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
318 tokens.h
319 nasmlib.$(O): nasmlib.c compiler.h config.h directiv.h insns.h insnsi.h \
320 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
321 ndisasm.$(O): ndisasm.c compiler.h config.h directiv.h disasm.h insns.h \
322 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
323 tokens.h
324 output/nulldbg.$(O): output/nulldbg.c compiler.h config.h directiv.h \
325 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
326 output/nullout.$(O): output/nullout.c compiler.h config.h directiv.h \
327 insnsi.h nasm.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h \
328 regs.h
329 output/outaout.$(O): output/outaout.c compiler.h config.h directiv.h eval.h \
330 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
331 pptok.h preproc.h raa.h regs.h saa.h stdscan.h
332 output/outas86.$(O): output/outas86.c compiler.h config.h directiv.h \
333 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
334 pptok.h preproc.h raa.h regs.h saa.h
335 output/outbin.$(O): output/outbin.c compiler.h config.h directiv.h eval.h \
336 insnsi.h labels.h nasm.h nasmlib.h opflags.h output/outform.h \
337 output/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h
338 output/outcoff.$(O): output/outcoff.c compiler.h config.h directiv.h eval.h \
339 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
340 output/pecoff.h pptok.h preproc.h raa.h regs.h saa.h
341 output/outdbg.$(O): output/outdbg.c compiler.h config.h directiv.h insnsi.h \
342 nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h
343 output/outelf.$(O): output/outelf.c compiler.h config.h directiv.h insnsi.h \
344 nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
345 output/outform.h pptok.h preproc.h regs.h
346 output/outelf32.$(O): output/outelf32.c compiler.h config.h directiv.h \
347 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
348 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
349 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h
350 output/outelf64.$(O): output/outelf64.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/outelfx32.$(O): output/outelfx32.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/outform.$(O): output/outform.c compiler.h config.h directiv.h \
359 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h \
360 regs.h
361 output/outieee.$(O): output/outieee.c compiler.h config.h directiv.h \
362 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
363 pptok.h preproc.h regs.h
364 output/outlib.$(O): output/outlib.c compiler.h config.h directiv.h insnsi.h \
365 nasm.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h
366 output/outmac32.$(O): output/outmac32.c compiler.h config.h directiv.h \
367 eval.h insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
368 pptok.h preproc.h raa.h regs.h saa.h
369 output/outmac64.$(O): output/outmac64.c compiler.h config.h directiv.h \
370 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
371 pptok.h preproc.h raa.h regs.h saa.h
372 output/outobj.$(O): output/outobj.c compiler.h config.h directiv.h eval.h \
373 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
374 pptok.h preproc.h regs.h stdscan.h
375 output/outrdf2.$(O): output/outrdf2.c compiler.h config.h directiv.h \
376 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
377 pptok.h preproc.h rdoff/rdoff.h regs.h saa.h
378 parser.$(O): parser.c compiler.h config.h directiv.h eval.h float.h insns.h \
379 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h \
380 stdscan.h tables.h tokens.h
381 pptok.$(O): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
382 preproc.h
383 preproc-nop.$(O): preproc-nop.c compiler.h config.h directiv.h insnsi.h \
384 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h
385 preproc.$(O): preproc.c compiler.h config.h directiv.h eval.h hashtbl.h \
386 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
387 stdscan.h tables.h tokens.h
388 quote.$(O): quote.c compiler.h config.h nasmlib.h quote.h
389 raa.$(O): raa.c compiler.h config.h nasmlib.h raa.h
390 rbtree.$(O): rbtree.c compiler.h config.h rbtree.h
391 regdis.$(O): regdis.c regdis.h regs.h
392 regflags.$(O): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h \
393 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
394 regs.$(O): regs.c compiler.h config.h insnsi.h opflags.h tables.h
395 regvals.$(O): regvals.c compiler.h config.h insnsi.h opflags.h tables.h
396 saa.$(O): saa.c compiler.h config.h nasmlib.h saa.h
397 stdscan.$(O): stdscan.c compiler.h config.h directiv.h insns.h insnsi.h \
398 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
399 tokens.h
400 strfunc.$(O): strfunc.c compiler.h config.h directiv.h insnsi.h nasm.h \
401 nasmlib.h opflags.h pptok.h preproc.h regs.h
402 sync.$(O): sync.c compiler.h config.h nasmlib.h sync.h
403 tokhash.$(O): tokhash.c compiler.h config.h directiv.h hashtbl.h insns.h \
404 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tokens.h
405 ver.$(O): ver.c compiler.h config.h directiv.h insnsi.h nasm.h nasmlib.h \
406 opflags.h pptok.h preproc.h regs.h version.h