"make alldeps"
[platform/upstream/nasm.git] / Mkfiles / msvc.mak
1 # -*- makefile -*-
2 #
3 # Makefile for building NASM using Microsoft Visual C++ and NMAKE.
4 # Tested on Microsoft Visual C++ 2005 Express Edition.
5 #
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.
8
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
16
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
25
26 # Binary suffixes
27 O               = obj
28 X               = .exe
29
30 .SUFFIXES: .c .i .s .$(O) .1 .man
31
32 .c.obj:
33         $(CC) /c $(ALL_CFLAGS) /Fo$@ $<
34
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         directiv.$(O) \
41         assemble.$(O) labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
42         output/outform.$(O) output/outlib.$(O) output/nulldbg.$(O) \
43         output/nullout.$(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) \
52         ilog2.$(O) \
53         lib/strlcpy.$(O) \
54         preproc-nop.$(O) \
55         disp8.$(O) \
56         iflag.$(O)
57
58 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
59         insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O) \
60         disp8.$(O) iflag.$(O)
61 #-- End File Lists --#
62
63 all: nasm$(X) ndisasm$(X)
64         rem cd rdoff && $(MAKE) all
65
66 nasm$(X): $(NASM)
67         $(CC) $(LDFLAGS) /Fenasm$(X) $(NASM) $(LIBS)
68
69 ndisasm$(X): $(NDISASM)
70         $(CC) $(LDFLAGS) /Fendisasm$(X) $(NDISASM) $(LIBS)
71
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.
76
77 insns.pl: insns-iflags.pl
78
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
91
92 # These files contains all the standard macros that are derived from
93 # the version number.
94 version.h: version version.pl
95         $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
96
97 version.mac: version version.pl
98         $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
99
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.
103
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
108
109 # These source files are generated from regs.dat by yet another
110 # perl script.
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
123
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
128
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
133
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
141
142 # Directives hash
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
147
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
153 perlreq: $(PERLREQ)
154
155 clean:
156         -del /f *.$(O)
157         -del /f *.s
158         -del /f *.i
159         -del /f lib\*.$(O)
160         -del /f lib\*.s
161         -del /f lib\*.i
162         -del /f output\*.$(O)
163         -del /f output\*.s
164         -del /f output\*.i
165         -del /f nasm$(X)
166         -del /f ndisasm$(X)
167         rem cd rdoff && $(MAKE) clean
168
169 distclean: clean
170         -del /f config.h
171         -del /f config.log
172         -del /f config.status
173         -del /f Makefile
174         -del /f *~
175         -del /f *.bak
176         -del /f *.lst
177         -del /f *.bin
178         -del /f output\*~
179         -del /f output\*.bak
180         -del /f test\*.lst
181         -del /f test\*.bin
182         -del /f test\*.$(O)
183         -del /f test\*.bin
184         -del /f/s autom4te*.cache
185         rem cd rdoff && $(MAKE) distclean
186
187 cleaner: clean
188         -del /f $(PERLREQ)
189         -del /f *.man
190         -del /f nasm.spec
191         rem cd doc && $(MAKE) clean
192
193 spotless: distclean cleaner
194         -del /f doc\Makefile
195         -del doc\*~
196         -del doc\*.bak
197
198 strip:
199
200 rdf:
201         # cd rdoff && $(MAKE)
202
203 doc:
204         # cd doc && $(MAKE) all
205
206 everything: all doc rdf
207
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  iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h \
215  regs.h tables.h tokens.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 \
220  iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h \
221  regdis.h regs.h 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 iflaggen.h
233 ilog2.$(O): ilog2.c compiler.h nasmlib.h
234 insnsa.$(O): insnsa.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
235  insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
236  tokens.h
237 insnsb.$(O): insnsb.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
238  insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
239  tokens.h
240 insnsd.$(O): insnsd.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
241  insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
242  tokens.h
243 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
244 labels.$(O): labels.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
245  nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
246 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
247 lib/strlcpy.$(O): lib/strlcpy.c compiler.h
248 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
249 listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
250  nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
251 macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
252  nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
253 nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
254  iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
255  output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
256  tables.h tokens.h
257 nasmlib.$(O): nasmlib.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
258  insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h \
259  tokens.h
260 ndisasm.$(O): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
261  insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h sync.h \
262  tables.h tokens.h
263 output/nulldbg.$(O): output/nulldbg.c compiler.h directiv.h insnsi.h nasm.h \
264  nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
265 output/nullout.$(O): output/nullout.c compiler.h directiv.h insnsi.h nasm.h \
266  nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
267 output/outaout.$(O): output/outaout.c compiler.h directiv.h eval.h insnsi.h \
268  nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
269  preproc.h raa.h regs.h saa.h stdscan.h tables.h
270 output/outas86.$(O): output/outas86.c compiler.h directiv.h insnsi.h nasm.h \
271  nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
272  raa.h regs.h saa.h tables.h
273 output/outbin.$(O): output/outbin.c compiler.h directiv.h eval.h insnsi.h \
274  labels.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
275  pptok.h preproc.h regs.h saa.h stdscan.h tables.h
276 output/outcoff.$(O): output/outcoff.c compiler.h directiv.h eval.h insnsi.h \
277  nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h output/pecoff.h \
278  pptok.h preproc.h raa.h regs.h saa.h tables.h
279 output/outdbg.$(O): output/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
280  nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
281 output/outelf.$(O): output/outelf.c compiler.h directiv.h insnsi.h nasm.h \
282  nasmlib.h opflags.h output/dwarf.h output/elf.h output/outelf.h \
283  output/outform.h pptok.h preproc.h regs.h tables.h
284 output/outelf32.$(O): output/outelf32.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/outelf64.$(O): output/outelf64.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/outelfx32.$(O): output/outelfx32.c compiler.h directiv.h eval.h \
293  insnsi.h nasm.h nasmlib.h opflags.h output/dwarf.h output/elf.h \
294  output/outelf.h output/outform.h output/outlib.h output/stabs.h pptok.h \
295  preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h
296 output/outform.$(O): output/outform.c compiler.h directiv.h insnsi.h nasm.h \
297  nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
298 output/outieee.$(O): output/outieee.c compiler.h directiv.h insnsi.h nasm.h \
299  nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
300  regs.h tables.h
301 output/outlib.$(O): output/outlib.c compiler.h directiv.h insnsi.h nasm.h \
302  nasmlib.h opflags.h output/outlib.h pptok.h preproc.h regs.h tables.h
303 output/outmac32.$(O): output/outmac32.c compiler.h directiv.h eval.h \
304  insnsi.h nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h \
305  pptok.h preproc.h raa.h regs.h saa.h tables.h
306 output/outmac64.$(O): output/outmac64.c compiler.h directiv.h insnsi.h \
307  nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
308  preproc.h raa.h regs.h saa.h tables.h
309 output/outobj.$(O): output/outobj.c compiler.h directiv.h eval.h insnsi.h \
310  nasm.h nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h \
311  preproc.h regs.h stdscan.h tables.h
312 output/outrdf2.$(O): output/outrdf2.c compiler.h directiv.h insnsi.h nasm.h \
313  nasmlib.h opflags.h output/outform.h output/outlib.h pptok.h preproc.h \
314  rdoff/rdoff.h regs.h saa.h tables.h
315 parser.$(O): parser.c compiler.h directiv.h eval.h float.h iflag.h \
316  iflaggen.h insns.h insnsi.h nasm.h nasmlib.h opflags.h parser.h pptok.h \
317  preproc.h regs.h stdscan.h tables.h tokens.h
318 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
319 preproc-nop.$(O): preproc-nop.c compiler.h directiv.h insnsi.h nasm.h \
320  nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
321 preproc.$(O): preproc.c compiler.h directiv.h eval.h hashtbl.h insnsi.h \
322  nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h stdscan.h \
323  tables.h tokens.h
324 quote.$(O): quote.c compiler.h nasmlib.h quote.h
325 raa.$(O): raa.c compiler.h nasmlib.h raa.h
326 rbtree.$(O): rbtree.c compiler.h rbtree.h
327 regdis.$(O): regdis.c regdis.h regs.h
328 regflags.$(O): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
329  opflags.h pptok.h preproc.h regs.h tables.h
330 regs.$(O): regs.c compiler.h insnsi.h tables.h
331 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
332 saa.$(O): saa.c compiler.h nasmlib.h saa.h
333 stdscan.$(O): stdscan.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
334  insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \
335  stdscan.h tables.h tokens.h
336 strfunc.$(O): strfunc.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \
337  opflags.h pptok.h preproc.h regs.h tables.h
338 sync.$(O): sync.c compiler.h nasmlib.h sync.h
339 tokhash.$(O): tokhash.c compiler.h directiv.h hashtbl.h iflag.h iflaggen.h \
340  insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
341  tables.h tokens.h
342 ver.$(O): ver.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h opflags.h \
343  pptok.h preproc.h regs.h tables.h version.h