3 # Auto-configuring Makefile for the Netwide Assembler.
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.
13 exec_prefix = @exec_prefix@
19 BUILD_CFLAGS = $(CFLAGS) @DEFS@
20 INTERNAL_CFLAGS = -I$(srcdir) -I.
21 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
27 INSTALL_PROGRAM = @INSTALL_PROGRAM@
28 INSTALL_DATA = @INSTALL_DATA@
36 .SUFFIXES: .c .i .s .$(O) .1 .man
38 .PHONY: all doc rdf install clean distclean cleaner spotless install_rdf
39 .PHONY: install_doc everything install_everything strip perlreq dist
42 $(CC) -c $(ALL_CFLAGS) -o $@ $<
45 $(CC) -S $(ALL_CFLAGS) -o $@ $<
48 $(CC) -E $(ALL_CFLAGS) -o $@ $<
53 NASM = nasm.$(O) nasmlib.$(O) float.$(O) insnsa.$(O) assemble.$(O) \
54 labels.$(O) parser.$(O) outform.$(O) output/outbin.$(O) \
55 output/outaout.$(O) output/outcoff.$(O) \
56 output/outelf32.$(O) output/outelf64.$(O) \
57 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
58 output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
59 preproc.$(O) listing.$(O) eval.$(O)
61 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) insnsd.$(O)
63 all: nasm$(X) ndisasm$(X) nasm.man ndisasm.man
64 cd rdoff && $(MAKE) all
67 $(CC) $(LDFLAGS) -o nasm$(X) $(NASM) $(LIBS)
69 ndisasm$(X): $(NDISASM)
70 $(CC) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(LIBS)
72 # These source files are automagically generated from a single
73 # instruction-table file by a Perl script. They're distributed,
74 # though, so it isn't necessary to have Perl just to recompile NASM
75 # from the distribution.
77 insnsa.c: insns.dat insns.pl
78 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
79 insnsd.c: insns.dat insns.pl
80 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
81 insnsi.h: insns.dat insns.pl
82 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
83 insnsn.c: insns.dat insns.pl
84 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
86 # These files contains all the standard macros that are derived from
88 version.h: version version.pl
89 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
91 version.mac: version version.pl
92 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
94 # This source file is generated from the standard macros file
95 # `standard.mac' by another Perl script. Again, it's part of the
96 # standard distribution.
98 macros.c: macros.pl standard.mac version.mac
99 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
101 # These source files are generated from regs.dat by yet another
103 regs.c: regs.dat regs.pl
104 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
105 regflags.c: regs.dat regs.pl
106 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
107 regdis.c: regs.dat regs.pl
108 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
109 regvals.c: regs.dat regs.pl
110 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
111 regs.h: regs.dat regs.pl
112 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
114 # This target generates all files that require perl.
115 # This allows easier generation of distribution (see dist target).
116 PERLREQ = macros.c insnsa.c insnsd.c insnsi.h insnsn.c \
117 regs.c regs.h regflags.c regdis.c regvals.c \
118 version.h version.mac
121 install: nasm$(X) ndisasm$(X)
122 $(INSTALL_PROGRAM) nasm$(X) $(INSTALLROOT)$(bindir)/nasm$(X)
123 $(INSTALL_PROGRAM) ndisasm$(X) $(INSTALLROOT)$(bindir)/ndisasm$(X)
124 $(INSTALL_DATA) $(srcdir)/nasm.1 $(INSTALLROOT)$(mandir)/man1/nasm.1
125 $(INSTALL_DATA) $(srcdir)/ndisasm.1 $(INSTALLROOT)$(mandir)/man1/ndisasm.1
129 rm -f output/*.$(O) output/*.s output/*.i
130 rm -f nasm$(X) ndisasm$(X)
131 cd rdoff && $(MAKE) clean
134 rm -f config.h config.log config.status
135 rm -f Makefile *~ *.bak *.lst *.bin
136 rm -f output/*~ output/*.bak
137 rm -f test/*.lst test/*.bin test/*.$(O) test/*.bin
138 rm -rf autom4te*.cache
139 cd rdoff && $(MAKE) distclean
142 rm -f $(PERLREQ) *.man nasm.spec
143 cd doc && $(MAKE) clean
145 spotless: distclean cleaner
146 rm -f doc/Makefile doc/*~ doc/*.bak
149 strip --strip-unneeded nasm$(X) ndisasm$(X)
154 rdf_install install_rdf:
155 cd rdoff && $(MAKE) install
158 cd doc && $(MAKE) all
160 doc_install install_doc:
161 cd doc && $(MAKE) install
163 everything: all doc rdf
165 install_everything: everything install install_doc install_rdf
167 dist: spotless perlreq spec
170 rm -rf ./autom4te*.cache
173 tar cvjf ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 ../`./nasm-dir`
177 nasm.spec: nasm.spec.in version version.pl
178 sed -e s/@@VERSION@@/`cat $(srcdir)/version`/g \
179 -e s/@@ID@@/`$(PERL) $(srcdir)/version.pl id < $(srcdir)/version`/g \
180 < nasm.spec.in > nasm.spec
186 # This build dependencies in *ALL* makefiles. Partially for that reason,
187 # it's expected to be invoked manually.
190 $(PERL) mkdep.pl -M Makefile.in Mkfiles/Makefile.* -- \
194 #-- Magic hints to mkdep.pl --#
195 # @object-ending: ".$(O)"
196 # @path-separator: "/"
197 #-- Everything below is generated by mkdep.pl - do not edit --#
198 assemble.$(O): assemble.c preproc.h insns.h regs.h regflags.c config.h \
199 version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
200 disasm.$(O): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
201 version.h nasm.h insnsn.c names.c insnsi.h disasm.h
202 eval.$(O): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h
203 float.$(O): float.c regs.h config.h version.h nasm.h
204 insnsa.$(O): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
205 insnsd.$(O): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
206 insnsn.$(O): insnsn.c
207 labels.$(O): labels.c regs.h config.h version.h nasmlib.h nasm.h
208 listing.$(O): listing.c regs.h config.h version.h nasmlib.h nasm.h listing.h
209 macros.$(O): macros.c
210 names.$(O): names.c regs.c insnsn.c
211 nasm.$(O): nasm.c labels.h preproc.h insns.h parser.h eval.h regs.h \
212 outform.h config.h version.h nasmlib.h nasm.h assemble.h insnsi.h listing.h
213 nasmlib.$(O): nasmlib.c insns.h regs.h config.h regs.c version.h nasmlib.h \
214 nasm.h insnsn.c names.c insnsi.h
215 ndisasm.$(O): ndisasm.c insns.h sync.h regs.h config.h version.h nasmlib.h \
216 nasm.h insnsi.h disasm.h
217 outform.$(O): outform.c regs.h config.h outform.h version.h nasm.h
218 output/outaout.$(O): output/outaout.c regs.h outform.h config.h version.h \
220 output/outas86.$(O): output/outas86.c regs.h outform.h config.h version.h \
222 output/outbin.$(O): output/outbin.c labels.h eval.h regs.h outform.h \
223 config.h version.h nasmlib.h nasm.h
224 output/outcoff.$(O): output/outcoff.c regs.h outform.h config.h version.h \
226 output/outdbg.$(O): output/outdbg.c regs.h outform.h config.h version.h \
228 output/outelf32.$(O): output/outelf32.c regs.h outform.h config.h version.h \
230 output/outelf64.$(O): output/outelf64.c regs.h outform.h config.h version.h \
232 output/outieee.$(O): output/outieee.c regs.h outform.h config.h version.h \
234 output/outmacho.$(O): output/outmacho.c compiler.h regs.h outform.h config.h \
235 version.h nasmlib.h nasm.h
236 output/outobj.$(O): output/outobj.c regs.h outform.h config.h version.h \
238 output/outrdf.$(O): output/outrdf.c regs.h outform.h config.h version.h \
240 output/outrdf2.$(O): output/outrdf2.c rdoff/rdoff.h regs.h outform.h \
241 config.h version.h nasmlib.h nasm.h
242 parser.$(O): parser.c insns.h parser.h float.h regs.h regflags.c config.h \
243 version.h nasmlib.h nasm.h insnsi.h
244 preproc.$(O): preproc.c macros.c regs.h config.h version.h nasmlib.h nasm.h
245 regdis.$(O): regdis.c
246 regflags.$(O): regflags.c
248 regvals.$(O): regvals.c
249 sync.$(O): sync.c sync.h