changes.src: document POPCNT fix.
[nasm.git] / Mkfiles / msvc.mak
blob21b52bcc6ba504b954aaaebaf47aa8ee3571164d
1 # -*- makefile -*-
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.
9 top_srcdir = .
10 srcdir = .
11 VPATH = .
12 prefix = C:\Program Files\NASM
13 exec_prefix = $(prefix)
14 bindir = $(prefix)/bin
15 mandir = $(prefix)/man
17 CC = cl
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)
22 LDFLAGS =
23 LIBS =
24 PERL = perl -I$(srcdir)/perllib
26 # Binary suffixes
27 O = obj
28 X = .exe
30 .SUFFIXES: .c .i .s .$(O) .1 .man
32 .c.obj:
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) \
40 assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
41 outform.$(O) outlib.$(O) output/outbin.$(O) \
42 output/outaout.$(O) output/outcoff.$(O) \
43 output/outelf32.$(O) output/outelf64.$(O) \
44 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
45 output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
46 preproc.$(O) quote.$(O) pptok.$(O) macros.$(O) \
47 listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) strfunc.$(O) \
48 tokhash.$(O) regvals.$(O) regflags.$(O)
50 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
51 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
52 #-- End File Lists --#
54 all: nasm$(X) ndisasm$(X)
55 rem cd rdoff && $(MAKE) all
57 nasm$(X): $(NASM)
58 $(CC) $(LDFLAGS) /Fenasm$(X) $(NASM) $(LIBS)
60 ndisasm$(X): $(NDISASM)
61 $(CC) $(LDFLAGS) /Fendisasm$(X) $(NDISASM) $(LIBS)
63 # These source files are automagically generated from a single
64 # instruction-table file by a Perl script. They're distributed,
65 # though, so it isn't necessary to have Perl just to recompile NASM
66 # from the distribution.
68 insnsb.c: insns.dat insns.pl
69 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
70 insnsa.c: insns.dat insns.pl
71 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
72 insnsd.c: insns.dat insns.pl
73 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
74 insnsi.h: insns.dat insns.pl
75 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
76 insnsn.c: insns.dat insns.pl
77 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
79 # These files contains all the standard macros that are derived from
80 # the version number.
81 version.h: version version.pl
82 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
84 version.mac: version version.pl
85 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
87 # This source file is generated from the standard macros file
88 # `standard.mac' by another Perl script. Again, it's part of the
89 # standard distribution.
91 macros.c: macros.pl standard.mac version.mac
92 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
94 # These source files are generated from regs.dat by yet another
95 # perl script.
96 regs.c: regs.dat regs.pl
97 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
98 regflags.c: regs.dat regs.pl
99 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
100 regdis.c: regs.dat regs.pl
101 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
102 regvals.c: regs.dat regs.pl
103 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
104 regs.h: regs.dat regs.pl
105 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
107 # Assembler token hash
108 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
109 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
110 $(srcdir)/tokens.dat > tokhash.c
112 # Assembler token metadata
113 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
114 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
115 $(srcdir)/tokens.dat > tokens.h
117 # Preprocessor token hash
118 pptok.h: pptok.dat pptok.pl perllib/phash.ph
119 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
120 pptok.c: pptok.dat pptok.pl perllib/phash.ph
121 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
123 # This target generates all files that require perl.
124 # This allows easier generation of distribution (see dist target).
125 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
126 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
127 version.h version.mac pptok.h pptok.c
128 perlreq: $(PERLREQ)
130 clean:
131 -del /f *.$(O)
132 -del /f *.s
133 -del /f *.i
134 -del /f output\*.$(O)
135 -del /f output\*.s
136 -del /f output\*.i
137 -del /f nasm$(X)
138 -del /f ndisasm$(X)
139 rem cd rdoff && $(MAKE) clean
141 distclean: clean
142 -del /f config.h
143 -del /f config.log
144 -del /f config.status
145 -del /f Makefile
146 -del /f *~
147 -del /f *.bak
148 -del /f *.lst
149 -del /f *.bin
150 -del /f output\*~
151 -del /f output\*.bak
152 -del /f test\*.lst
153 -del /f test\*.bin
154 -del /f test\*.$(O)
155 -del /f test\*.bin
156 -del /f/s autom4te*.cache
157 rem cd rdoff && $(MAKE) distclean
159 cleaner: clean
160 -del /f $(PERLREQ)
161 -del /f *.man
162 -del /f nasm.spec
163 rem cd doc && $(MAKE) clean
165 spotless: distclean cleaner
166 -del /f doc\Makefile
167 -del doc\*~
168 -del doc\*.bak
170 strip:
172 rdf:
173 # cd rdoff && $(MAKE)
175 doc:
176 # cd doc && $(MAKE) all
178 everything: all doc rdf
180 #-- Magic hints to mkdep.pl --#
181 # @object-ending: ".$(O)"
182 # @path-separator: "/"
183 # @exclude: "config.h"
184 #-- Everything below is generated by mkdep.pl - do not edit --#
185 assemble.$(O): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h \
186 nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h
187 crc64.$(O): crc64.c compiler.h nasmlib.h
188 disasm.$(O): disasm.c compiler.h disasm.h insns.h insnsi.h nasm.h nasmlib.h \
189 pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
190 eval.$(O): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h \
191 nasmlib.h pptok.h preproc.h regs.h
192 exprlib.$(O): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h \
193 preproc.h regs.h
194 float.$(O): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h pptok.h \
195 preproc.h regs.h
196 hashtbl.$(O): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
197 pptok.h preproc.h regs.h
198 insnsa.$(O): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
199 preproc.h regs.h tokens.h
200 insnsb.$(O): insnsb.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
201 preproc.h regs.h tokens.h
202 insnsd.$(O): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
203 preproc.h regs.h tokens.h
204 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
205 labels.$(O): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h pptok.h \
206 preproc.h regs.h
207 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
208 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
209 listing.$(O): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
210 pptok.h preproc.h regs.h
211 macros.$(O): macros.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
212 outform.h pptok.h preproc.h regs.h tables.h
213 nasm.$(O): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
214 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
215 raa.h regs.h saa.h stdscan.h tokens.h
216 nasmlib.$(O): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
217 preproc.h regs.h tokens.h
218 ndisasm.$(O): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
219 nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
220 outform.$(O): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
221 pptok.h preproc.h regs.h
222 outlib.$(O): outlib.c compiler.h insnsi.h nasm.h nasmlib.h outlib.h pptok.h \
223 preproc.h regs.h
224 output/outaout.$(O): output/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
225 outform.h outlib.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h
226 output/outas86.$(O): output/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
227 outform.h outlib.h pptok.h preproc.h raa.h regs.h saa.h
228 output/outbin.$(O): output/outbin.c compiler.h eval.h insnsi.h labels.h \
229 nasm.h nasmlib.h outform.h outlib.h pptok.h preproc.h regs.h saa.h \
230 stdscan.h
231 output/outcoff.$(O): output/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
232 outform.h outlib.h pptok.h preproc.h raa.h regs.h saa.h
233 output/outdbg.$(O): output/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
234 outform.h pptok.h preproc.h regs.h
235 output/outelf32.$(O): output/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
236 outform.h outlib.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h
237 output/outelf64.$(O): output/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
238 outform.h outlib.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h
239 output/outieee.$(O): output/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
240 outform.h pptok.h preproc.h regs.h
241 output/outmacho.$(O): output/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
242 outform.h outlib.h pptok.h preproc.h raa.h regs.h saa.h
243 output/outobj.$(O): output/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
244 outform.h pptok.h preproc.h regs.h stdscan.h
245 output/outrdf.$(O): output/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
246 outform.h pptok.h preproc.h regs.h
247 output/outrdf2.$(O): output/outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h \
248 outform.h pptok.h preproc.h rdoff/rdoff.h regs.h saa.h
249 parser.$(O): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h \
250 parser.h pptok.h preproc.h regs.h stdscan.h tables.h tokens.h
251 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
252 preproc.$(O): preproc.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
253 pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h
254 quote.$(O): quote.c compiler.h nasmlib.h quote.h
255 raa.$(O): raa.c compiler.h nasmlib.h raa.h
256 rbtree.$(O): rbtree.c compiler.h rbtree.h
257 regdis.$(O): regdis.c regdis.h regs.h
258 regflags.$(O): regflags.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h \
259 preproc.h regs.h tables.h
260 regs.$(O): regs.c compiler.h insnsi.h tables.h
261 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
262 saa.$(O): saa.c compiler.h nasmlib.h saa.h
263 stdscan.$(O): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h pptok.h \
264 preproc.h quote.h regs.h stdscan.h tokens.h
265 strfunc.$(O): strfunc.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h \
266 preproc.h regs.h
267 sync.$(O): sync.c compiler.h nasmlib.h sync.h
268 tokhash.$(O): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h \
269 nasmlib.h pptok.h preproc.h regs.h tokens.h
270 ver.$(O): ver.c compiler.h insnsi.h nasm.h nasmlib.h pptok.h preproc.h \
271 regs.h version.h