summaryrefslogtreecommitdiff
path: root/Mkfiles
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2018-06-18 13:50:25 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2018-06-18 13:54:43 -0700
commit5d8193367e638092f35f5e54128795329f42a746 (patch)
treeda09ed568973f3f311ffb1b6bd959e93180885ca /Mkfiles
parentef4e5e209fd1ad9e2ffff9112a66bb2b73225d8f (diff)
downloadnasm-5d8193367e638092f35f5e54128795329f42a746.tar.gz
MSVC: fix dependency generation and building RDOFF under MSVC
1. The mkdep.pl program didn't handle excluded dependencies correctly, causing it to error out due to config/config.h not existing. 2. NMAKE is sensitive to the order suffixes appear in .SUFFIXES, causing it to try to use the builtin rule .c.exe instead of .c.obj -> .obj.exe. 3. NMAKE doesn't handle the && operator between commands. 4. The !ifdef jungle around dependency generation was wrong. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'Mkfiles')
-rw-r--r--Mkfiles/msvc.mak39
1 files changed, 17 insertions, 22 deletions
diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak
index 430fa2d3..9aec80fc 100644
--- a/Mkfiles/msvc.mak
+++ b/Mkfiles/msvc.mak
@@ -46,7 +46,7 @@ RUNPERL = $(PERL) $(PERLFLAGS)
MAKENSIS = makensis
-RM_F = del /f
+RM_F = -del /f
LN_S = copy
# Binary suffixes
@@ -54,15 +54,11 @@ O = obj
A = lib
X = .exe
.SUFFIXES:
-.SUFFIXES: .c .i .s .$(O) .$(A) .exe .1 .man
+.SUFFIXES: $(X) .$(A) .$(O) .c .i .s .1 .man
.c.obj:
$(CC) /c $(ALL_CFLAGS) /Fo$@ $<
-# This rule is only used for rdoff
-.obj.exe:
- $(CC) $(ALL_CFLAGS) /Fe$@ $< $(LDFLAGS) $(RDFLIB) $(NASMLIB) $(LIBS)
-
#-- Begin File Lists --#
# Edit in Makefile.in, not here!
NASM = asm\nasm.$(O)
@@ -252,6 +248,13 @@ asm\directbl.c: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
perlreq: $(PERLREQ)
+# This rule is only used for RDOFF
+.obj.exe:
+ $(CC) /Fe$@ $< $(LDFLAGS) $(RDFLIB) $(NASMLIB) $(LIBS)
+
+RDFLN = copy
+RDFLNPFX = rdoff^\
+
#-- Begin RDOFF Shared Rules --#
# Edit in Makefile.in, not here!
@@ -267,31 +270,23 @@ RDF2BINLINKS = rdoff\rdf2com$(X) rdoff\rdf2ith$(X) \
RDFLIB = rdoff\librdoff.$(A)
RDFLIBS = $(RDFLIB) $(NASMLIB)
-# This rule is only used for rdoff, to allow common rules
-MAKERDF = $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $< $(RDFLIB) $(NASMLIB) $(LIBS)
-
rdoff\rdfdump$(X): rdoff\rdfdump.$(O) $(RDFLIBS)
- $(MAKERDF)
rdoff\ldrdf$(X): rdoff\ldrdf.$(O) $(RDFLIBS)
- $(MAKERDF)
rdoff\rdx$(X): rdoff\rdx.$(O) $(RDFLIBS)
- $(MAKERDF)
rdoff\rdflib$(X): rdoff\rdflib.$(O) $(RDFLIBS)
- $(MAKERDF)
rdoff\rdf2bin$(X): rdoff\rdf2bin.$(O) $(RDFLIBS)
- $(MAKERDF)
rdoff\rdf2com$(X): rdoff\rdf2bin$(X)
$(RM_F) rdoff\rdf2com$(X)
- cd rdoff && $(LN_S) rdf2bin$(X) rdf2com$(X)
+ $(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2com$(X)
rdoff\rdf2ith$(X): rdoff\rdf2bin$(X)
$(RM_F) rdoff\rdf2ith$(X)
- cd rdoff && $(LN_S) rdf2bin$(X) rdf2ith$(X)
+ $(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2ith$(X)
rdoff\rdf2ihx$(X): rdoff\rdf2bin$(X)
$(RM_F) rdoff\rdf2ihx$(X)
- cd rdoff && $(LN_S) rdf2bin$(X) rdf2ihx$(X)
+ $(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2ihx$(X)
rdoff\rdf2srec$(X): rdoff\rdf2bin$(X)
$(RM_F) rdoff\rdf2srec$(X)
- cd rdoff && $(LN_S) rdf2bin$(X) rdf2srec$(X)
+ $(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2srec$(X)
#-- End RDOFF Shared Rules --#
@@ -384,21 +379,21 @@ 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.
-!IF $(EXTERNAL_DEPENDENCIES) == 1
-!IFDEF MKDEP
+MKDEP=0
+!IF $(EXTERNAL_DEPENDENCIES) == 1 && $(MKDEP) == 0
!IF EXISTS(msvc.dep)
!INCLUDE msvc.dep
-!ENDIF
!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: ".$(O)"
# @path-separator: "\"
-# @exclude: "config/config.h"
+# @exclude: "config\config.h"
# @external: "msvc.dep"
# @selfrule: "1"
#-- Everything below is generated by mkdep.pl - do not edit --#