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 # This is typically done by opening the Visual Studio Command Prompt.
15 prefix = C
:\Program Files\NASM
16 exec_prefix = $(prefix)
17 bindir = $(prefix)/bin
18 mandir = $(prefix)/man
25 LDFLAGS
= /DEBUG
/OPT
:REF
/OPT
:ICF
# (latter two undoes /DEBUG harm)
31 CFLAGS
= $(CFLAGS
) /W2
32 BUILD_CFLAGS
= $(CFLAGS
) /I
$(srcdir)/inttypes
33 INTERNAL_CFLAGS
= /I
$(srcdir) /I. \
34 /DHAVE__SNPRINTF
/DHAVE__VSNPRINTF
/DHAVE__FULLPATH
35 ALL_CFLAGS
= $(BUILD_CFLAGS
) $(INTERNAL_CFLAGS
)
36 LDFLAGS
= $(LDFLAGS
) /SUBSYSTEM
:CONSOLE
/RELEASE
38 PERL
= perl
-I
$(srcdir)/perllib
-I
$(srcdir)
45 .SUFFIXES
: .c .i .s .
$(O
) .
$(A
) .1 .man
48 $(CC
) /c
$(ALL_CFLAGS
) /Fo
$@
$<
50 #-- Begin File Lists --#
51 # Edit in Makefile.in, not here!
53 raa.
$(O
) saa.
$(O
) rbtree.
$(O
) \
54 float.
$(O
) insnsa.
$(O
) insnsb.
$(O
) \
56 assemble.
$(O
) labels.
$(O
) hashtbl.
$(O
) parser.
$(O
) \
57 output
/outform.
$(O
) output
/outlib.
$(O
) output
/nulldbg.
$(O
) \
59 output
/outbin.
$(O
) output
/outaout.
$(O
) output
/outcoff.
$(O
) \
61 output
/outobj.
$(O
) output
/outas86.
$(O
) output
/outrdf2.
$(O
) \
62 output
/outdbg.
$(O
) output
/outieee.
$(O
) output
/outmacho.
$(O
) \
63 output
/codeview.
$(O
) \
64 preproc.
$(O
) quote.
$(O
) pptok.
$(O
) \
65 macros.
$(O
) listing.
$(O
) eval.
$(O
) exprlib.
$(O
) stdscan.
$(O
) \
66 strfunc.
$(O
) tokhash.
$(O
) regvals.
$(O
) regflags.
$(O
) \
71 NDISASM
= ndisasm.
$(O
) disasm.
$(O
) sync.
$(O
) \
72 insnsd.
$(O
) insnsb.
$(O
) insnsn.
$(O
) regs.
$(O
) regdis.
$(O
) \
75 LIBOBJ
= stdlib
/snprintf.
$(O
) stdlib
/vsnprintf.
$(O
) stdlib
/strlcpy.
$(O
) \
76 nasmlib
/nasmlib.
$(O
) nasmlib
/ver.
$(O
) \
77 nasmlib
/file.
$(O
) nasmlib
/realpath.
$(O
) \
78 nasmlib
/ilog2.
$(O
) nasmlib
/md5c.
$(O
) nasmlib
/crc64.
$(O
) \
80 #-- End File Lists --#
82 all: nasm
$(X
) ndisasm
$(X
)
83 rem cd rdoff
&& $(MAKE
) all
85 nasm
$(X
): $(NASM
) nasm.
$(A
)
86 $(LD
) $(LDFLAGS
) /OUT
:nasm
$(X
) $(NASM
) $(LIBS
) nasm.
$(A
)
88 ndisasm
$(X
): $(NDISASM
) nasm.
$(A
)
89 $(LD
) $(LDFLAGS
) /OUT
:ndisasm
$(X
) $(NDISASM
) $(LIBS
) nasm.
$(A
)
92 $(AR
) $(ARFLAGS
) /OUT
:$@
$**
94 # These source files are automagically generated from a single
95 # instruction-table file by a Perl script. They're distributed,
96 # though, so it isn't necessary to have Perl just to recompile NASM
97 # from the distribution.
99 insns.pl
: insns-iflags.pl
101 INSDEP
= insns.dat insns.pl insns-iflags.pl
104 $(PERL
) $(srcdir)/insns.pl
-fc $(srcdir)/insns.dat
105 iflaggen.h
: $(INSDEP
)
106 $(PERL
) $(srcdir)/insns.pl
-fh
$(srcdir)/insns.dat
108 $(PERL
) $(srcdir)/insns.pl
-b
$(srcdir)/insns.dat
110 $(PERL
) $(srcdir)/insns.pl
-a
$(srcdir)/insns.dat
112 $(PERL
) $(srcdir)/insns.pl
-d
$(srcdir)/insns.dat
114 $(PERL
) $(srcdir)/insns.pl
-i
$(srcdir)/insns.dat
116 $(PERL
) $(srcdir)/insns.pl
-n
$(srcdir)/insns.dat
118 # These files contains all the standard macros that are derived from
119 # the version number.
120 version.h
: version version.pl
121 $(PERL
) $(srcdir)/version.pl h
< $(srcdir)/version
> version.h
123 version.mac
: version version.pl
124 $(PERL
) $(srcdir)/version.pl mac
< $(srcdir)/version
> version.mac
126 # This source file is generated from the standard macros file
127 # `standard.mac' by another Perl script. Again, it's part of the
128 # standard distribution.
130 macros.c
: macros.pl pptok.ph standard.mac version.mac \
131 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
132 $(PERL
) $(srcdir)/macros.pl
$(srcdir)/standard.mac version.mac \
133 $(srcdir)/macros
/*.mac
$(srcdir)/output
/*.mac
135 # These source files are generated from regs.dat by yet another
137 regs.c
: regs.dat regs.pl
138 $(PERL
) $(srcdir)/regs.pl c
$(srcdir)/regs.dat
> regs.c
139 regflags.c
: regs.dat regs.pl
140 $(PERL
) $(srcdir)/regs.pl
fc $(srcdir)/regs.dat
> regflags.c
141 regdis.c
: regs.dat regs.pl
142 $(PERL
) $(srcdir)/regs.pl dc
$(srcdir)/regs.dat
> regdis.c
143 regdis.h
: regs.dat regs.pl
144 $(PERL
) $(srcdir)/regs.pl dh
$(srcdir)/regs.dat
> regdis.h
145 regvals.c
: regs.dat regs.pl
146 $(PERL
) $(srcdir)/regs.pl vc
$(srcdir)/regs.dat
> regvals.c
147 regs.h
: regs.dat regs.pl
148 $(PERL
) $(srcdir)/regs.pl h
$(srcdir)/regs.dat
> regs.h
150 # Assembler token hash
151 tokhash.c
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
152 $(PERL
) $(srcdir)/tokhash.pl c
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
153 $(srcdir)/tokens.dat
> tokhash.c
155 # Assembler token metadata
156 tokens.h
: insns.dat regs.dat tokens.dat tokhash.pl perllib
/phash.ph
157 $(PERL
) $(srcdir)/tokhash.pl h
$(srcdir)/insns.dat
$(srcdir)/regs.dat \
158 $(srcdir)/tokens.dat
> tokens.h
160 # Preprocessor token hash
161 pptok.h
: pptok.dat pptok.pl perllib
/phash.ph
162 $(PERL
) $(srcdir)/pptok.pl h
$(srcdir)/pptok.dat pptok.h
163 pptok.c
: pptok.dat pptok.pl perllib
/phash.ph
164 $(PERL
) $(srcdir)/pptok.pl c
$(srcdir)/pptok.dat pptok.c
165 pptok.ph
: pptok.dat pptok.pl perllib
/phash.ph
166 $(PERL
) $(srcdir)/pptok.pl ph
$(srcdir)/pptok.dat pptok.ph
169 directiv.h
: directiv.dat directiv.pl perllib
/phash.ph
170 $(PERL
) $(srcdir)/directiv.pl h
$(srcdir)/directiv.dat directiv.h
171 directiv.c
: directiv.dat directiv.pl perllib
/phash.ph
172 $(PERL
) $(srcdir)/directiv.pl c
$(srcdir)/directiv.dat directiv.c
174 # This target generates all files that require perl.
175 # This allows easier generation of distribution (see dist target).
176 PERLREQ
= macros.c insnsb.c insnsa.c insnsd.c insnsi.h insnsn.c \
177 regs.c regs.h regflags.c regdis.c regvals.c tokhash.c tokens.h \
178 version.h version.mac pptok.h pptok.c iflag.c iflaggen.h \
179 directiv.c directiv.h pptok.ph regdis.h
191 -del
/f output\
*.
$(O
)
195 -del
/f nasmlib\
*.
$(O
)
196 -del
/f nasmlib\
*.pdb
199 -del
/f stdlib\
*.
$(O
)
206 rem cd rdoff
&& $(MAKE
) clean
211 -del
/f config.status
223 -del
/f
/s autom4te
*.cache
224 rem cd rdoff
&& $(MAKE
) distclean
230 rem cd doc
&& $(MAKE
) clean
232 spotless
: distclean cleaner
240 # cd rdoff && $(MAKE)
243 # cd doc && $(MAKE) all
245 everything
: all doc rdf
247 #-- Magic hints to mkdep.pl --#
248 # @object-ending: ".$(O)"
249 # @path-separator: "/"
250 # @exclude: "config.h"
251 #-- Everything below is generated by mkdep.pl - do not edit --#
252 assemble.
$(O
): assemble.c assemble.h compiler.h directiv.h disp8.h iflag.h \
253 iflaggen.h insns.h insnsi.h listing.h nasm.h nasmint.h nasmlib.h opflags.h \
254 pptok.h preproc.h regs.h tables.h tokens.h
255 directiv.
$(O
): directiv.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
256 nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
257 disasm.
$(O
): disasm.c compiler.h directiv.h disasm.h disp8.h iflag.h \
258 iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
259 preproc.h regdis.h regs.h sync.h tables.h tokens.h
260 disp8.
$(O
): disp8.c compiler.h directiv.h disp8.h insnsi.h nasm.h nasmint.h \
261 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
262 eval.
$(O
): eval.c compiler.h directiv.h eval.h float.h insnsi.h labels.h \
263 nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
264 exprlib.
$(O
): exprlib.c compiler.h directiv.h insnsi.h nasm.h nasmint.h \
265 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
266 float.
$(O
): float.c compiler.h directiv.h float.h insnsi.h nasm.h nasmint.h \
267 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
268 hashtbl.
$(O
): hashtbl.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
269 nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
270 iflag.
$(O
): iflag.c compiler.h iflag.h iflaggen.h nasmint.h
271 insnsa.
$(O
): insnsa.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
272 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
274 insnsb.
$(O
): insnsb.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
275 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
277 insnsd.
$(O
): insnsd.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
278 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h \
280 insnsn.
$(O
): insnsn.c compiler.h insnsi.h nasmint.h tables.h
281 labels.
$(O
): labels.c compiler.h directiv.h hashtbl.h insnsi.h labels.h \
282 nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
283 listing.
$(O
): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
284 nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
285 macros.
$(O
): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
286 nasmint.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h \
288 nasm.
$(O
): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
289 iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmint.h nasmlib.h \
290 opflags.h output
/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h \
291 stdscan.h tables.h tokens.h ver.h
292 nasmlib
/crc64.
$(O
): nasmlib
/crc64.c compiler.h hashtbl.h nasmint.h nasmlib.h
293 nasmlib
/file.
$(O
): nasmlib
/file.c compiler.h nasmint.h nasmlib.h
294 nasmlib
/ilog2.
$(O
): nasmlib
/ilog2.c compiler.h nasmint.h nasmlib.h
295 nasmlib
/md5c.
$(O
): nasmlib
/md5c.c compiler.h md5.h nasmint.h
296 nasmlib
/nasmlib.
$(O
): nasmlib
/nasmlib.c compiler.h directiv.h iflag.h \
297 iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h \
298 preproc.h regs.h tables.h tokens.h
299 nasmlib
/realpath.
$(O
): nasmlib
/realpath.c compiler.h nasmint.h nasmlib.h
300 nasmlib
/srcfile.
$(O
): nasmlib
/srcfile.c compiler.h hashtbl.h nasmint.h \
302 nasmlib
/ver.
$(O
): nasmlib
/ver.c ver.h version.h
303 ndisasm.
$(O
): ndisasm.c compiler.h directiv.h disasm.h iflag.h iflaggen.h \
304 insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
305 regs.h sync.h tables.h tokens.h ver.h
306 output
/codeview.
$(O
): output
/codeview.c compiler.h directiv.h insnsi.h md5.h \
307 nasm.h nasmint.h nasmlib.h opflags.h output
/outlib.h output
/pecoff.h \
308 pptok.h preproc.h regs.h saa.h tables.h version.h
309 output
/nulldbg.
$(O
): output
/nulldbg.c compiler.h directiv.h insnsi.h nasm.h \
310 nasmint.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h \
312 output
/nullout.
$(O
): output
/nullout.c compiler.h directiv.h insnsi.h nasm.h \
313 nasmint.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h \
315 output
/outaout.
$(O
): output
/outaout.c compiler.h directiv.h eval.h insnsi.h \
316 nasm.h nasmint.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
317 pptok.h preproc.h raa.h regs.h saa.h stdscan.h tables.h
318 output
/outas86.
$(O
): output
/outas86.c compiler.h directiv.h insnsi.h nasm.h \
319 nasmint.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
320 preproc.h raa.h regs.h saa.h tables.h
321 output
/outbin.
$(O
): output
/outbin.c compiler.h directiv.h eval.h insnsi.h \
322 labels.h nasm.h nasmint.h nasmlib.h opflags.h output
/outform.h \
323 output
/outlib.h pptok.h preproc.h regs.h saa.h stdscan.h tables.h
324 output
/outcoff.
$(O
): output
/outcoff.c compiler.h directiv.h eval.h insnsi.h \
325 nasm.h nasmint.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
326 output
/pecoff.h pptok.h preproc.h raa.h regs.h saa.h tables.h
327 output
/outdbg.
$(O
): output
/outdbg.c compiler.h directiv.h insnsi.h nasm.h \
328 nasmint.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h \
330 output
/outelf.
$(O
): output
/outelf.c compiler.h directiv.h eval.h insnsi.h \
331 nasm.h nasmint.h nasmlib.h opflags.h output
/dwarf.h output
/elf.h \
332 output
/outelf.h output
/outform.h output
/outlib.h output
/stabs.h pptok.h \
333 preproc.h raa.h rbtree.h regs.h saa.h stdscan.h tables.h ver.h
334 output
/outform.
$(O
): output
/outform.c compiler.h directiv.h insnsi.h nasm.h \
335 nasmint.h nasmlib.h opflags.h output
/outform.h pptok.h preproc.h regs.h \
337 output
/outieee.
$(O
): output
/outieee.c compiler.h directiv.h insnsi.h nasm.h \
338 nasmint.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
339 preproc.h regs.h tables.h ver.h
340 output
/outlib.
$(O
): output
/outlib.c compiler.h directiv.h insnsi.h nasm.h \
341 nasmint.h nasmlib.h opflags.h output
/outlib.h pptok.h preproc.h regs.h \
343 output
/outmacho.
$(O
): output
/outmacho.c compiler.h directiv.h insnsi.h \
344 nasm.h nasmint.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
345 pptok.h preproc.h raa.h rbtree.h regs.h saa.h tables.h
346 output
/outobj.
$(O
): output
/outobj.c compiler.h directiv.h eval.h insnsi.h \
347 nasm.h nasmint.h nasmlib.h opflags.h output
/outform.h output
/outlib.h \
348 pptok.h preproc.h regs.h stdscan.h tables.h ver.h
349 output
/outrdf2.
$(O
): output
/outrdf2.c compiler.h directiv.h insnsi.h nasm.h \
350 nasmint.h nasmlib.h opflags.h output
/outform.h output
/outlib.h pptok.h \
351 preproc.h rdoff
/rdoff.h regs.h saa.h tables.h
352 parser.
$(O
): parser.c compiler.h directiv.h eval.h float.h iflag.h \
353 iflaggen.h insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h parser.h \
354 pptok.h preproc.h regs.h stdscan.h tables.h tokens.h
355 pptok.
$(O
): pptok.c compiler.h hashtbl.h nasmint.h nasmlib.h pptok.h \
357 preproc-nop.
$(O
): preproc-nop.c compiler.h directiv.h insnsi.h listing.h \
358 nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
359 preproc.
$(O
): preproc.c compiler.h directiv.h eval.h hashtbl.h insnsi.h \
360 listing.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h quote.h \
361 regs.h stdscan.h tables.h tokens.h
362 quote.
$(O
): quote.c compiler.h nasmint.h nasmlib.h quote.h
363 raa.
$(O
): raa.c compiler.h nasmint.h nasmlib.h raa.h
364 rbtree.
$(O
): rbtree.c compiler.h nasmint.h rbtree.h
365 regdis.
$(O
): regdis.c regdis.h regs.h
366 regflags.
$(O
): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmint.h \
367 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
368 regs.
$(O
): regs.c compiler.h insnsi.h nasmint.h tables.h
369 regvals.
$(O
): regvals.c compiler.h insnsi.h nasmint.h tables.h
370 saa.
$(O
): saa.c compiler.h nasmint.h nasmlib.h saa.h
371 stdlib
/snprintf.
$(O
): stdlib
/snprintf.c compiler.h nasmint.h nasmlib.h
372 stdlib
/strlcpy.
$(O
): stdlib
/strlcpy.c compiler.h nasmint.h
373 stdlib
/vsnprintf.
$(O
): stdlib
/vsnprintf.c compiler.h nasmint.h nasmlib.h
374 stdscan.
$(O
): stdscan.c compiler.h directiv.h iflag.h iflaggen.h insns.h \
375 insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h quote.h \
376 regs.h stdscan.h tables.h tokens.h
377 strfunc.
$(O
): strfunc.c compiler.h directiv.h insnsi.h nasm.h nasmint.h \
378 nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
379 sync.
$(O
): sync.c compiler.h nasmint.h nasmlib.h sync.h
380 tokhash.
$(O
): tokhash.c compiler.h directiv.h hashtbl.h iflag.h iflaggen.h \
381 insns.h insnsi.h nasm.h nasmint.h nasmlib.h opflags.h pptok.h preproc.h \
382 regs.h stdscan.h tables.h tokens.h