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