summaryrefslogtreecommitdiff
path: root/Makefile.in
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2017-11-06 22:37:37 -0800
committerH. Peter Anvin <hpa@zytor.com>2017-11-06 22:37:37 -0800
commitceeaf11e66d7e1b7ad511446f308337981f71a71 (patch)
tree944768624006cd475296e3d7575bcac4ead0e1e7 /Makefile.in
parentad4016952d566ca5f95566676b2d4d126da92e54 (diff)
downloadnasm-ceeaf11e66d7e1b7ad511446f308337981f71a71.tar.gz
Make dependency generation a bit more robust
Improve the corner cases where we might end up with bogus dependencies. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'Makefile.in')
-rw-r--r--Makefile.in67
1 files changed, 49 insertions, 18 deletions
diff --git a/Makefile.in b/Makefile.in
index dfc7cade..1913277f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66,6 +66,7 @@ ifeq ($(TRACE),1)
CFLAGS += -DNASM_TRACE
endif
+.SUFFIXES:
.SUFFIXES: .c .i .s .$(O) .$(A) $(X) .1 .txt .xml
.PHONY: all doc rdf install clean distclean cleaner spotless install_rdf test
@@ -87,10 +88,6 @@ endif
.xml.1:
$(XMLTO) man --skip-validation $< 2>/dev/null
-# This rule is only used for rdoff, to allow common rules
-.$(O)$(X):
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $< $(RDFLIB) $(NASMLIB) $(LIBS)
-
#-- Begin File Lists --#
NASM = asm/nasm.$(O)
NDISASM = disasm/ndisasm.$(O)
@@ -291,11 +288,19 @@ 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)
@@ -357,16 +362,17 @@ clean:
distclean: clean
$(RM_F) config.log config.status config/config.h
- $(RM_F) Makefile
for d in . $(SUBDIRS) $(XSUBDIRS); do \
$(RM_F) "$$d"/*~ "$$d"/*.bak "$$d"/*.lst "$$d"/*.bin ; \
done
$(RM_F) test/*.$(O)
$(RM_RF) autom4te*.cache
+ $(RM_F) Makefile *.dep
cleaner: clean
$(RM_F) $(PERLREQ) *.1 nasm.spec
$(MAKE) -C doc clean
+ $(RM_F) *.dep
spotless: distclean cleaner
$(RM_F) doc/Makefile
@@ -443,6 +449,24 @@ golden: nasm$(X)
cd test && $(RUNPERL) performtest.pl --golden --nasm=../nasm *.asm
#
+# Rules to re-run autoconf if necessary
+#
+config/config.h.in: configure.ac
+ autoheader
+
+configure: configure.ac config/config.h.in
+ autoconf
+
+config.status: configure Makefile.in doc/Makefile.in config/config.h.in
+ sh config.status --recheck
+
+Makefile: config.status
+
+doc/Makefile: config.status
+
+config/config.h: config.status
+
+#
# Does this version of this file have external dependencies? This definition
# will be automatically updated by mkdep.pl as needed.
#
@@ -454,38 +478,44 @@ EXTERNAL_DEPENDENCIES = 1
# the dependency information will remain external, so it doesn't
# pollute the git logs.
#
-deps: perlreq tools/mkdep.pl
+Makefile.dep: $(PERLREQ) tools/mkdep.pl config.status
$(RUNPERL) tools/mkdep.pl -M Makefile.in -- $(DEPDIRS)
- ./config.status
-Makefile.dep: deps
+dep: Makefile.dep
#
+#
# This build dependencies in *ALL* makefiles, and forces all
# dependencies to be inserted inline. For that reason, it should only
# be invoked manually or via "make dist". It should be run before
# creating release archives.
#
-alldeps: perlreq tools/syncfiles.pl tools/mkdep.pl
+alldeps: $(PERLREQ) tools/syncfiles.pl tools/mkdep.pl
$(RUNPERL) tools/syncfiles.pl Makefile.in Mkfiles/*.mak
$(RUNPERL) tools/mkdep.pl -i -M Makefile.in Mkfiles/*.mak -- \
$(DEPDIRS)
- $(RM_F) Makefile.dep Mkfiles/*.dep
- if [ $(EXTERNAL_DEPENDENCIES) -eq 1 ]; then \
- ./config.status --recheck; \
- else \
- ./config.status; \
+ $(RM_F) *.dep
+ if [ -f config.status ]; then \
+ if [ $(EXTERNAL_DEPENDENCIES) -eq 1 ]; then \
+ ./config.status --recheck; \
+ else \
+ ./config.status; \
+ fi \
fi
# Strip internal dependency information from all Makefiles; this makes
# the output good for git checkin
-cleandeps: perlreq tools/syncfiles.pl tools/mkdep.pl
+cleandeps: $(PERLREQ) qtools/syncfiles.pl tools/mkdep.pl
$(RUNPERL) tools/syncfiles.pl Makefile.in Mkfiles/*.mak
$(RUNPERL) tools/mkdep.pl -e -M Makefile.in Mkfiles/*.mak -- \
$(DEPDIRS)
- $(RM_F) Makefile.dep Mkfiles/*.dep
- if [ $(EXTERNAL_DEPENDENCIES) -eq 0 ]; then \
- ./config.status --recheck; \
+ $(RM_F) *.dep
+ if [ -f config.status ]; then \
+ if [ $(EXTERNAL_DEPENDENCIES) -eq 0 ]; then \
+ ./config.status --recheck; \
+ else \
+ ./config.status; \
+ fi \
fi
#-- Magic hints to mkdep.pl --#
@@ -493,5 +523,6 @@ cleandeps: perlreq tools/syncfiles.pl tools/mkdep.pl
# @path-separator: "/"
# @external: "Makefile.dep"
# @include-command: "-include"
+# @selfrule: "1"
#-- Everything below is generated by mkdep.pl - do not edit --#
-include Makefile.dep