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