out: Elf32, Elfx32, Elf64 -- Rename unmergable routines
[nasm.git] / Mkfiles / msvc.mak
blobecd6c4b20a1c147fdb906a2daf3b47101bcf4915
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 /Zi
25 LDFLAGS = /DEBUG /OPT:REF /OPT:ICF # (latter two undoes /DEBUG harm)
26 !ENDIF
28 CC = cl
29 LD = link
30 AR = lib
31 CFLAGS = $(CFLAGS) /W2
32 BUILD_CFLAGS = $(CFLAGS) /I$(srcdir)/inttypes
33 INTERNAL_CFLAGS = /I$(srcdir) /I. \
34 /DHAVE__SNPRINTF /DHAVE__VSNPRINTF /DHAVE__FULLPATH
35 ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
36 LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE /RELEASE
37 LIBS =
38 PERL = perl -I$(srcdir)/perllib
40 # Binary suffixes
41 O = obj
42 A = lib
43 X = .exe
45 .SUFFIXES: .c .i .s .$(O) .$(A) .1 .man
47 .c.obj:
48 $(CC) /c $(ALL_CFLAGS) /Fo$@ $<
50 #-- Begin File Lists --#
51 # Edit in Makefile.in, not here!
52 NASM = nasm.$(O) \
53 raa.$(O) saa.$(O) rbtree.$(O) \
54 float.$(O) insnsa.$(O) insnsb.$(O) \
55 directiv.$(O) \
56 assemble.$(O) labels.$(O) hashtbl.$(O) parser.$(O) \
57 output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
58 output/nullout.$(O) \
59 output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
60 output/outelf.$(O) output/outelf32.$(O) output/outelf64.$(O) \
61 output/outelfx32.$(O) \
62 output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
63 output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
64 output/codeview.$(O) \
65 preproc.$(O) quote.$(O) pptok.$(O) \
66 macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
67 strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O) \
68 preproc-nop.$(O) \
69 disp8.$(O) \
70 iflag.$(O)
72 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) \
73 insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) \
74 disp8.$(O) iflag.$(O)
76 LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
77 nasmlib/nasmlib.$(O) nasmlib/ver.$(O) \
78 nasmlib/file.$(O) nasmlib/realpath.$(O) \
79 nasmlib/ilog2.$(O) nasmlib/md5c.$(O) nasmlib/crc64.$(O)
80 #-- End File Lists --#
82 all: nasm$(X) ndisasm$(X)
83 rem cd rdoff && $(MAKE) all
85 nasm$(X): $(NASM) nasm.$(A)
86 $(LD) $(LDFLAGS) /OUT:nasm$(X) $(NASM) $(LIBS) nasm.$(A)
88 ndisasm$(X): $(NDISASM) nasm.$(A)
89 $(LD) $(LDFLAGS) /OUT:ndisasm$(X) $(NDISASM) $(LIBS) nasm.$(A)
91 nasm.$(A): $(LIBOBJ)
92 $(AR) $(ARFLAGS) /OUT:$@ $**
94 # These source files are automagically generated from a single
95 # instruction-table file by a Perl script. They're distributed,
96 # though, so it isn't necessary to have Perl just to recompile NASM
97 # from the distribution.
99 insns.pl: insns-iflags.pl
101 INSDEP = insns.dat insns.pl insns-iflags.pl
103 iflag.c: $(INSDEP)
104 $(PERL) $(srcdir)/insns.pl -fc $(srcdir)/insns.dat
105 iflaggen.h: $(INSDEP)
106 $(PERL) $(srcdir)/insns.pl -fh $(srcdir)/insns.dat
107 insnsb.c: $(INSDEP)
108 $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
109 insnsa.c: $(INSDEP)
110 $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
111 insnsd.c: $(INSDEP)
112 $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
113 insnsi.h: $(INSDEP)
114 $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
115 insnsn.c: $(INSDEP)
116 $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
118 # These files contains all the standard macros that are derived from
119 # the version number.
120 version.h: version version.pl
121 $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
123 version.mac: version version.pl
124 $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
126 # This source file is generated from the standard macros file
127 # `standard.mac' by another Perl script. Again, it's part of the
128 # standard distribution.
130 macros.c: macros.pl pptok.ph standard.mac version.mac \
131 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
132 $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac \
133 $(srcdir)/macros/*.mac $(srcdir)/output/*.mac
135 # These source files are generated from regs.dat by yet another
136 # perl script.
137 regs.c: regs.dat regs.pl
138 $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
139 regflags.c: regs.dat regs.pl
140 $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
141 regdis.c: regs.dat regs.pl
142 $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
143 regdis.h: regs.dat regs.pl
144 $(PERL) $(srcdir)/regs.pl dh $(srcdir)/regs.dat > regdis.h
145 regvals.c: regs.dat regs.pl
146 $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
147 regs.h: regs.dat regs.pl
148 $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
150 # Assembler token hash
151 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
152 $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
153 $(srcdir)/tokens.dat > tokhash.c
155 # Assembler token metadata
156 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
157 $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
158 $(srcdir)/tokens.dat > tokens.h
160 # Preprocessor token hash
161 pptok.h: pptok.dat pptok.pl perllib/phash.ph
162 $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
163 pptok.c: pptok.dat pptok.pl perllib/phash.ph
164 $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
165 pptok.ph: pptok.dat pptok.pl perllib/phash.ph
166 $(PERL) $(srcdir)/pptok.pl ph $(srcdir)/pptok.dat pptok.ph
168 # Directives hash
169 directiv.h: directiv.dat directiv.pl perllib/phash.ph
170 $(PERL) $(srcdir)/directiv.pl h $(srcdir)/directiv.dat directiv.h
171 directiv.c: directiv.dat directiv.pl perllib/phash.ph
172 $(PERL) $(srcdir)/directiv.pl c $(srcdir)/directiv.dat directiv.c
174 # This target generates all files that require perl.
175 # This allows easier generation of distribution (see dist target).
176 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
177 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
178 version.h version.mac pptok.h pptok.c iflag.c iflaggen.h \
179 directiv.c directiv.h pptok.ph regdis.h
180 perlreq: $(PERLREQ)
182 clean:
183 -del /f *.$(O)
184 -del /f *.pdb
185 -del /f *.s
186 -del /f *.i
187 -del /f lib\*.$(O)
188 -del /f lib\*.pdb
189 -del /f lib\*.s
190 -del /f lib\*.i
191 -del /f output\*.$(O)
192 -del /f output\*.pdb
193 -del /f output\*.s
194 -del /f output\*.i
195 -del /f nasmlib\*.$(O)
196 -del /f nasmlib\*.pdb
197 -del /f nasmlib\*.s
198 -del /f nasmlib\*.i
199 -del /f stdlib\*.$(O)
200 -del /f stdlib\*.pdb
201 -del /f stdlib\*.s
202 -del /f stdlib\*.i
203 -del /f nasm.$(A)
204 -del /f nasm$(X)
205 -del /f ndisasm$(X)
206 rem cd rdoff && $(MAKE) clean
208 distclean: clean
209 -del /f config.h
210 -del /f config.log
211 -del /f config.status
212 -del /f Makefile
213 -del /f *~
214 -del /f *.bak
215 -del /f *.lst
216 -del /f *.bin
217 -del /f output\*~
218 -del /f output\*.bak
219 -del /f test\*.lst
220 -del /f test\*.bin
221 -del /f test\*.$(O)
222 -del /f test\*.bin
223 -del /f/s autom4te*.cache
224 rem cd rdoff && $(MAKE) distclean
226 cleaner: clean
227 -del /f $(PERLREQ)
228 -del /f *.man
229 -del /f nasm.spec
230 rem cd doc && $(MAKE) clean
232 spotless: distclean cleaner
233 -del /f doc\Makefile
234 -del doc\*~
235 -del doc\*.bak
237 strip:
239 rdf:
240 # cd rdoff && $(MAKE)
242 doc:
243 # cd doc && $(MAKE) all
245 everything: all doc rdf
247 #-- Magic hints to mkdep.pl --#
248 # @object-ending: ".$(O)"
249 # @path-separator: "/"
250 # @exclude: "config.h"
251 #-- Everything below is generated by mkdep.pl - do not edit --#
252 assemble.$(O): assemble.c assemble.h compiler.h directiv.h disp8.h iflag.h \
253 iflaggen.h insns.h insnsi.h listing.h nasm.h nasmint.h nasmlib.h opflags.h \
254 pptok.h preproc.h regs.h tables.h tokens.h
255 directiv.$(O): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
256 nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
257 disasm.$(O): disasm.c compiler.h directiv.h disasm.h disp8.h iflag.h \
258 iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
259 preproc.h regdis.h regs.h sync.h tables.h tokens.h
260 disp8.$(O): disp8.c compiler.h directiv.h disp8.h insnsi.h nasm.h nasmint.h \
261 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
262 eval.$(O): eval.c compiler.h directiv.h eval.h float.h insnsi.h labels.h \
263 nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
264 exprlib.$(O): exprlib.c compiler.h directiv.h insnsi.h nasm.h nasmint.h \
265 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
266 float.$(O): float.c compiler.h directiv.h float.h insnsi.h nasm.h nasmint.h \
267 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
268 hashtbl.$(O): hashtbl.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
269 nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
270 iflag.$(O): iflag.c compiler.h iflag.h iflaggen.h nasmint.h
271 insnsa.$(O): insnsa.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
272 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
273 tables.h tokens.h
274 insnsb.$(O): insnsb.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
275 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
276 tables.h tokens.h
277 insnsd.$(O): insnsd.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
278 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
279 tables.h tokens.h
280 insnsn.$(O): insnsn.c compiler.h insnsi.h nasmint.h tables.h
281 labels.$(O): labels.c compiler.h directiv.h hashtbl.h insnsi.h labels.h \
282 nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
283 listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
284 nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
285 macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
286 nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
287 tables.h
288 nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
289 iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmint.h nasmlib.h \
290 opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h \
291 stdscan.h tables.h tokens.h ver.h
292 nasmlib/crc64.$(O): nasmlib/crc64.c compiler.h hashtbl.h nasmint.h nasmlib.h
293 nasmlib/file.$(O): nasmlib/file.c compiler.h nasmint.h nasmlib.h
294 nasmlib/ilog2.$(O): nasmlib/ilog2.c compiler.h nasmint.h nasmlib.h
295 nasmlib/md5c.$(O): nasmlib/md5c.c compiler.h md5.h nasmint.h
296 nasmlib/nasmlib.$(O): nasmlib/nasmlib.c compiler.h directiv.h iflag.h \
297 iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
298 preproc.h regs.h tables.h tokens.h
299 nasmlib/realpath.$(O): nasmlib/realpath.c compiler.h nasmint.h nasmlib.h
300 nasmlib/ver.$(O): nasmlib/ver.c ver.h version.h
301 ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
302 insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
303 regs.h sync.h tables.h tokens.h ver.h
304 output/codeview.$(O): output/codeview.c compiler.h directiv.h insnsi.h md5.h \
305 nasm.h nasmint.h nasmlib.h opflags.h output/outlib.h output/pecoff.h \
306 pptok.h preproc.h regs.h saa.h tables.h version.h
307 output/nulldbg.$(O): output/nulldbg.c compiler.h directiv.h insnsi.h nasm.h \
308 nasmint.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h \
309 tables.h
310 output/nullout.$(O): output/nullout.c compiler.h directiv.h insnsi.h nasm.h \
311 nasmint.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h \
312 tables.h
313 output/outaout.$(O): output/outaout.c compiler.h directiv.h eval.h insnsi.h \
314 nasm.h nasmint.h nasmlib.h opflags.h output/outform.h output/outlib.h \
315 pptok.h preproc.h raa.h regs.h saa.h stdscan.h tables.h
316 output/outas86.$(O): output/outas86.c compiler.h directiv.h insnsi.h nasm.h \
317 nasmint.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
318 preproc.h raa.h regs.h saa.h tables.h
319 output/outbin.$(O): output/outbin.c compiler.h directiv.h eval.h insnsi.h \
320 labels.h nasm.h nasmint.h nasmlib.h opflags.h output/outform.h \
321 output/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h tables.h
322 output/outcoff.$(O): output/outcoff.c compiler.h directiv.h eval.h insnsi.h \
323 nasm.h nasmint.h nasmlib.h opflags.h output/outform.h output/outlib.h \
324 output/pecoff.h pptok.h preproc.h raa.h regs.h saa.h tables.h
325 output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
326 nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
327 tables.h
328 output/outelf.$(O): output/outelf.c compiler.h directiv.h insnsi.h nasm.h \
329 nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
330 output/outform.h pptok.h preproc.h rbtree.h regs.h saa.h tables.h
331 output/outelf32.$(O): output/outelf32.c compiler.h directiv.h eval.h \
332 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
333 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
334 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
335 output/outelf64.$(O): output/outelf64.c compiler.h directiv.h eval.h \
336 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
337 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
338 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
339 output/outelfx32.$(O): output/outelfx32.c compiler.h directiv.h eval.h \
340 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
341 output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
342 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
343 output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
344 nasmint.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
345 tables.h
346 output/outieee.$(O): output/outieee.c compiler.h directiv.h insnsi.h nasm.h \
347 nasmint.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
348 preproc.h regs.h tables.h ver.h
349 output/outlib.$(O): output/outlib.c compiler.h directiv.h insnsi.h nasm.h \
350 nasmint.h nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h \
351 tables.h
352 output/outmacho.$(O): output/outmacho.c compiler.h directiv.h insnsi.h \
353 nasm.h nasmint.h nasmlib.h opflags.h output/outform.h output/outlib.h \
354 pptok.h preproc.h raa.h rbtree.h regs.h saa.h tables.h
355 output/outobj.$(O): output/outobj.c compiler.h directiv.h eval.h insnsi.h \
356 nasm.h nasmint.h nasmlib.h opflags.h output/outform.h output/outlib.h \
357 pptok.h preproc.h regs.h stdscan.h tables.h ver.h
358 output/outrdf2.$(O): output/outrdf2.c compiler.h directiv.h insnsi.h nasm.h \
359 nasmint.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
360 preproc.h rdoff/rdoff.h regs.h saa.h tables.h
361 parser.$(O): parser.c compiler.h directiv.h eval.h float.h iflag.h \
362 iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h parser.h \
363 pptok.h preproc.h regs.h stdscan.h tables.h tokens.h
364 pptok.$(O): pptok.c compiler.h hashtbl.h nasmint.h nasmlib.h pptok.h \
365 preproc.h
366 preproc-nop.$(O): preproc-nop.c compiler.h directiv.h insnsi.h listing.h \
367 nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
368 preproc.$(O): preproc.c compiler.h directiv.h eval.h hashtbl.h insnsi.h \
369 listing.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h quote.h \
370 regs.h stdscan.h tables.h tokens.h
371 quote.$(O): quote.c compiler.h nasmint.h nasmlib.h quote.h
372 raa.$(O): raa.c compiler.h nasmint.h nasmlib.h raa.h
373 rbtree.$(O): rbtree.c compiler.h nasmint.h rbtree.h
374 regdis.$(O): regdis.c regdis.h regs.h
375 regflags.$(O): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmint.h \
376 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
377 regs.$(O): regs.c compiler.h insnsi.h nasmint.h tables.h
378 regvals.$(O): regvals.c compiler.h insnsi.h nasmint.h tables.h
379 saa.$(O): saa.c compiler.h nasmint.h nasmlib.h saa.h
380 stdlib/snprintf.$(O): stdlib/snprintf.c compiler.h nasmint.h nasmlib.h
381 stdlib/strlcpy.$(O): stdlib/strlcpy.c compiler.h nasmint.h
382 stdlib/vsnprintf.$(O): stdlib/vsnprintf.c compiler.h nasmint.h nasmlib.h
383 stdscan.$(O): stdscan.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
384 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h quote.h \
385 regs.h stdscan.h tables.h tokens.h
386 strfunc.$(O): strfunc.c compiler.h directiv.h insnsi.h nasm.h nasmint.h \
387 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
388 sync.$(O): sync.c compiler.h nasmint.h nasmlib.h sync.h
389 tokhash.$(O): tokhash.c compiler.h directiv.h hashtbl.h iflag.h iflaggen.h \
390 insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
391 regs.h stdscan.h tables.h tokens.h