3 # Makefile for building NASM using Microsoft Visual C++ and NMAKE.
4 # Tested on Microsoft Visual C++ 2005 Express Edition.
6 # Make sure to put the appropriate directories in your PATH, in
7 # the case of MSVC++ 2005, they are ...\VC\bin and ...\Common7\IDE.
12 prefix = C:\Program Files\NASM
13 exec_prefix = $(prefix)
14 bindir = $(prefix)/bin
15 mandir = $(prefix)/man
18 CFLAGS = /O2 /Ox /Oy /W2
19 BUILD_CFLAGS = $(CFLAGS) /I$(srcdir)/inttypes
20 INTERNAL_CFLAGS = /I$(srcdir) /I. /DHAVE__SNPRINTF /DHAVE__VSNPRINTF
21 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
24 PERL = perl -I$(srcdir)/perllib
30 .SUFFIXES: .c .i .s .$(O) .1 .man
33 $(CC) /c $(ALL_CFLAGS) /Fo$@ $<
35 #-- Begin File Lists --#
36 # Edit in Makefile.in, not here!
37 NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \
38 raa.$(O) saa.$(O) rbtree.$(O) \
39 float.$(O) insnsa.$(O) insnsb.$(O) \
41 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
42 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
44 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
45 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
46 output/outelfx32.$(O) \
47 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
48 output/outdbg.$(O) output/outieee.$(O) output/outmac32.$(O) \
49 output/outmac64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
50 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
51 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) \
58 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
59 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) \
61 #-- End File Lists --#
63 all: nasm$(X) ndisasm$(X)
64 rem cd rdoff && $(MAKE) all
67 $(CC) $(LDFLAGS) /Fenasm$(X) $(NASM) $(LIBS)
69 ndisasm$(X): $(NDISASM)
70 $(CC) $(LDFLAGS) /Fendisasm$(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 insns.pl: insns-iflags.pl
79 iflag.c iflag.h: insns.dat insns.pl
80 $(PERL) $(srcdir)/insns.pl -t $(srcdir)/insns.dat
81 insnsb.c: insns.dat insns.pl
82 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
83 insnsa.c: insns.dat insns.pl
84 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
85 insnsd.c: insns.dat insns.pl
86 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
87 insnsi.h: insns.dat insns.pl
88 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
89 insnsn.c: insns.dat insns.pl
90 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
92 # These files contains all the standard macros that are derived from
94 version.h: version version.pl
95 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
97 version.mac: version version.pl
98 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
100 # This source file is generated from the standard macros file
101 # `standard.mac' by another Perl script. Again, it's part of the
102 # standard distribution.
104 macros.c: macros.pl pptok.ph standard.mac version.mac \
105 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
106 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
107 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
109 # These source files are generated from regs.dat by yet another
111 regs.c: regs.dat regs.pl
112 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
113 regflags.c: regs.dat regs.pl
114 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
115 regdis.c: regs.dat regs.pl
116 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
117 regdis.h: regs.dat regs.pl
118 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
119 regvals.c: regs.dat regs.pl
120 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
121 regs.h: regs.dat regs.pl
122 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
124 # Assembler token hash
125 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
126 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
127 $(srcdir)/tokens.dat > tokhash.c
129 # Assembler token metadata
130 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
131 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
132 $(srcdir)/tokens.dat > tokens.h
134 # Preprocessor token hash
135 pptok.h: pptok.dat pptok.pl perllib/phash.ph
136 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
137 pptok.c: pptok.dat pptok.pl perllib/phash.ph
138 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
139 pptok.ph: pptok.dat pptok.pl perllib/phash.ph
140 $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
143 directiv.h: directiv.dat directiv.pl perllib/phash.ph
144 $(PERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
145 directiv.c: directiv.dat directiv.pl perllib/phash.ph
146 $(PERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
148 # This target generates all files that require perl.
149 # This allows easier generation of distribution (see dist target).
150 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
151 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
152 version.h version.mac pptok.h pptok.c iflag.c iflag.h
162 -del /f output\*.$(O)
167 rem cd rdoff && $(MAKE) clean
172 -del /f config.status
184 -del /f/s autom4te*.cache
185 rem cd rdoff && $(MAKE) distclean
191 rem cd doc && $(MAKE) clean
193 spotless: distclean cleaner
201 # cd rdoff && $(MAKE)
204 # cd doc && $(MAKE) all
206 everything: all doc rdf
208 #-- Magic hints to mkdep.pl --#
209 # @object-ending: ".$(O)"
210 # @path-separator: "/"
211 # @exclude: "config.h"
212 #-- Everything below is generated by mkdep.pl - do not edit --#
213 assemble.$(O): assemble.c assemble.h compiler.h directiv.h disp8.h iflag.h \
214 insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
216 crc64.$(O): crc64.c compiler.h nasmlib.h
217 directiv.$(O): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
218 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
219 disasm.$(O): disasm.c compiler.h directiv.h disasm.h disp8.h iflag.h insns.h \
220 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regdis.h regs.h \
221 sync.h tables.h tokens.h
222 disp8.$(O): disp8.c compiler.h directiv.h disp8.h insnsi.h nasm.h nasmlib.h \
223 opflags.h pptok.h preproc.h regs.h tables.h
224 eval.$(O): eval.c compiler.h directiv.h eval.h float.h insnsi.h labels.h \
225 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
226 exprlib.$(O): exprlib.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
227 opflags.h pptok.h preproc.h regs.h tables.h
228 float.$(O): float.c compiler.h directiv.h float.h insnsi.h nasm.h nasmlib.h \
229 opflags.h pptok.h preproc.h regs.h tables.h
230 hashtbl.$(O): hashtbl.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
231 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
232 iflag.$(O): iflag.c compiler.h iflag.h
233 ilog2.$(O): ilog2.c compiler.h nasmlib.h
234 insnsa.$(O): insnsa.c compiler.h directiv.h iflag.h insns.h insnsi.h nasm.h \
235 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h tokens.h
236 insnsb.$(O): insnsb.c compiler.h directiv.h iflag.h insns.h insnsi.h nasm.h \
237 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h tokens.h
238 insnsd.$(O): insnsd.c compiler.h directiv.h iflag.h insns.h insnsi.h nasm.h \
239 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h tokens.h
240 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
241 labels.$(O): labels.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
242 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
243 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
244 lib/strlcpy.$(O): lib/strlcpy.c compiler.h
245 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
246 listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
247 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
248 macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
249 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
250 nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
251 insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
252 output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
254 nasmlib.$(O): nasmlib.c compiler.h directiv.h iflag.h insns.h insnsi.h \
255 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h tokens.h
256 ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h insns.h \
257 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
259 output/nulldbg.$(O): output/nulldbg.c compiler.h directiv.h insnsi.h nasm.h \
260 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
261 output/nullout.$(O): output/nullout.c compiler.h directiv.h insnsi.h nasm.h \
262 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
263 output/outaout.$(O): output/outaout.c compiler.h directiv.h eval.h insnsi.h \
264 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
265 preproc.h raa.h regs.h saa.h stdscan.h tables.h
266 output/outas86.$(O): output/outas86.c compiler.h directiv.h insnsi.h nasm.h \
267 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
268 raa.h regs.h saa.h tables.h
269 output/outbin.$(O): output/outbin.c compiler.h directiv.h eval.h insnsi.h \
270 labels.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
271 pptok.h preproc.h regs.h saa.h stdscan.h tables.h
272 output/outcoff.$(O): output/outcoff.c compiler.h directiv.h eval.h insnsi.h \
273 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h output/pecoff.h \
274 pptok.h preproc.h raa.h regs.h saa.h tables.h
275 output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
276 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
277 output/outelf.$(O): output/outelf.c compiler.h directiv.h insnsi.h nasm.h \
278 nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
279 output/outform.h pptok.h preproc.h regs.h tables.h
280 output/outelf32.$(O): output/outelf32.c compiler.h directiv.h eval.h \
281 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
282 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
283 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h
284 output/outelf64.$(O): output/outelf64.c compiler.h directiv.h eval.h \
285 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
286 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
287 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h
288 output/outelfx32.$(O): output/outelfx32.c compiler.h directiv.h eval.h \
289 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
290 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
291 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h
292 output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
293 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
294 output/outieee.$(O): output/outieee.c compiler.h directiv.h insnsi.h nasm.h \
295 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
297 output/outlib.$(O): output/outlib.c compiler.h directiv.h insnsi.h nasm.h \
298 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
299 output/outmac32.$(O): output/outmac32.c compiler.h directiv.h eval.h \
300 insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
301 pptok.h preproc.h raa.h regs.h saa.h tables.h
302 output/outmac64.$(O): output/outmac64.c compiler.h directiv.h insnsi.h \
303 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
304 preproc.h raa.h regs.h saa.h tables.h
305 output/outobj.$(O): output/outobj.c compiler.h directiv.h eval.h insnsi.h \
306 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
307 preproc.h regs.h stdscan.h tables.h
308 output/outrdf2.$(O): output/outrdf2.c compiler.h directiv.h insnsi.h nasm.h \
309 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
310 rdoff/rdoff.h regs.h saa.h tables.h
311 parser.$(O): parser.c compiler.h directiv.h eval.h float.h iflag.h insns.h \
312 insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h preproc.h regs.h \
313 stdscan.h tables.h tokens.h
314 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
315 preproc-nop.$(O): preproc-nop.c compiler.h directiv.h insnsi.h nasm.h \
316 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
317 preproc.$(O): preproc.c compiler.h directiv.h eval.h hashtbl.h insnsi.h \
318 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
320 quote.$(O): quote.c compiler.h nasmlib.h quote.h
321 raa.$(O): raa.c compiler.h nasmlib.h raa.h
322 rbtree.$(O): rbtree.c compiler.h rbtree.h
323 regdis.$(O): regdis.c regdis.h regs.h
324 regflags.$(O): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
325 opflags.h pptok.h preproc.h regs.h tables.h
326 regs.$(O): regs.c compiler.h insnsi.h tables.h
327 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
328 saa.$(O): saa.c compiler.h nasmlib.h saa.h
329 stdscan.$(O): stdscan.c compiler.h directiv.h iflag.h insns.h insnsi.h \
330 nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
332 strfunc.$(O): strfunc.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
333 opflags.h pptok.h preproc.h regs.h tables.h
334 sync.$(O): sync.c compiler.h nasmlib.h sync.h
335 tokhash.$(O): tokhash.c compiler.h directiv.h hashtbl.h iflag.h insns.h \
336 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
338 ver.$(O): ver.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h opflags.h \
339 pptok.h preproc.h regs.h tables.h version.h