Move version strings to a separate header
[nasm.git] / Mkfiles / msvc.mak
blob633df8d1f9bd893b94b88f8a636fbaa3e57b35a1
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 # This is typically done by opening the Visual Studio Command Prompt.
12 top_srcdir = .
13 srcdir = .
14 VPATH = .
15 prefix = C:\Program Files\NASM
16 exec_prefix = $(prefix)
17 bindir = $(prefix)/bin
18 mandir = $(prefix)/man
20 !IF "$(DEBUG)" == "1"
21 CFLAGS = /Od /Zi
22 LDFLAGS = /DEBUG
23 !ELSE
24 CFLAGS = /O2
25 !ENDIF
27 CC = cl
28 LD = link
29 CFLAGS = $(CFLAGS) /W2
30 BUILD_CFLAGS = $(CFLAGS) /I$(srcdir)/inttypes
31 INTERNAL_CFLAGS = /I$(srcdir) /I. \
32 /DHAVE__SNPRINTF /DHAVE__VSNPRINTF /DHAVE__FULLPATH
33 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
34 LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE
35 LIBS =
36 PERL = perl -I$(srcdir)/perllib
38 # Binary suffixes
39 O = obj
40 X = .exe
42 .SUFFIXES: .c .i .s .$(O) .1 .man
44 .c.obj:
45 $(CC) /c $(ALL_CFLAGS) /Fo$@ $<
47 #-- Begin File Lists --#
48 # Edit in Makefile.in, not here!
49 NASM = nasm.$(O) \
50 raa.$(O) saa.$(O) rbtree.$(O) \
51 float.$(O) insnsa.$(O) insnsb.$(O) \
52 directiv.$(O) \
53 assemble.$(O) labels.$(O) hashtbl.$(O) parser.$(O) \
54 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
55 output/nullout.$(O) \
56 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
57 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
58 output/outelfx32.$(O) \
59 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
60 output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
61 output/codeview.$(O) \
62 preproc.$(O) quote.$(O) pptok.$(O) \
63 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
64 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) \
65 preproc-nop.$(O) \
66 disp8.$(O) \
67 iflag.$(O)
69 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) \
70 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) \
71 disp8.$(O) iflag.$(O)
73 LIBOBJ = lib/snprintf.$(O) lib/vsnprintf.$(O) lib/strlcpy.$(O) \
74 lib/nasmlib.$(O) lib/ver.$(O) \
75 lib/file.$(O) lib/realpath.$(O) \
76 lib/ilog2.$(O) lib/md5c.$(O) lib/crc64.$(O)
77 #-- End File Lists --#
79 all: nasm$(X) ndisasm$(X)
80 rem cd rdoff && $(MAKE) all
82 nasm$(X): $(NASM)
83 $(LD) $(LDFLAGS) /OUT:nasm$(X) $(NASM) $(LIBS)
85 ndisasm$(X): $(NDISASM)
86 $(LD) $(LDFLAGS) /OUT:ndisasm$(X) $(NDISASM) $(LIBS)
88 # These source files are automagically generated from a single
89 # instruction-table file by a Perl script. They're distributed,
90 # though, so it isn't necessary to have Perl just to recompile NASM
91 # from the distribution.
93 insns.pl: insns-iflags.pl
95 INSDEP = insns.dat insns.pl insns-iflags.pl
97 iflag.c: $(INSDEP)
98 $(PERL) $(srcdir)/insns.pl -fc $(srcdir)/insns.dat
99 iflaggen.h: $(INSDEP)
100 $(PERL) $(srcdir)/insns.pl -fh $(srcdir)/insns.dat
101 insnsb.c: $(INSDEP)
102 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
103 insnsa.c: $(INSDEP)
104 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
105 insnsd.c: $(INSDEP)
106 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
107 insnsi.h: $(INSDEP)
108 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
109 insnsn.c: $(INSDEP)
110 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
112 # These files contains all the standard macros that are derived from
113 # the version number.
114 version.h: version version.pl
115 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
117 version.mac: version version.pl
118 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
120 # This source file is generated from the standard macros file
121 # `standard.mac' by another Perl script. Again, it's part of the
122 # standard distribution.
124 macros.c: macros.pl pptok.ph standard.mac version.mac \
125 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
126 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
127 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
129 # These source files are generated from regs.dat by yet another
130 # perl script.
131 regs.c: regs.dat regs.pl
132 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
133 regflags.c: regs.dat regs.pl
134 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
135 regdis.c: regs.dat regs.pl
136 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
137 regdis.h: regs.dat regs.pl
138 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
139 regvals.c: regs.dat regs.pl
140 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
141 regs.h: regs.dat regs.pl
142 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
144 # Assembler token hash
145 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
146 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
147 $(srcdir)/tokens.dat > tokhash.c
149 # Assembler token metadata
150 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
151 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
152 $(srcdir)/tokens.dat > tokens.h
154 # Preprocessor token hash
155 pptok.h: pptok.dat pptok.pl perllib/phash.ph
156 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
157 pptok.c: pptok.dat pptok.pl perllib/phash.ph
158 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
159 pptok.ph: pptok.dat pptok.pl perllib/phash.ph
160 $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
162 # Directives hash
163 directiv.h: directiv.dat directiv.pl perllib/phash.ph
164 $(PERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
165 directiv.c: directiv.dat directiv.pl perllib/phash.ph
166 $(PERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
168 # This target generates all files that require perl.
169 # This allows easier generation of distribution (see dist target).
170 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
171 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
172 version.h version.mac pptok.h pptok.c iflag.c iflag.h
173 perlreq: $(PERLREQ)
175 clean:
176 -del /f *.$(O)
177 -del /f *.s
178 -del /f *.i
179 -del /f lib\*.$(O)
180 -del /f lib\*.s
181 -del /f lib\*.i
182 -del /f output\*.$(O)
183 -del /f output\*.s
184 -del /f output\*.i
185 -del /f nasm$(X)
186 -del /f ndisasm$(X)
187 rem cd rdoff && $(MAKE) clean
189 distclean: clean
190 -del /f config.h
191 -del /f config.log
192 -del /f config.status
193 -del /f Makefile
194 -del /f *~
195 -del /f *.bak
196 -del /f *.lst
197 -del /f *.bin
198 -del /f output\*~
199 -del /f output\*.bak
200 -del /f test\*.lst
201 -del /f test\*.bin
202 -del /f test\*.$(O)
203 -del /f test\*.bin
204 -del /f/s autom4te*.cache
205 rem cd rdoff && $(MAKE) distclean
207 cleaner: clean
208 -del /f $(PERLREQ)
209 -del /f *.man
210 -del /f nasm.spec
211 rem cd doc && $(MAKE) clean
213 spotless: distclean cleaner
214 -del /f doc\Makefile
215 -del doc\*~
216 -del doc\*.bak
218 strip:
220 rdf:
221 # cd rdoff && $(MAKE)
223 doc:
224 # cd doc && $(MAKE) all
226 everything: all doc rdf
228 #-- Magic hints to mkdep.pl --#
229 # @object-ending: ".$(O)"
230 # @path-separator: "/"
231 # @exclude: "config.h"
232 #-- Everything below is generated by mkdep.pl - do not edit --#
233 assemble.$(O): assemble.c assemble.h compiler.h directiv.h disp8.h iflag.h \
234 iflaggen.h insns.h insnsi.h listing.h nasm.h nasmlib.h opflags.h pptok.h \
235 preproc.h regs.h tables.h tokens.h
236 directiv.$(O): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
237 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
238 disasm.$(O): disasm.c compiler.h directiv.h disasm.h disp8.h iflag.h \
239 iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h \
240 regdis.h regs.h sync.h tables.h tokens.h
241 disp8.$(O): disp8.c compiler.h directiv.h disp8.h insnsi.h nasm.h nasmlib.h \
242 opflags.h pptok.h preproc.h regs.h tables.h
243 eval.$(O): eval.c compiler.h directiv.h eval.h float.h insnsi.h labels.h \
244 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
245 exprlib.$(O): exprlib.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
246 opflags.h pptok.h preproc.h regs.h tables.h
247 float.$(O): float.c compiler.h directiv.h float.h insnsi.h nasm.h nasmlib.h \
248 opflags.h pptok.h preproc.h regs.h tables.h
249 hashtbl.$(O): hashtbl.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
250 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
251 iflag.$(O): iflag.c compiler.h iflag.h iflaggen.h
252 insnsa.$(O): insnsa.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
253 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
254 tokens.h
255 insnsb.$(O): insnsb.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
256 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
257 tokens.h
258 insnsd.$(O): insnsd.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
259 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
260 tokens.h
261 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
262 labels.$(O): labels.c compiler.h directiv.h hashtbl.h insnsi.h labels.h \
263 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
264 lib/crc64.$(O): lib/crc64.c compiler.h hashtbl.h nasmlib.h
265 lib/file.$(O): lib/file.c compiler.h nasmlib.h
266 lib/ilog2.$(O): lib/ilog2.c compiler.h nasmlib.h
267 lib/md5c.$(O): lib/md5c.c compiler.h md5.h
268 lib/nasmlib.$(O): lib/nasmlib.c compiler.h directiv.h iflag.h iflaggen.h \
269 insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
270 tables.h tokens.h
271 lib/realpath.$(O): lib/realpath.c compiler.h nasmlib.h
272 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
273 lib/strlcpy.$(O): lib/strlcpy.c compiler.h
274 lib/ver.$(O): lib/ver.c ver.h version.h
275 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
276 listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
277 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
278 macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
279 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
280 nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
281 iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
282 output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
283 tables.h tokens.h ver.h
284 ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
285 insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
286 tables.h tokens.h ver.h
287 output/codeview.$(O): output/codeview.c compiler.h directiv.h insnsi.h md5.h \
288 nasm.h nasmlib.h opflags.h output/outlib.h output/pecoff.h pptok.h \
289 preproc.h regs.h saa.h tables.h version.h
290 output/nulldbg.$(O): output/nulldbg.c compiler.h directiv.h insnsi.h nasm.h \
291 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
292 output/nullout.$(O): output/nullout.c compiler.h directiv.h insnsi.h nasm.h \
293 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
294 output/outaout.$(O): output/outaout.c compiler.h directiv.h eval.h insnsi.h \
295 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
296 preproc.h raa.h regs.h saa.h stdscan.h tables.h
297 output/outas86.$(O): output/outas86.c compiler.h directiv.h insnsi.h nasm.h \
298 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
299 raa.h regs.h saa.h tables.h
300 output/outbin.$(O): output/outbin.c compiler.h directiv.h eval.h insnsi.h \
301 labels.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
302 pptok.h preproc.h regs.h saa.h stdscan.h tables.h
303 output/outcoff.$(O): output/outcoff.c compiler.h directiv.h eval.h insnsi.h \
304 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h output/pecoff.h \
305 pptok.h preproc.h raa.h regs.h saa.h tables.h
306 output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
307 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
308 output/outelf.$(O): output/outelf.c compiler.h directiv.h insnsi.h nasm.h \
309 nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
310 output/outform.h pptok.h preproc.h rbtree.h regs.h saa.h tables.h
311 output/outelf32.$(O): output/outelf32.c compiler.h directiv.h eval.h \
312 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
313 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
314 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
315 output/outelf64.$(O): output/outelf64.c compiler.h directiv.h eval.h \
316 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
317 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
318 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
319 output/outelfx32.$(O): output/outelfx32.c compiler.h directiv.h eval.h \
320 insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
321 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
322 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
323 output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
324 nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
325 output/outieee.$(O): output/outieee.c compiler.h directiv.h insnsi.h nasm.h \
326 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
327 regs.h tables.h ver.h
328 output/outlib.$(O): output/outlib.c compiler.h directiv.h insnsi.h nasm.h \
329 nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
330 output/outmacho.$(O): output/outmacho.c compiler.h directiv.h insnsi.h \
331 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
332 preproc.h raa.h rbtree.h regs.h saa.h tables.h
333 output/outobj.$(O): output/outobj.c compiler.h directiv.h eval.h insnsi.h \
334 nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
335 preproc.h regs.h stdscan.h tables.h ver.h
336 output/outrdf2.$(O): output/outrdf2.c compiler.h directiv.h insnsi.h nasm.h \
337 nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
338 rdoff/rdoff.h regs.h saa.h tables.h
339 parser.$(O): parser.c compiler.h directiv.h eval.h float.h iflag.h \
340 iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h \
341 preproc.h regs.h stdscan.h tables.h tokens.h
342 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
343 preproc-nop.$(O): preproc-nop.c compiler.h directiv.h insnsi.h listing.h \
344 nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
345 preproc.$(O): preproc.c compiler.h directiv.h eval.h hashtbl.h insnsi.h \
346 listing.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
347 stdscan.h tables.h tokens.h
348 quote.$(O): quote.c compiler.h nasmlib.h quote.h
349 raa.$(O): raa.c compiler.h nasmlib.h raa.h
350 rbtree.$(O): rbtree.c compiler.h rbtree.h
351 regdis.$(O): regdis.c regdis.h regs.h
352 regflags.$(O): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
353 opflags.h pptok.h preproc.h regs.h tables.h
354 regs.$(O): regs.c compiler.h insnsi.h tables.h
355 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
356 saa.$(O): saa.c compiler.h nasmlib.h saa.h
357 stdscan.$(O): stdscan.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
358 insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
359 stdscan.h tables.h tokens.h
360 strfunc.$(O): strfunc.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
361 opflags.h pptok.h preproc.h regs.h tables.h
362 sync.$(O): sync.c compiler.h nasmlib.h sync.h
363 tokhash.$(O): tokhash.c compiler.h directiv.h hashtbl.h iflag.h iflaggen.h \
364 insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
365 stdscan.h tables.h tokens.h