ff72b80544bfd42987dd7557cc572841c610e2fd
[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         directives.$(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/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
47         output/outdbg.$(O) output/outieee.$(O) output/outmacho32.$(O) \
48         output/outmacho64.$(O) preproc.$(O) quote.$(O) pptok.$(O) \
49         macros.$(O) listing.$(O) eval.$(O) exprlib.$(O) stdscan.$(O) \
50         strfunc.$(O) tokhash.$(O) regvals.$(O) regflags.$(O)
51
52 NDISASM = ndisasm.$(O) disasm.$(O) sync.$(O) nasmlib.$(O) ver.$(O) \
53         insnsd.$(O) insnsb.$(O) insnsn.$(O) regs.$(O) regdis.$(O)
54 #-- End File Lists --#
55
56 all: nasm$(X) ndisasm$(X)
57         rem cd rdoff && $(MAKE) all
58
59 nasm$(X): $(NASM)
60         $(CC) $(LDFLAGS) /Fenasm$(X) $(NASM) $(LIBS)
61
62 ndisasm$(X): $(NDISASM)
63         $(CC) $(LDFLAGS) /Fendisasm$(X) $(NDISASM) $(LIBS)
64
65 # These source files are automagically generated from a single
66 # instruction-table file by a Perl script. They're distributed,
67 # though, so it isn't necessary to have Perl just to recompile NASM
68 # from the distribution.
69
70 insnsb.c: insns.dat insns.pl
71         $(PERL) $(srcdir)/insns.pl -b $(srcdir)/insns.dat
72 insnsa.c: insns.dat insns.pl
73         $(PERL) $(srcdir)/insns.pl -a $(srcdir)/insns.dat
74 insnsd.c: insns.dat insns.pl
75         $(PERL) $(srcdir)/insns.pl -d $(srcdir)/insns.dat
76 insnsi.h: insns.dat insns.pl
77         $(PERL) $(srcdir)/insns.pl -i $(srcdir)/insns.dat
78 insnsn.c: insns.dat insns.pl
79         $(PERL) $(srcdir)/insns.pl -n $(srcdir)/insns.dat
80
81 # These files contains all the standard macros that are derived from
82 # the version number.
83 version.h: version version.pl
84         $(PERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
85
86 version.mac: version version.pl
87         $(PERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
88
89 # This source file is generated from the standard macros file
90 # `standard.mac' by another Perl script. Again, it's part of the
91 # standard distribution.
92
93 macros.c: macros.pl standard.mac version.mac
94         $(PERL) $(srcdir)/macros.pl $(srcdir)/standard.mac version.mac
95
96 # These source files are generated from regs.dat by yet another
97 # perl script.
98 regs.c: regs.dat regs.pl
99         $(PERL) $(srcdir)/regs.pl c $(srcdir)/regs.dat > regs.c
100 regflags.c: regs.dat regs.pl
101         $(PERL) $(srcdir)/regs.pl fc $(srcdir)/regs.dat > regflags.c
102 regdis.c: regs.dat regs.pl
103         $(PERL) $(srcdir)/regs.pl dc $(srcdir)/regs.dat > regdis.c
104 regvals.c: regs.dat regs.pl
105         $(PERL) $(srcdir)/regs.pl vc $(srcdir)/regs.dat > regvals.c
106 regs.h: regs.dat regs.pl
107         $(PERL) $(srcdir)/regs.pl h $(srcdir)/regs.dat > regs.h
108
109 # Assembler token hash
110 tokhash.c: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
111         $(PERL) $(srcdir)/tokhash.pl c $(srcdir)/insns.dat $(srcdir)/regs.dat \
112                 $(srcdir)/tokens.dat > tokhash.c
113
114 # Assembler token metadata
115 tokens.h: insns.dat regs.dat tokens.dat tokhash.pl perllib/phash.ph
116         $(PERL) $(srcdir)/tokhash.pl h $(srcdir)/insns.dat $(srcdir)/regs.dat \
117                 $(srcdir)/tokens.dat > tokens.h
118
119 # Preprocessor token hash
120 pptok.h: pptok.dat pptok.pl perllib/phash.ph
121         $(PERL) $(srcdir)/pptok.pl h $(srcdir)/pptok.dat pptok.h
122 pptok.c: pptok.dat pptok.pl perllib/phash.ph
123         $(PERL) $(srcdir)/pptok.pl c $(srcdir)/pptok.dat pptok.c
124
125 # This target generates all files that require perl.
126 # This allows easier generation of distribution (see dist target).
127 PERLREQ = macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
128           regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
129           version.h version.mac pptok.h pptok.c
130 perlreq: $(PERLREQ)
131
132 clean:
133         -del /f *.$(O)
134         -del /f *.s
135         -del /f *.i
136         -del /f output\*.$(O)
137         -del /f output\*.s
138         -del /f output\*.i
139         -del /f nasm$(X)
140         -del /f ndisasm$(X)
141         rem cd rdoff && $(MAKE) clean
142
143 distclean: clean
144         -del /f config.h
145         -del /f config.log
146         -del /f config.status
147         -del /f Makefile
148         -del /f *~
149         -del /f *.bak
150         -del /f *.lst
151         -del /f *.bin
152         -del /f output\*~
153         -del /f output\*.bak
154         -del /f test\*.lst
155         -del /f test\*.bin
156         -del /f test\*.$(O)
157         -del /f test\*.bin
158         -del /f/s autom4te*.cache
159         rem cd rdoff && $(MAKE) distclean
160
161 cleaner: clean
162         -del /f $(PERLREQ)
163         -del /f *.man
164         -del /f nasm.spec
165         rem cd doc && $(MAKE) clean
166
167 spotless: distclean cleaner
168         -del /f doc\Makefile
169         -del doc\*~
170         -del doc\*.bak
171
172 strip:
173
174 rdf:
175         # cd rdoff && $(MAKE)
176
177 doc:
178         # cd doc && $(MAKE) all
179
180 everything: all doc rdf
181
182 #-- Magic hints to mkdep.pl --#
183 # @object-ending: ".$(O)"
184 # @path-separator: "/"
185 # @exclude: "config.h"
186 #-- Everything below is generated by mkdep.pl - do not edit --#
187 assemble.$(O): assemble.c assemble.h compiler.h directives.h insns.h \
188  insnsi.h nasm.h nasmlib.h pptok.h preproc.h regs.h tables.h tokens.h
189 crc64.$(O): crc64.c compiler.h nasmlib.h
190 directives.$(O): directives.c compiler.h directives.h hashtbl.h insnsi.h \
191  nasm.h nasmlib.h pptok.h preproc.h regs.h
192 disasm.$(O): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
193  nasm.h nasmlib.h pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
194 eval.$(O): eval.c compiler.h directives.h eval.h float.h insnsi.h labels.h \
195  nasm.h nasmlib.h pptok.h preproc.h regs.h
196 exprlib.$(O): exprlib.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
197  pptok.h preproc.h regs.h
198 float.$(O): float.c compiler.h directives.h float.h insnsi.h nasm.h \
199  nasmlib.h pptok.h preproc.h regs.h
200 hashtbl.$(O): hashtbl.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
201  nasmlib.h pptok.h preproc.h regs.h
202 insnsa.$(O): insnsa.c compiler.h directives.h insns.h insnsi.h nasm.h \
203  nasmlib.h pptok.h preproc.h regs.h tokens.h
204 insnsb.$(O): insnsb.c compiler.h directives.h insns.h insnsi.h nasm.h \
205  nasmlib.h pptok.h preproc.h regs.h tokens.h
206 insnsd.$(O): insnsd.c compiler.h directives.h insns.h insnsi.h nasm.h \
207  nasmlib.h pptok.h preproc.h regs.h tokens.h
208 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
209 labels.$(O): labels.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
210  nasmlib.h pptok.h preproc.h regs.h
211 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
212 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
213 listing.$(O): listing.c compiler.h directives.h insnsi.h listing.h nasm.h \
214  nasmlib.h pptok.h preproc.h regs.h
215 macros.$(O): macros.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
216  nasmlib.h output/outform.h pptok.h preproc.h regs.h tables.h
217 nasm.$(O): nasm.c assemble.h compiler.h directives.h eval.h float.h insns.h \
218  insnsi.h labels.h listing.h nasm.h nasmlib.h output/outform.h parser.h \
219  pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
220 nasmlib.$(O): nasmlib.c compiler.h directives.h insns.h insnsi.h nasm.h \
221  nasmlib.h pptok.h preproc.h regs.h tokens.h
222 ndisasm.$(O): ndisasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
223  nasm.h nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
224 output/nulldbg.$(O): output/nulldbg.c compiler.h directives.h insnsi.h \
225  nasm.h nasmlib.h pptok.h preproc.h regs.h
226 output/nullout.$(O): output/nullout.c compiler.h directives.h insnsi.h \
227  nasm.h nasmlib.h output/outlib.h pptok.h preproc.h regs.h
228 output/outaout.$(O): output/outaout.c compiler.h directives.h insnsi.h \
229  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
230  regs.h saa.h stdscan.h
231 output/outas86.$(O): output/outas86.c compiler.h directives.h insnsi.h \
232  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
233  regs.h saa.h
234 output/outbin.$(O): output/outbin.c compiler.h directives.h eval.h insnsi.h \
235  labels.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
236  preproc.h regs.h saa.h stdscan.h
237 output/outcoff.$(O): output/outcoff.c compiler.h directives.h insnsi.h \
238  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
239  regs.h saa.h
240 output/outdbg.$(O): output/outdbg.c compiler.h directives.h insnsi.h nasm.h \
241  nasmlib.h output/outform.h pptok.h preproc.h regs.h
242 output/outelf.$(O): output/outelf.c compiler.h directives.h insnsi.h nasm.h \
243  nasmlib.h output/dwarf.h output/elfcommon.h output/outelf.h \
244  output/outform.h pptok.h preproc.h regs.h
245 output/outelf32.$(O): output/outelf32.c compiler.h directives.h insnsi.h \
246  nasm.h nasmlib.h output/dwarf.h output/elf32.h output/elfcommon.h \
247  output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
248  rbtree.h regs.h saa.h stdscan.h
249 output/outelf64.$(O): output/outelf64.c compiler.h directives.h insnsi.h \
250  nasm.h nasmlib.h output/dwarf.h output/elf64.h output/elfcommon.h \
251  output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
252  rbtree.h regs.h saa.h stdscan.h
253 output/outexe.$(O): output/outexe.c compiler.h directives.h insnsi.h nasm.h \
254  nasmlib.h output/outform.h pptok.h preproc.h regs.h
255 output/outform.$(O): output/outform.c compiler.h directives.h insnsi.h \
256  nasm.h nasmlib.h output/outform.h pptok.h preproc.h regs.h
257 output/outieee.$(O): output/outieee.c compiler.h directives.h insnsi.h \
258  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h regs.h
259 output/outlib.$(O): output/outlib.c compiler.h directives.h insnsi.h nasm.h \
260  nasmlib.h output/outlib.h pptok.h preproc.h regs.h
261 output/outmacho32.$(O): output/outmacho32.c compiler.h directives.h insnsi.h \
262  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
263  regs.h saa.h
264 output/outmacho64.$(O): output/outmacho64.c compiler.h directives.h insnsi.h \
265  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
266  regs.h saa.h
267 output/outobj.$(O): output/outobj.c compiler.h directives.h insnsi.h nasm.h \
268  nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h regs.h \
269  stdscan.h
270 output/outrdf.$(O): output/outrdf.c compiler.h directives.h insnsi.h nasm.h \
271  nasmlib.h output/outform.h pptok.h preproc.h regs.h
272 output/outrdf2.$(O): output/outrdf2.c compiler.h directives.h insnsi.h \
273  nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h \
274  rdoff/rdoff.h regs.h saa.h
275 parser.$(O): parser.c compiler.h directives.h float.h insns.h insnsi.h \
276  nasm.h nasmlib.h parser.h pptok.h preproc.h regs.h stdscan.h tables.h \
277  tokens.h
278 pptok.$(O): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
279 preproc.$(O): preproc.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
280  nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h tokens.h
281 quote.$(O): quote.c compiler.h nasmlib.h quote.h
282 raa.$(O): raa.c compiler.h nasmlib.h raa.h
283 rbtree.$(O): rbtree.c compiler.h rbtree.h
284 regdis.$(O): regdis.c regdis.h regs.h
285 regflags.$(O): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
286  pptok.h preproc.h regs.h tables.h
287 regs.$(O): regs.c compiler.h insnsi.h tables.h
288 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
289 saa.$(O): saa.c compiler.h nasmlib.h saa.h
290 stdscan.$(O): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h \
291  nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
292 strfunc.$(O): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
293  pptok.h preproc.h regs.h
294 sync.$(O): sync.c compiler.h nasmlib.h sync.h
295 tokhash.$(O): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h \
296  nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
297 ver.$(O): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h pptok.h \
298  preproc.h regs.h version.h