Use a phash to decode directives
[platform/upstream/nasm.git] / Makefile.in
1 #
2 # Auto-configuring Makefile for the Netwide Assembler.
3 #
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.
8
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@
17
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
26
27 XOBJS           = @XOBJS@
28
29 INSTALL         = @INSTALL@
30 INSTALL_PROGRAM = @INSTALL_PROGRAM@
31 INSTALL_DATA    = @INSTALL_DATA@
32
33 NROFF           = @NROFF@
34
35 MKDIR           = mkdir
36 RM              = rm
37
38 STRIP           = strip
39
40 # Binary suffixes
41 O               = @OBJEXT@
42 X               = @EXEEXT@
43
44 .SUFFIXES: .c .i .s .$(O) .1 .man
45
46 .PHONY: all doc rdf install clean distclean cleaner spotless install_rdf
47 .PHONY: install_doc everything install_everything strip perlreq dist
48
49 .c.$(O):
50         $(CC) -c $(ALL_CFLAGS) -o $@ $<
51
52 .c.s:
53         $(CC) -S $(ALL_CFLAGS) -o $@ $<
54
55 .c.i:
56         $(CC) -E $(ALL_CFLAGS) -o $@ $<
57
58 .1.man:
59         $(NROFF) -man $< > $@
60
61 #-- Begin File Lists --#
62 NASM =  nasm.$(O) nasmlib.$(O) ver.$(O) \
63         raa.$(O) saa.$(O) rbtree.$(O) \
64         float.$(O) insnsa.$(O) insnsb.$(O) \
65         directives.$(O) \
66         assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
67         output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
68         output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
69         output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
70         output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
71         output/outdbg.$(O) output/outieee.$(O) output/outmacho32.$(O) \
72         output/outmacho64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
73         macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
74         strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O)
75
76 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
77         insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
78 #-- End File Lists --#
79
80 all: nasm$(X) ndisasm$(X) nasm.man ndisasm.man
81         cd rdoff && $(MAKE) all
82
83 nasm$(X): $(NASM) $(XOBJS)
84         $(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(XOBJS) $(LIBS)
85
86 ndisasm$(X): $(NDISASM) $(XOBJS)
87         $(CC) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(XOBJS) $(LIBS)
88
89 # These source files are automagically generated from a single
90 # instruction-table file by a Perl script. They're distributed,
91 # though, so it isn't necessary to have Perl just to recompile NASM
92 # from the distribution.
93
94 insnsb.c: insns.dat insns.pl
95         $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
96 insnsa.c: insns.dat insns.pl
97         $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
98 insnsd.c: insns.dat insns.pl
99         $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
100 insnsi.h: insns.dat insns.pl
101         $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
102 insnsn.c: insns.dat insns.pl
103         $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
104
105 # These files contains all the standard macros that are derived from
106 # the version number.
107 version.h: version version.pl
108         $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
109 version.mac: version version.pl
110         $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
111 version.sed: version version.pl
112         $(PERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed
113 version.mak: version version.pl
114         $(PERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak
115 version.nsh: version version.pl
116         $(PERL) $(srcdir)/version.pl nsis < $(srcdir)/version > version.nsh
117
118 # This source file is generated from the standard macros file
119 # `standard.mac' by another Perl script. Again, it's part of the
120 # standard distribution.
121 macros.c: macros.pl pptok.ph standard.mac version.mac \
122         $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
123         $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
124                 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
125
126 # These source files are generated from regs.dat by yet another
127 # perl script.
128 regs.c: regs.dat regs.pl
129         $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
130 regflags.c: regs.dat regs.pl
131         $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
132 regdis.c: regs.dat regs.pl
133         $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
134 regdis.h: regs.dat regs.pl
135         $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
136 regvals.c: regs.dat regs.pl
137         $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
138 regs.h: regs.dat regs.pl
139         $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
140
141 # Assembler token hash
142 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
143         $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
144                 $(srcdir)/tokens.dat > tokhash.c
145
146 # Assembler token metadata
147 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
148         $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
149                 $(srcdir)/tokens.dat > tokens.h
150
151 # Preprocessor token hash
152 pptok.h: pptok.dat pptok.pl perllib/phash.ph
153         $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
154 pptok.c: pptok.dat pptok.pl perllib/phash.ph
155         $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
156 pptok.ph: pptok.dat pptok.pl perllib/phash.ph
157         $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
158
159 # Directives hash
160 directives.h: directives.dat directives.pl perllib/phash.ph
161         $(PERL) $(srcdir)/directives.pl h $(srcdir)/directives.dat directives.h
162 directives.c: directives.dat directives.pl perllib/phash.ph
163         $(PERL) $(srcdir)/directives.pl c $(srcdir)/directives.dat directives.c
164
165 # This target generates all files that require perl.
166 # This allows easier generation of distribution (see dist target).
167 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
168           regs.c regs.h regflags.c regdis.c regdis.h regvals.c \
169           tokhash.c tokens.h pptok.h pptok.c pptok.ph \
170           directives.c directives.h \
171           version.h version.mac version.mak version.nsh
172 perlreq: $(PERLREQ)
173
174 install: nasm$(X) ndisasm$(X)
175         $(MKDIR) -p $(INSTALLROOT)$(bindir)
176         $(INSTALL_PROGRAM) nasm$(X) $(INSTALLROOT)$(bindir)/nasm$(X)
177         $(INSTALL_PROGRAM) ndisasm$(X) $(INSTALLROOT)$(bindir)/ndisasm$(X)
178         $(MKDIR) -p $(INSTALLROOT)$(mandir)/man1
179         $(INSTALL_DATA) $(srcdir)/nasm.1 $(INSTALLROOT)$(mandir)/man1/nasm.1
180         $(INSTALL_DATA) $(srcdir)/ndisasm.1 $(INSTALLROOT)$(mandir)/man1/ndisasm.1
181
182 clean:
183         $(RM) -f *.$(O) *.s *.i
184         $(RM) -f output/*.$(O) output/*.s output/*.i
185         $(RM) -f nasm$(X) ndisasm$(X)
186         cd rdoff && $(MAKE) clean
187
188 distclean: clean
189         $(RM) -f config.h config.log config.status
190         $(RM) -f Makefile *~ *.bak *.lst *.bin
191         $(RM) -f output/*~ output/*.bak
192         $(RM) -f test/*.lst test/*.bin test/*.$(O) test/*.bin
193         $(RM) -rf autom4te*.cache
194         cd rdoff && $(MAKE) distclean
195
196 cleaner: clean
197         $(RM) -f $(PERLREQ) *.man nasm.spec
198         cd doc && $(MAKE) clean
199
200 spotless: distclean cleaner
201         $(RM) -f doc/Makefile doc/*~ doc/*.bak
202
203 strip:
204         $(STRIP) --strip-unneeded nasm$(X) ndisasm$(X)
205
206 rdf:
207         cd rdoff && $(MAKE)
208
209 rdf_install install_rdf:
210         cd rdoff && $(MAKE) install
211
212 doc:
213         cd doc && $(MAKE) all
214
215 doc_install install_doc:
216         cd doc && $(MAKE) install
217
218 everything: all doc rdf
219
220 install_everything: everything install install_doc install_rdf
221
222 dist: spotless perlreq spec
223         autoheader
224         autoconf
225         $(RM) -rf ./autom4te*.cache
226
227 tar: dist
228         tar -cvj --exclude CVS -C .. -f ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 `basename \`pwd\``
229
230 spec: nasm.spec
231
232 nasm.spec: nasm.spec.in version.sed
233         sed -f version.sed < nasm.spec.in > nasm.spec
234
235 splint:
236         splint -weak *.c
237
238 test: nasm$(X)
239         cd test && $(PERL) performtest.pl --nasm=../nasm *.asm
240
241 #
242 # This build dependencies in *ALL* makefiles.  Partially for that reason,
243 # it's expected to be invoked manually.
244 #
245 alldeps: perlreq
246         $(PERL) syncfiles.pl Makefile.in Mkfiles/*.mak
247         $(PERL) mkdep.pl -M Makefile.in Mkfiles/*.mak -- \
248                 . output lib
249         ./config.status
250
251 #-- Magic hints to mkdep.pl --#
252 # @object-ending: ".$(O)"
253 # @path-separator: "/"
254 #-- Everything below is generated by mkdep.pl - do not edit --#
255 assemble.$(O): assemble.c assemble.h compiler.h config.h insns.h insnsi.h \
256  nasm.h nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h
257 crc64.$(O): crc64.c compiler.h config.h nasmlib.h
258 directives.$(O): directives.c compiler.h config.h directives.h hashtbl.h \
259  insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h
260 disasm.$(O): disasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
261  nasmlib.h pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
262 eval.$(O): eval.c compiler.h config.h eval.h float.h insnsi.h labels.h \
263  nasm.h nasmlib.h pptok.h preproc.h regs.h
264 exprlib.$(O): exprlib.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
265  pptok.h preproc.h regs.h
266 float.$(O): float.c compiler.h config.h float.h insnsi.h nasm.h nasmlib.h \
267  pptok.h preproc.h regs.h
268 hashtbl.$(O): hashtbl.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
269  nasmlib.h pptok.h preproc.h regs.h
270 insnsa.$(O): insnsa.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
271  pptok.h preproc.h regs.h tokens.h
272 insnsb.$(O): insnsb.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
273  pptok.h preproc.h regs.h tokens.h
274 insnsd.$(O): insnsd.c compiler.h config.h insns.h insnsi.h nasm.h nasmlib.h \
275  pptok.h preproc.h regs.h tokens.h
276 insnsn.$(O): insnsn.c compiler.h config.h insnsi.h tables.h
277 labels.$(O): labels.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
278  nasmlib.h pptok.h preproc.h regs.h
279 lib/snprintf.$(O): lib/snprintf.c compiler.h config.h nasmlib.h
280 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h config.h nasmlib.h
281 listing.$(O): listing.c compiler.h config.h insnsi.h listing.h nasm.h \
282  nasmlib.h pptok.h preproc.h regs.h
283 macros.$(O): macros.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
284  nasmlib.h output/outform.h pptok.h preproc.h regs.h tables.h
285 nasm.$(O): nasm.c assemble.h compiler.h config.h directives.h eval.h float.h \
286  insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h output/outform.h \
287  parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
288 nasmlib.$(O): nasmlib.c compiler.h config.h insns.h insnsi.h nasm.h \
289  nasmlib.h pptok.h preproc.h regs.h tokens.h
290 ndisasm.$(O): ndisasm.c compiler.h config.h disasm.h insns.h insnsi.h nasm.h \
291  nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
292 output/nulldbg.$(O): output/nulldbg.c compiler.h config.h insnsi.h nasm.h \
293  nasmlib.h pptok.h preproc.h regs.h
294 output/outaout.$(O): output/outaout.c compiler.h config.h insnsi.h nasm.h \
295  nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h regs.h \
296  saa.h stdscan.h
297 output/outas86.$(O): output/outas86.c compiler.h config.h insnsi.h nasm.h \
298  nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h regs.h \
299  saa.h
300 output/outbin.$(O): output/outbin.c compiler.h config.h eval.h insnsi.h \
301  labels.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
302  preproc.h regs.h saa.h stdscan.h
303 output/outcoff.$(O): output/outcoff.c compiler.h config.h insnsi.h nasm.h \
304  nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h regs.h \
305  saa.h
306 output/outdbg.$(O): output/outdbg.c compiler.h config.h insnsi.h nasm.h \
307  nasmlib.h output/outform.h pptok.h preproc.h regs.h
308 output/outelf.$(O): output/outelf.c compiler.h config.h insnsi.h nasm.h \
309  nasmlib.h output/dwarf.h output/elfcommon.h output/outelf.h \
310  output/outform.h pptok.h preproc.h regs.h
311 output/outelf32.$(O): output/outelf32.c compiler.h config.h insnsi.h nasm.h \
312  nasmlib.h output/dwarf.h output/elf32.h output/elfcommon.h output/outelf.h \
313  output/outform.h output/outlib.h pptok.h preproc.h raa.h rbtree.h regs.h \
314  saa.h stdscan.h
315 output/outelf64.$(O): output/outelf64.c compiler.h config.h insnsi.h nasm.h \
316  nasmlib.h output/dwarf.h output/elf64.h output/elfcommon.h output/outelf.h \
317  output/outform.h output/outlib.h pptok.h preproc.h raa.h rbtree.h regs.h \
318  saa.h stdscan.h
319 output/outexe.$(O): output/outexe.c compiler.h config.h insnsi.h nasm.h \
320  nasmlib.h output/outform.h pptok.h preproc.h regs.h
321 output/outform.$(O): output/outform.c compiler.h config.h insnsi.h nasm.h \
322  nasmlib.h output/outform.h pptok.h preproc.h regs.h
323 output/outieee.$(O): output/outieee.c compiler.h config.h insnsi.h nasm.h \
324  nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h regs.h
325 output/outlib.$(O): output/outlib.c compiler.h config.h insnsi.h nasm.h \
326  nasmlib.h output/outlib.h pptok.h preproc.h regs.h
327 output/outmacho32.$(O): output/outmacho32.c compiler.h config.h insnsi.h \
328  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
329  regs.h saa.h
330 output/outmacho64.$(O): output/outmacho64.c compiler.h config.h insnsi.h \
331  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
332  regs.h saa.h
333 output/outobj.$(O): output/outobj.c compiler.h config.h insnsi.h nasm.h \
334  nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h regs.h \
335  stdscan.h
336 output/outrdf.$(O): output/outrdf.c compiler.h config.h insnsi.h nasm.h \
337  nasmlib.h output/outform.h pptok.h preproc.h regs.h
338 output/outrdf2.$(O): output/outrdf2.c compiler.h config.h insnsi.h nasm.h \
339  nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h rdoff/rdoff.h \
340  regs.h saa.h
341 parser.$(O): parser.c compiler.h config.h float.h insns.h insnsi.h nasm.h \
342  nasmlib.h parser.h pptok.h preproc.h regs.h stdscan.h tables.h tokens.h
343 pptok.$(O): pptok.c compiler.h config.h hashtbl.h nasmlib.h pptok.h \
344  preproc.h
345 preproc.$(O): preproc.c compiler.h config.h hashtbl.h insnsi.h nasm.h \
346  nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h
347 quote.$(O): quote.c compiler.h config.h nasmlib.h quote.h
348 raa.$(O): raa.c compiler.h config.h nasmlib.h raa.h
349 rbtree.$(O): rbtree.c compiler.h config.h rbtree.h
350 regdis.$(O): regdis.c regdis.h regs.h
351 regflags.$(O): regflags.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
352  pptok.h preproc.h regs.h tables.h
353 regs.$(O): regs.c compiler.h config.h insnsi.h tables.h
354 regvals.$(O): regvals.c compiler.h config.h insnsi.h tables.h
355 saa.$(O): saa.c compiler.h config.h nasmlib.h saa.h
356 stdscan.$(O): stdscan.c compiler.h config.h insns.h insnsi.h nasm.h \
357  nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
358 strfunc.$(O): strfunc.c compiler.h config.h insnsi.h nasm.h nasmlib.h \
359  pptok.h preproc.h regs.h
360 sync.$(O): sync.c compiler.h config.h nasmlib.h sync.h
361 tokhash.$(O): tokhash.c compiler.h config.h hashtbl.h insns.h insnsi.h \
362  nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
363 ver.$(O): ver.c compiler.h config.h insnsi.h nasm.h nasmlib.h pptok.h \
364  preproc.h regs.h version.h