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.
12 prefix = C
:\Program Files\NASM
13 exec_prefix = $(prefix)
14 bindir = $(prefix)/bin
15 mandir = $(prefix)/man
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
)
24 PERL
= perl
-I
$(srcdir)/perllib
30 .SUFFIXES
: .c .i .s .
$(O
) .1 .man
33 $(CC
) /c
$(ALL_CFLAGS
) /Fo
$@
$<
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
)
45 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) nasmlib.
$(O
) insnsd.
$(O
)
47 all: nasm
$(X
) ndisasm
$(X
)
48 rem cd rdoff
&& $(MAKE
) all
51 $(CC
) $(LDFLAGS
) /Fenasm
$(X
) $(NASM
) $(LIBS
)
53 ndisasm
$(X
): $(NDISASM
)
54 $(CC
) $(LDFLAGS
) /Fendisasm
$(X
) $(NDISASM
) $(LIBS
)
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.
61 insnsa.c
: insns.dat insns.pl
62 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
63 insnsd.c
: insns.dat insns.pl
64 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
65 insnsi.h
: insns.dat insns.pl
66 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
67 insnsn.c
: insns.dat insns.pl
68 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
70 # These files contains all the standard macros that are derived from
72 version.h
: version version.pl
73 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
75 version.mac
: version version.pl
76 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
78 # This source file is generated from the standard macros file
79 # `standard.mac' by another Perl script. Again, it's part of the
80 # standard distribution.
82 macros.c
: macros.pl standard.mac version.mac
83 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac
85 # These source files are generated from regs.dat by yet another
87 regs.c
: regs.dat regs.pl
88 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
89 regflags.c
: regs.dat regs.pl
90 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
91 regdis.c
: regs.dat regs.pl
92 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
93 regvals.c
: regs.dat regs.pl
94 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
95 regs.h
: regs.dat regs.pl
96 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
98 # Assembler token hash
99 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
100 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
101 $(srcdir)/tokens.dat
> tokhash.c
103 # Assembler token metadata
104 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
105 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
106 $(srcdir)/tokens.dat
> tokens.h
108 # Preprocessor token hash
109 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
110 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
111 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
112 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
114 # This target generates all files that require perl.
115 # This allows easier generation of distribution (see dist target).
116 PERLREQ
= macros.c insnsa.c insnsd.c insnsi.h insnsn.c \
117 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
118 version.h version.mac pptok.h pptok.c
125 -del
/f output\
*.
$(O
)
130 rem cd rdoff
&& $(MAKE
) clean
135 -del
/f config.status
147 -del
/f
/s autom4te
*.cache
148 rem cd rdoff
&& $(MAKE
) distclean
154 rem cd doc
&& $(MAKE
) clean
156 spotless
: distclean cleaner
164 # cd rdoff && $(MAKE)
167 # cd doc && $(MAKE) all
169 everything
: all doc rdf
171 #-- Magic hints to mkdep.pl --#
172 # @object-ending: ".$(O)"
173 # @path-separator: "/"
174 # @exclude: "config.h"
175 #-- Everything below is generated by mkdep.pl - do not edit --#
176 assemble.
$(O
): assemble.c assemble.h compiler.h insns.h insnsi.h nasm.h \
177 nasmlib.h pptok.h preproc.h regflags.c regs.h regvals.c tokens.h version.h
178 crc64.
$(O
): crc64.c compiler.h
179 disasm.
$(O
): disasm.c compiler.h disasm.h insns.h insnsi.h insnsn.c names.c \
180 nasm.h nasmlib.h regdis.c regs.c regs.h sync.h tokens.h version.h
181 eval.
$(O
): eval.c compiler.h eval.h float.h insnsi.h labels.h nasm.h \
182 nasmlib.h regs.h version.h
183 exprlib.
$(O
): exprlib.c compiler.h insnsi.h nasm.h nasmlib.h regs.h \
185 float.
$(O
): float.c compiler.h float.h insnsi.h nasm.h nasmlib.h regs.h \
187 hashtbl.
$(O
): hashtbl.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h \
189 insnsa.
$(O
): insnsa.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
191 insnsd.
$(O
): insnsd.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
193 insnsn.
$(O
): insnsn.c
194 labels.
$(O
): labels.c compiler.h hashtbl.h insnsi.h nasm.h nasmlib.h regs.h \
196 lib
/snprintf.
$(O
): lib
/snprintf.c compiler.h nasmlib.h
197 lib
/vsnprintf.
$(O
): lib
/vsnprintf.c compiler.h nasmlib.h
198 listing.
$(O
): listing.c compiler.h insnsi.h listing.h nasm.h nasmlib.h \
200 macros.
$(O
): macros.c compiler.h
201 names.
$(O
): names.c compiler.h insnsn.c regs.c
202 nasm.
$(O
): nasm.c assemble.h compiler.h eval.h float.h insns.h insnsi.h \
203 labels.h listing.h nasm.h nasmlib.h outform.h parser.h pptok.h preproc.h \
204 regs.h stdscan.h tokens.h version.h
205 nasmlib.
$(O
): nasmlib.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
207 ndisasm.
$(O
): ndisasm.c compiler.h disasm.h insns.h insnsi.h nasm.h \
208 nasmlib.h regs.h sync.h tokens.h version.h
209 outform.
$(O
): outform.c compiler.h insnsi.h nasm.h nasmlib.h outform.h \
211 output
/outaout.
$(O
): output
/outaout.c compiler.h insnsi.h nasm.h nasmlib.h \
212 outform.h regs.h stdscan.h version.h
213 output
/outas86.
$(O
): output
/outas86.c compiler.h insnsi.h nasm.h nasmlib.h \
214 outform.h regs.h version.h
215 output
/outbin.
$(O
): output
/outbin.c compiler.h eval.h insnsi.h labels.h \
216 nasm.h nasmlib.h outform.h regs.h stdscan.h version.h
217 output
/outcoff.
$(O
): output
/outcoff.c compiler.h insnsi.h nasm.h nasmlib.h \
218 outform.h regs.h version.h
219 output
/outdbg.
$(O
): output
/outdbg.c compiler.h insnsi.h nasm.h nasmlib.h \
220 outform.h regs.h version.h
221 output
/outelf32.
$(O
): output
/outelf32.c compiler.h insnsi.h nasm.h nasmlib.h \
222 outform.h regs.h stdscan.h version.h
223 output
/outelf64.
$(O
): output
/outelf64.c compiler.h insnsi.h nasm.h nasmlib.h \
224 outform.h regs.h stdscan.h version.h
225 output
/outieee.
$(O
): output
/outieee.c compiler.h insnsi.h nasm.h nasmlib.h \
226 outform.h regs.h version.h
227 output
/outmacho.
$(O
): output
/outmacho.c compiler.h insnsi.h nasm.h nasmlib.h \
228 outform.h regs.h version.h
229 output
/outobj.
$(O
): output
/outobj.c compiler.h insnsi.h nasm.h nasmlib.h \
230 outform.h regs.h stdscan.h version.h
231 output
/outrdf.
$(O
): output
/outrdf.c compiler.h insnsi.h nasm.h nasmlib.h \
232 outform.h regs.h version.h
233 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h insnsi.h nasm.h nasmlib.h \
234 outform.h rdoff
/rdoff.h regs.h version.h
235 parser.
$(O
): parser.c compiler.h float.h insns.h insnsi.h nasm.h nasmlib.h \
236 parser.h regflags.c regs.h stdscan.h tokens.h version.h
237 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmlib.h pptok.h preproc.h
238 preproc.
$(O
): preproc.c compiler.h hashtbl.h insnsi.h macros.c nasm.h \
239 nasmlib.h pptok.h preproc.h regs.h stdscan.h tokens.h version.h
240 regdis.
$(O
): regdis.c
241 regflags.
$(O
): regflags.c
242 regs.
$(O
): regs.c compiler.h
243 regvals.
$(O
): regvals.c
244 stdscan.
$(O
): stdscan.c compiler.h insns.h insnsi.h nasm.h nasmlib.h regs.h \
245 stdscan.h tokens.h version.h
246 sync.
$(O
): sync.c compiler.h nasmlib.h sync.h
247 tokhash.
$(O
): tokhash.c compiler.h hashtbl.h insns.h insnsi.h nasm.h \
248 nasmlib.h regs.h tokens.h version.h