1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
|
# -*- makefile -*-
#
# Makefile for building NASM using Microsoft Visual C++ and NMAKE.
# Tested on Microsoft Visual C++ 2005 Express Edition.
#
# Make sure to put the appropriate directories in your PATH, in
# the case of MSVC++ 2005, they are ...\VC\bin and ...\Common7\IDE.
#
# This is typically done by opening the Visual Studio Command Prompt.
#
top_srcdir = .
srcdir = .
objdir = .
VPATH = .
prefix = "C:\Program Files\NASM"
exec_prefix = $(prefix)
bindir = $(prefix)/bin
mandir = $(prefix)/man
MANIFEST_FLAGS = /MANIFEST:EMBED /MANIFESTFILE:$(MANIFEST)
!IF "$(DEBUG)" == "1"
CFLAGS = /Od /Zi
LDFLAGS = /DEBUG
!ELSE
CFLAGS = /O2 /Zi
# /OPT:REF and /OPT:ICF two undo /DEBUG harm
LDFLAGS = /DEBUG /OPT:REF /OPT:ICF
!ENDIF
CC = cl
AR = lib
BUILD_CFLAGS = $(CFLAGS) /W2
INTERNAL_CFLAGS = /I$(srcdir) /I. \
/I$(srcdir)/include /I./include \
/I$(srcdir)/x86 /I./x86 \
/I$(srcdir)/asm /I./asm \
/I$(srcdir)/disasm /I./disasm \
/I$(srcdir)/output /I./output
ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
MANIFEST_FLAGS = /MANIFEST:EMBED /MANIFESTINPUT:$(MANIFEST)
ALL_LDFLAGS = /link $(LDFLAGS) $(MANIFEST_FLAGS) /SUBSYSTEM:CONSOLE /RELEASE
LIBS =
PERL = perl
PERLFLAGS = -I$(srcdir)/perllib -I$(srcdir)
RUNPERL = $(PERL) $(PERLFLAGS)
MAKENSIS = makensis
RM_F = -del /f
LN_S = copy
# Binary suffixes
O = obj
A = lib
X = .exe
.SUFFIXES:
.SUFFIXES: $(X) .$(A) .obj .c .i .s .1 .man
.c.obj:
$(CC) /c $(ALL_CFLAGS) /Fo$@ $<
MANIFEST = win/manifest.xml
#-- Begin File Lists --#
# Edit in Makefile.in, not here!
NASM = asm\nasm.obj
NDISASM = disasm\ndisasm.obj
PROGOBJ = $(NASM) $(NDISASM)
PROGS = nasm$(X) ndisasm$(X)
LIBOBJ_NW = stdlib\snprintf.obj stdlib\vsnprintf.obj stdlib\strlcpy.obj \
stdlib\strnlen.obj stdlib\strrchrnul.obj \
\
nasmlib\ver.obj \
nasmlib\alloc.obj nasmlib\asprintf.obj nasmlib\errfile.obj \
nasmlib\crc32.obj nasmlib\crc64.obj nasmlib\md5c.obj \
nasmlib\string.obj nasmlib\nctype.obj \
nasmlib\file.obj nasmlib\mmap.obj nasmlib\ilog2.obj \
nasmlib\realpath.obj nasmlib\path.obj \
nasmlib\filename.obj nasmlib\rlimit.obj \
nasmlib\readnum.obj nasmlib\numstr.obj \
nasmlib\zerobuf.obj nasmlib\bsi.obj \
nasmlib\rbtree.obj nasmlib\hashtbl.obj \
nasmlib\raa.obj nasmlib\saa.obj \
nasmlib\strlist.obj \
nasmlib\perfhash.obj nasmlib\badenum.obj \
\
common\common.obj \
\
x86\insnsa.obj x86\insnsb.obj x86\insnsd.obj x86\insnsn.obj \
x86\regs.obj x86\regvals.obj x86\regflags.obj x86\regdis.obj \
x86\disp8.obj x86\iflag.obj \
\
asm\error.obj \
asm\floats.obj \
asm\directiv.obj asm\directbl.obj \
asm\pragma.obj \
asm\assemble.obj asm\labels.obj asm\parser.obj \
asm\preproc.obj asm\quote.obj asm\pptok.obj \
asm\listing.obj asm\eval.obj asm\exprlib.obj asm\exprdump.obj \
asm\stdscan.obj \
asm\strfunc.obj asm\tokhash.obj \
asm\segalloc.obj \
asm\rdstrnum.obj \
asm\srcfile.obj \
macros\macros.obj \
\
output\outform.obj output\outlib.obj output\legacy.obj \
output\nulldbg.obj output\nullout.obj \
output\outbin.obj output\outaout.obj output\outcoff.obj \
output\outelf.obj \
output\outobj.obj output\outas86.obj \
output\outdbg.obj output\outieee.obj output\outmacho.obj \
output\codeview.obj \
\
disasm\disasm.obj disasm\sync.obj
# Warnings depend on all source files, so handle them separately
WARNOBJ = asm\warnings.obj
WARNFILES = asm\warnings_c.h include\warnings.h doc\warnings.src
LIBOBJ = $(LIBOBJ_NW) $(WARNOBJ)
ALLOBJ_NW = $(PROGOBJ) $(LIBOBJ_NW)
ALLOBJ = $(PROGOBJ) $(LIBOBJ)
SUBDIRS = stdlib nasmlib include config output asm disasm x86 \
common macros
XSUBDIRS = test doc nsis win
DEPDIRS = . $(SUBDIRS)
#-- End File Lists --#
NASMLIB = libnasm.$(A)
all: nasm$(X) ndisasm$(X)
nasm$(X): $(NASM) $(MANIFEST) $(NASMLIB)
$(CC) /Fe$@ $(NASM) $(ALL_LDFLAGS) $(NASMLIB) $(LIBS)
ndisasm$(X): $(NDISASM) $(MANIFEST) $(NASMLIB)
$(CC) /Fe$@ $(NDISASM) $(ALL_LDFLAGS) $(NASMLIB) $(LIBS)
$(NASMLIB): $(LIBOBJ)
$(AR) $(ARFLAGS) /OUT:$@ $**
# These are specific to certain Makefile syntaxes...
WARNTIMES = $(patsubst %,%.time,$(WARNFILES))
WARNSRCS = $(patsubst %.obj,%.c,$(LIBOBJ_NW))
#-- Begin Generated File Rules --#
# Edit in Makefile.in, not here!
# These source files are automagically generated from data files using
# Perl scripts. They're distributed, though, so it isn't necessary to
# have Perl just to recompile NASM from the distribution.
# Perl-generated source files
PERLREQ_CLEANABLE = \
x86\insnsb.c x86\insnsa.c x86\insnsd.c x86\insnsi.h x86\insnsn.c \
x86\regs.c x86\regs.h x86\regflags.c x86\regdis.c x86\regdis.h \
x86\regvals.c asm\tokhash.c asm\tokens.h asm\pptok.h asm\pptok.c \
x86\iflag.c x86\iflaggen.h \
macros\macros.c \
asm\pptok.ph asm\directbl.c asm\directiv.h \
$(WARNFILES) \
misc\nasmtok.el \
version.h version.mac version.mak nsis\version.nsh
# Special hack to keep config\unconfig.h from getting deleted
# by "make spotless"...
PERLREQ = config\unconfig.h $(PERLREQ_CLEANABLE)
INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph x86\iflags.ph
config\unconfig.h: config\config.h.in autoconf\unconfig.pl
$(RUNPERL) '$(srcdir)'\autoconf\unconfig.pl \
'$(srcdir)' config\config.h.in config\unconfig.h
x86\iflag.c: $(INSDEP)
$(RUNPERL) $(srcdir)\x86\insns.pl -fc \
$(srcdir)\x86\insns.dat x86\iflag.c
x86\iflaggen.h: $(INSDEP)
$(RUNPERL) $(srcdir)\x86\insns.pl -fh \
$(srcdir)\x86\insns.dat x86\iflaggen.h
x86\insnsb.c: $(INSDEP)
$(RUNPERL) $(srcdir)\x86\insns.pl -b \
$(srcdir)\x86\insns.dat x86\insnsb.c
x86\insnsa.c: $(INSDEP)
$(RUNPERL) $(srcdir)\x86\insns.pl -a \
$(srcdir)\x86\insns.dat x86\insnsa.c
x86\insnsd.c: $(INSDEP)
$(RUNPERL) $(srcdir)\x86\insns.pl -d \
$(srcdir)\x86\insns.dat x86\insnsd.c
x86\insnsi.h: $(INSDEP)
$(RUNPERL) $(srcdir)\x86\insns.pl -i \
$(srcdir)\x86\insns.dat x86\insnsi.h
x86\insnsn.c: $(INSDEP)
$(RUNPERL) $(srcdir)\x86\insns.pl -n \
$(srcdir)\x86\insns.dat x86\insnsn.c
# These files contains all the standard macros that are derived from
# the version number.
version.h: version version.pl
$(RUNPERL) $(srcdir)\version.pl h < $(srcdir)\version > version.h
version.mac: version version.pl
$(RUNPERL) $(srcdir)\version.pl mac < $(srcdir)\version > version.mac
version.sed: version version.pl
$(RUNPERL) $(srcdir)\version.pl sed < $(srcdir)\version > version.sed
version.mak: version version.pl
$(RUNPERL) $(srcdir)\version.pl make < $(srcdir)\version > version.mak
nsis\version.nsh: version version.pl
$(RUNPERL) $(srcdir)\version.pl nsis < $(srcdir)\version > nsis\version.nsh
# This source file is generated from the standard macros file
# `standard.mac' by another Perl script. Again, it's part of the
# standard distribution.
macros\macros.c: macros\macros.pl asm\pptok.ph version.mac \
$(srcdir)\macros\*.mac $(srcdir)\output\*.mac
$(RUNPERL) $(srcdir)\macros\macros.pl version.mac \
$(srcdir)\macros\*.mac $(srcdir)\output\*.mac
# These source files are generated from regs.dat by yet another
# perl script.
x86\regs.c: x86\regs.dat x86\regs.pl
$(RUNPERL) $(srcdir)\x86\regs.pl c \
$(srcdir)\x86\regs.dat > x86\regs.c
x86\regflags.c: x86\regs.dat x86\regs.pl
$(RUNPERL) $(srcdir)\x86\regs.pl fc \
$(srcdir)\x86\regs.dat > x86\regflags.c
x86\regdis.c: x86\regs.dat x86\regs.pl
$(RUNPERL) $(srcdir)\x86\regs.pl dc \
$(srcdir)\x86\regs.dat > x86\regdis.c
x86\regdis.h: x86\regs.dat x86\regs.pl
$(RUNPERL) $(srcdir)\x86\regs.pl dh \
$(srcdir)\x86\regs.dat > x86\regdis.h
x86\regvals.c: x86\regs.dat x86\regs.pl
$(RUNPERL) $(srcdir)\x86\regs.pl vc \
$(srcdir)\x86\regs.dat > x86\regvals.c
x86\regs.h: x86\regs.dat x86\regs.pl
$(RUNPERL) $(srcdir)\x86\regs.pl h \
$(srcdir)\x86\regs.dat > x86\regs.h
# Extract warnings from source code. This is done automatically if any
# C files have changed; the script is fast enough that that is
# reasonable, but doesn't update the time stamp if the files aren't
# changed, to avoid rebuilding everything every time. Track the actual
# dependency by the empty file asm\warnings.time.
.PHONY: warnings
warnings: dirs
$(RM_F) $(WARNFILES) $(WARNTIMES) asm\warnings.time
$(MAKE) asm\warnings.time
asm\warnings.time: $(WARNSRCS) asm\warnings.pl
$(EMPTY) asm\warnings.time
$(MAKE) $(WARNTIMES)
asm\warnings_c.h.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl c asm\warnings_c.h $(srcdir)
$(EMPTY) asm\warnings_c.h.time
asm\warnings_c.h: asm\warnings_c.h.time
@: Side effect
include\warnings.h.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl h include\warnings.h $(srcdir)
$(EMPTY) include\warnings.h.time
include\warnings.h: include\warnings.h.time
@: Side effect
doc\warnings.src.time: asm\warnings.pl asm\warnings.time
$(RUNPERL) $(srcdir)\asm\warnings.pl doc doc\warnings.src $(srcdir)
$(EMPTY) doc\warnings.src.time
doc\warnings.src : doc\warnings.src.time
@: Side effect
# Assembler token hash
asm\tokhash.c: x86\insns.dat x86\insnsn.c asm\tokens.dat asm\tokhash.pl \
perllib\phash.ph
$(RUNPERL) $(srcdir)\asm\tokhash.pl c \
x86\insnsn.c $(srcdir)\x86\regs.dat \
$(srcdir)\asm\tokens.dat > asm\tokhash.c
# Assembler token metadata
asm\tokens.h: x86\insns.dat x86\insnsn.c asm\tokens.dat asm\tokhash.pl \
perllib\phash.ph
$(RUNPERL) $(srcdir)\asm\tokhash.pl h \
x86\insnsn.c $(srcdir)\x86\regs.dat \
$(srcdir)\asm\tokens.dat > asm\tokens.h
# Preprocessor token hash
asm\pptok.h: asm\pptok.dat asm\pptok.pl perllib\phash.ph
$(RUNPERL) $(srcdir)\asm\pptok.pl h \
$(srcdir)\asm\pptok.dat asm\pptok.h
asm\pptok.c: asm\pptok.dat asm\pptok.pl perllib\phash.ph
$(RUNPERL) $(srcdir)\asm\pptok.pl c \
$(srcdir)\asm\pptok.dat asm\pptok.c
asm\pptok.ph: asm\pptok.dat asm\pptok.pl perllib\phash.ph
$(RUNPERL) $(srcdir)\asm\pptok.pl ph \
$(srcdir)\asm\pptok.dat asm\pptok.ph
# Directives hash
asm\directiv.h: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
$(RUNPERL) $(srcdir)\nasmlib\perfhash.pl h \
$(srcdir)\asm\directiv.dat asm\directiv.h
asm\directbl.c: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
$(RUNPERL) $(srcdir)\nasmlib\perfhash.pl c \
$(srcdir)\asm\directiv.dat asm\directbl.c
# Emacs token files
misc\nasmtok.el: misc\emacstbl.pl asm\tokhash.c asm\pptok.c \
asm\directiv.dat version
$(RUNPERL) $< $@ "$(srcdir)" "$(objdir)"
#-- End Generated File Rules --#
perlreq: $(PERLREQ)
#-- Begin NSIS Rules --#
# Edit in Makefile.in, not here!
nsis\arch.nsh: nsis\getpearch.pl nasm$(X)
$(PERL) $(srcdir)\nsis\getpearch.pl nasm$(X) > nsis\arch.nsh
# Should only be done after "make everything".
# The use of redirection here keeps makensis from moving the cwd to the
# source directory.
nsis: nsis\nasm.nsi nsis\arch.nsh nsis\version.nsh
$(MAKENSIS) -Dsrcdir="$(srcdir)" -Dobjdir="$(objdir)" - < nsis\nasm.nsi
#-- End NSIS Rules --#
clean:
-del /f /s *.obj
-del /f /s *.pdb
-del /f /s *.s
-del /f /s *.i
-del /f $(NASMLIB) $(RDFLIB)
-del /f nasm$(X)
-del /f ndisasm$(X)
distclean: clean
-del /f config.h
-del /f config.log
-del /f config.status
-del /f Makefile
-del /f /s *~
-del /f /s *.bak
-del /f /s *.lst
-del /f /s *.bin
-del /f /s *.dep
-del /f output\*~
-del /f output\*.bak
-del /f test\*.lst
-del /f test\*.bin
-del /f test\*.obj
-del /f test\*.bin
-del /f/s autom4te*.cache
cleaner: clean
-del /f $(PERLREQ)
-del /f *.man
-del /f nasm.spec
rem cd doc && $(MAKE) clean
spotless: distclean cleaner
-del /f doc\Makefile
-del doc\*~
-del doc\*.bak
strip:
# Abuse doc/Makefile.in to build nasmdoc.pdf only
docs:
cd doc && $(MAKE) /f Makefile.in srcdir=. top_srcdir=.. \
PERL=$(PERL) PDFOPT= nasmdoc.pdf
everything: all docs nsis
#
# Does this version of this file have external dependencies? This definition
# will be automatically updated by mkdep.pl as needed.
#
EXTERNAL_DEPENDENCIES = 1
#
# Generate dependency information for this Makefile only.
# If this Makefile has external dependency information, then
# the dependency information will remain external, so it doesn't
# pollute the git logs.
#
msvc.dep: $(PERLREQ) tools\mkdep.pl
$(RUNPERL) tools\mkdep.pl -M Mkfiles\msvc.mak -- $(DEPDIRS)
dep: msvc.dep
# Include and/or generate msvc.dep as needed. This is too complex to
# use the include-command feature, but we can open-code it here.
MKDEP=0
!IF $(EXTERNAL_DEPENDENCIES) == 1 && $(MKDEP) == 0
!IF EXISTS(msvc.dep)
!INCLUDE msvc.dep
!ELSEIF [$(MAKE) /c MKDEP=1 /f Mkfiles\msvc.mak msvc.dep] == 0
!INCLUDE msvc.dep
!ELSE
!ERROR Unable to rebuild dependencies file msvc.dep
!ENDIF
!ENDIF
#-- Magic hints to mkdep.pl --#
# @object-ending: ".obj"
# @path-separator: "\"
# @exclude: "config/config.h"
# @external: "msvc.dep"
# @selfrule: "1"
#-- Everything below is generated by mkdep.pl - do not edit --#
|