Add strlcpy() function
[nasm.git] / Mkfiles / msvc.mak
blob6318b223131e1ce7b9f86270e14284de3d0be684
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 pptok.h preproc.h regs.h tables.h tokens.h
190 crc64.$(O): crc64.c compiler.h nasmlib.h
191 directives.$(O): directives.c compiler.h directives.h hashtbl.h insnsi.h \
192 nasm.h nasmlib.h pptok.h preproc.h regs.h
193 disasm.$(O): disasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
194 nasm.h nasmlib.h pptok.h preproc.h regdis.h regs.h sync.h tables.h tokens.h
195 eval.$(O): eval.c compiler.h directives.h eval.h float.h insnsi.h labels.h \
196 nasm.h nasmlib.h pptok.h preproc.h regs.h
197 exprlib.$(O): exprlib.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
198 pptok.h preproc.h regs.h
199 float.$(O): float.c compiler.h directives.h float.h insnsi.h nasm.h \
200 nasmlib.h pptok.h preproc.h regs.h
201 hashtbl.$(O): hashtbl.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
202 nasmlib.h pptok.h preproc.h regs.h
203 insnsa.$(O): insnsa.c compiler.h directives.h insns.h insnsi.h nasm.h \
204 nasmlib.h pptok.h preproc.h regs.h tokens.h
205 insnsb.$(O): insnsb.c compiler.h directives.h insns.h insnsi.h nasm.h \
206 nasmlib.h pptok.h preproc.h regs.h tokens.h
207 insnsd.$(O): insnsd.c compiler.h directives.h insns.h insnsi.h nasm.h \
208 nasmlib.h pptok.h preproc.h regs.h tokens.h
209 insnsn.$(O): insnsn.c compiler.h insnsi.h tables.h
210 labels.$(O): labels.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
211 nasmlib.h pptok.h preproc.h regs.h
212 lib/snprintf.$(O): lib/snprintf.c compiler.h nasmlib.h
213 lib/strlcpy.$(O): lib/strlcpy.c compiler.h
214 lib/vsnprintf.$(O): lib/vsnprintf.c compiler.h nasmlib.h
215 listing.$(O): listing.c compiler.h directives.h insnsi.h listing.h nasm.h \
216 nasmlib.h pptok.h preproc.h regs.h
217 macros.$(O): macros.c compiler.h directives.h hashtbl.h insnsi.h nasm.h \
218 nasmlib.h output/outform.h pptok.h preproc.h regs.h tables.h
219 nasm.$(O): nasm.c assemble.h compiler.h directives.h eval.h float.h insns.h \
220 insnsi.h labels.h listing.h nasm.h nasmlib.h output/outform.h parser.h \
221 pptok.h preproc.h raa.h regs.h saa.h stdscan.h tokens.h
222 nasmlib.$(O): nasmlib.c compiler.h directives.h insns.h insnsi.h nasm.h \
223 nasmlib.h pptok.h preproc.h regs.h tokens.h
224 ndisasm.$(O): ndisasm.c compiler.h directives.h disasm.h insns.h insnsi.h \
225 nasm.h nasmlib.h pptok.h preproc.h regs.h sync.h tokens.h
226 output/nulldbg.$(O): output/nulldbg.c compiler.h directives.h insnsi.h \
227 nasm.h nasmlib.h pptok.h preproc.h regs.h
228 output/nullout.$(O): output/nullout.c compiler.h directives.h insnsi.h \
229 nasm.h nasmlib.h output/outlib.h pptok.h preproc.h regs.h
230 output/outaout.$(O): output/outaout.c compiler.h directives.h eval.h \
231 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
232 preproc.h raa.h regs.h saa.h stdscan.h
233 output/outas86.$(O): output/outas86.c compiler.h directives.h insnsi.h \
234 nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
235 regs.h saa.h
236 output/outbin.$(O): output/outbin.c compiler.h directives.h eval.h insnsi.h \
237 labels.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
238 preproc.h regs.h saa.h stdscan.h
239 output/outcoff.$(O): output/outcoff.c compiler.h directives.h eval.h \
240 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
241 preproc.h raa.h regs.h saa.h
242 output/outdbg.$(O): output/outdbg.c compiler.h directives.h insnsi.h nasm.h \
243 nasmlib.h output/outform.h pptok.h preproc.h regs.h
244 output/outelf.$(O): output/outelf.c compiler.h directives.h insnsi.h nasm.h \
245 nasmlib.h output/dwarf.h output/elfcommon.h output/outelf.h \
246 output/outform.h pptok.h preproc.h regs.h
247 output/outelf32.$(O): output/outelf32.c compiler.h directives.h eval.h \
248 insnsi.h nasm.h nasmlib.h output/dwarf.h output/elf32.h output/elfcommon.h \
249 output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
250 rbtree.h regs.h saa.h stdscan.h
251 output/outelf64.$(O): output/outelf64.c compiler.h directives.h eval.h \
252 insnsi.h nasm.h nasmlib.h output/dwarf.h output/elf64.h output/elfcommon.h \
253 output/outelf.h output/outform.h output/outlib.h pptok.h preproc.h raa.h \
254 rbtree.h regs.h saa.h stdscan.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 eval.h \
262 insnsi.h nasm.h nasmlib.h output/outform.h output/outlib.h pptok.h \
263 preproc.h raa.h 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 eval.h insnsi.h \
268 nasm.h 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 eval.h float.h insns.h \
276 insnsi.h nasm.h nasmlib.h parser.h pptok.h preproc.h regs.h stdscan.h \
277 tables.h 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 eval.h hashtbl.h insnsi.h \
280 nasm.h nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tables.h \
281 tokens.h
282 quote.$(O): quote.c compiler.h nasmlib.h quote.h
283 raa.$(O): raa.c compiler.h nasmlib.h raa.h
284 rbtree.$(O): rbtree.c compiler.h rbtree.h
285 regdis.$(O): regdis.c regdis.h regs.h
286 regflags.$(O): regflags.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
287 pptok.h preproc.h regs.h tables.h
288 regs.$(O): regs.c compiler.h insnsi.h tables.h
289 regvals.$(O): regvals.c compiler.h insnsi.h tables.h
290 saa.$(O): saa.c compiler.h nasmlib.h saa.h
291 stdscan.$(O): stdscan.c compiler.h directives.h insns.h insnsi.h nasm.h \
292 nasmlib.h pptok.h preproc.h quote.h regs.h stdscan.h tokens.h
293 strfunc.$(O): strfunc.c compiler.h directives.h insnsi.h nasm.h nasmlib.h \
294 pptok.h preproc.h regs.h
295 sync.$(O): sync.c compiler.h nasmlib.h sync.h
296 tokhash.$(O): tokhash.c compiler.h directives.h hashtbl.h insns.h insnsi.h \
297 nasm.h nasmlib.h pptok.h preproc.h regs.h tokens.h
298 ver.$(O): ver.c compiler.h directives.h insnsi.h nasm.h nasmlib.h pptok.h \
299 preproc.h regs.h version.h