1804507d5d1a083263d7883eda141b867651d7bc
[platform/upstream/nasm.git] / Makefile.in
1 # $Id$
2 #
3 # Auto-configuring Makefile for the Netwide Assembler.
4 #
5 # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
6 # Julian Hall. All rights reserved. The software is
7 # redistributable under the licence given in the file "Licence"
8 # distributed in the NASM archive.
9
10 top_srcdir      = @top_srcdir@
11 srcdir          = @srcdir@
12 VPATH           = @srcdir@
13 prefix          = @prefix@
14 exec_prefix     = @exec_prefix@
15 bindir          = @bindir@
16 mandir          = @mandir@
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 INSTALL         = @INSTALL@
28 INSTALL_PROGRAM = @INSTALL_PROGRAM@
29 INSTALL_DATA    = @INSTALL_DATA@
30
31 NROFF           = @NROFF@
32
33 # Binary suffixes
34 O               = @OBJEXT@
35 X               = @EXEEXT@
36
37 .SUFFIXES: .c .i .s .$(O) .1 .man
38
39 .PHONY: all doc rdf install clean distclean cleaner spotless install_rdf
40 .PHONY: install_doc everything install_everything strip perlreq dist
41
42 .c.$(O):
43         $(CC) -c $(ALL_CFLAGS) -o $@ $<
44
45 .c.s:
46         $(CC) -S $(ALL_CFLAGS) -o $@ $<
47
48 .c.i:
49         $(CC) -E $(ALL_CFLAGS) -o $@ $<
50
51 .1.man:
52         $(NROFF) -man $< > $@
53
54 NASM =  nasm.$(O) nasmlib.$(O) float.$(O) insnsa.$(O) assemble.$(O) \
55         labels.$(O) parser.$(O) outform.$(O) output/outbin.$(O) \
56         output/outaout.$(O) output/outcoff.$(O) \
57         output/outelf32.$(O) output/outelf64.$(O) \
58         output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
59         output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
60         preproc.$(O) pptok.$(O) \
61         listing.$(O) eval.$(O) stdscan.$(O) tokhash.$(O)
62
63 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) insnsd.$(O)
64
65 all: nasm$(X) ndisasm$(X) nasm.man ndisasm.man
66         cd rdoff && $(MAKE) all
67
68 nasm$(X): $(NASM)
69         $(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(LIBS)
70
71 ndisasm$(X): $(NDISASM)
72         $(CC) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(LIBS)
73
74 # These source files are automagically generated from a single
75 # instruction-table file by a Perl script. They're distributed,
76 # though, so it isn't necessary to have Perl just to recompile NASM
77 # from the distribution.
78
79 insnsa.c: insns.dat insns.pl
80         $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
81 insnsd.c: insns.dat insns.pl
82         $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
83 insnsi.h: insns.dat insns.pl
84         $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
85 insnsn.c: insns.dat insns.pl
86         $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
87
88 # These files contains all the standard macros that are derived from
89 # the version number.
90 version.h: version version.pl
91         $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
92
93 version.mac: version version.pl
94         $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
95
96 # This source file is generated from the standard macros file
97 # `standard.mac' by another Perl script. Again, it's part of the
98 # standard distribution.
99
100 macros.c: macros.pl standard.mac version.mac
101         $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
102
103 # These source files are generated from regs.dat by yet another
104 # perl script.
105 regs.c: regs.dat regs.pl
106         $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
107 regflags.c: regs.dat regs.pl
108         $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
109 regdis.c: regs.dat regs.pl
110         $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
111 regvals.c: regs.dat regs.pl
112         $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
113 regs.h: regs.dat regs.pl
114         $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
115
116 # Assembler token hash
117 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
118         $(PERL) $(srcdir)/tokhash.pl $(srcdir)/insns.dat $(srcdir)/regs.dat \
119                 $(srcdir)/tokens.dat > tokhash.c
120
121 # Preprocessor token hash
122 pptok.h: pptok.dat pptok.pl perllib/phash.ph
123         $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
124 pptok.c: pptok.dat pptok.pl perllib/phash.ph
125         $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
126
127 # This target generates all files that require perl.
128 # This allows easier generation of distribution (see dist target).
129 PERLREQ = macros.c insnsa.c insnsd.c insnsi.h insnsn.c \
130           regs.c regs.h regflags.c regdis.c regvals.c tokhash.c \
131           version.h version.mac pptok.h pptok.c
132 perlreq: $(PERLREQ)
133
134 install: nasm$(X) ndisasm$(X)
135         $(INSTALL_PROGRAM) nasm$(X) $(INSTALLROOT)$(bindir)/nasm$(X)
136         $(INSTALL_PROGRAM) ndisasm$(X) $(INSTALLROOT)$(bindir)/ndisasm$(X)
137         $(INSTALL_DATA) $(srcdir)/nasm.1 $(INSTALLROOT)$(mandir)/man1/nasm.1
138         $(INSTALL_DATA) $(srcdir)/ndisasm.1 $(INSTALLROOT)$(mandir)/man1/ndisasm.1
139
140 clean:
141         rm -f *.$(O) *.s *.i
142         rm -f output/*.$(O) output/*.s output/*.i
143         rm -f nasm$(X) ndisasm$(X)
144         cd rdoff && $(MAKE) clean
145
146 distclean: clean
147         rm -f config.h config.log config.status
148         rm -f Makefile *~ *.bak *.lst *.bin
149         rm -f output/*~ output/*.bak
150         rm -f test/*.lst test/*.bin test/*.$(O) test/*.bin
151         rm -rf autom4te*.cache
152         cd rdoff && $(MAKE) distclean
153
154 cleaner: clean
155         rm -f $(PERLREQ) *.man nasm.spec
156         cd doc && $(MAKE) clean
157
158 spotless: distclean cleaner
159         rm -f doc/Makefile doc/*~ doc/*.bak
160
161 strip:
162         strip --strip-unneeded nasm$(X) ndisasm$(X)
163
164 rdf:
165         cd rdoff && $(MAKE)
166
167 rdf_install install_rdf:
168         cd rdoff && $(MAKE) install
169
170 doc:
171         cd doc && $(MAKE) all
172
173 doc_install install_doc:
174         cd doc && $(MAKE) install
175
176 everything: all doc rdf
177
178 install_everything: everything install install_doc install_rdf
179
180 dist: spotless perlreq spec
181         autoheader
182         autoconf
183         rm -rf ./autom4te*.cache
184
185 tar: dist
186         tar -cvj --exclude CVS -C .. -f ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 `basename \`pwd\``
187
188 spec: nasm.spec
189
190 nasm.spec: nasm.spec.in version version.pl
191         sed -e s/@@VERSION@@/`cat $(srcdir)/version`/g \
192             < nasm.spec.in > nasm.spec
193
194 splint:
195         splint -weak *.c
196
197 #
198 # This build dependencies in *ALL* makefiles.  Partially for that reason,
199 # it's expected to be invoked manually.
200 #
201 alldeps: perlreq
202         $(PERL) mkdep.pl -M Makefile.in Mkfiles/Makefile.* -- \
203                 . output
204         ./config.status
205
206 #-- Magic hints to mkdep.pl --#
207 # @object-ending: ".$(O)"
208 # @path-separator: "/"
209 #-- Everything below is generated by mkdep.pl - do not edit --#
210 assemble.$(O): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
211  config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
212 disasm.$(O): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
213  version.h nasm.h insnsn.c names.c insnsi.h disasm.h
214 eval.$(O): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h
215 float.$(O): float.c regs.h config.h version.h nasm.h
216 insnsa.$(O): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
217 insnsd.$(O): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
218 insnsn.$(O): insnsn.c
219 labels.$(O): labels.c regs.h config.h version.h nasmlib.h nasm.h
220 listing.$(O): listing.c regs.h config.h version.h nasmlib.h nasm.h listing.h
221 macros.$(O): macros.c
222 names.$(O): names.c regs.c insnsn.c
223 nasm.$(O): nasm.c labels.h preproc.h insns.h parser.h eval.h pptok.h regs.h \
224  outform.h config.h version.h nasmlib.h nasm.h stdscan.h assemble.h insnsi.h \
225  listing.h
226 nasmlib.$(O): nasmlib.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
227  insnsi.h
228 ndisasm.$(O): ndisasm.c insns.h sync.h regs.h config.h version.h nasmlib.h \
229  nasm.h insnsi.h disasm.h
230 outform.$(O): outform.c regs.h config.h outform.h version.h nasm.h
231 output/outaout.$(O): output/outaout.c regs.h outform.h config.h version.h \
232  nasmlib.h nasm.h stdscan.h
233 output/outas86.$(O): output/outas86.c regs.h outform.h config.h version.h \
234  nasmlib.h nasm.h
235 output/outbin.$(O): output/outbin.c labels.h eval.h regs.h outform.h \
236  config.h version.h nasmlib.h nasm.h stdscan.h
237 output/outcoff.$(O): output/outcoff.c regs.h outform.h config.h version.h \
238  nasmlib.h nasm.h
239 output/outdbg.$(O): output/outdbg.c regs.h outform.h config.h version.h \
240  nasmlib.h nasm.h
241 output/outelf32.$(O): output/outelf32.c regs.h outform.h config.h version.h \
242  nasmlib.h nasm.h stdscan.h
243 output/outelf64.$(O): output/outelf64.c regs.h outform.h config.h version.h \
244  nasmlib.h nasm.h stdscan.h
245 output/outieee.$(O): output/outieee.c regs.h outform.h config.h version.h \
246  nasmlib.h nasm.h
247 output/outmacho.$(O): output/outmacho.c compiler.h regs.h outform.h config.h \
248  version.h nasmlib.h nasm.h
249 output/outobj.$(O): output/outobj.c regs.h outform.h config.h version.h \
250  nasmlib.h nasm.h stdscan.h
251 output/outrdf.$(O): output/outrdf.c regs.h outform.h config.h version.h \
252  nasmlib.h nasm.h
253 output/outrdf2.$(O): output/outrdf2.c rdoff/rdoff.h regs.h outform.h \
254  config.h version.h nasmlib.h nasm.h
255 parser.$(O): parser.c insns.h parser.h float.h regs.h regflags.c config.h \
256  version.h nasmlib.h nasm.h stdscan.h insnsi.h
257 pptok.$(O): pptok.c
258 preproc.$(O): preproc.c preproc.h macros.c pptok.h regs.h config.h version.h \
259  nasmlib.h nasm.h
260 regdis.$(O): regdis.c
261 regflags.$(O): regflags.c
262 regs.$(O): regs.c
263 regvals.$(O): regvals.c
264 stdscan.$(O): stdscan.c insns.h regs.h config.h version.h nasmlib.h nasm.h \
265  stdscan.h insnsi.h
266 sync.$(O): sync.c sync.h
267 tokhash.$(O): tokhash.c insns.h regs.h config.h version.h nasm.h insnsi.h