[commit: ghc] master: Build system: always use `make -r` (577d315)

git at git.haskell.org git at git.haskell.org
Sat May 30 15:08:53 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/577d315824440bba5e2f56d2eeba9bd8c5ee17e4/ghc

>---------------------------------------------------------------

commit 577d315824440bba5e2f56d2eeba9bd8c5ee17e4
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Wed May 20 19:57:57 2015 +0200

    Build system: always use `make -r`
    
    Do what this comment was suggesting:
    
        "Ideally we'd like to have 'make -r' turned on by default, because
        that disables all the implicit rules, but there doesn't seem to be a
        good way to do that."
    
    This change doesn't seem to have much effect on the time it takes to run
    make. Apparently clearing .SUFFIXES was enough for that. But it does
    make the output of `make -d` quite a bit shorter, which is nice.
    
    Note: ghc.mk is always called indirectly, so no need to set .SUFFIXES or
    MAKEFLAGS there again.
    
    Differential Revision: https://phabricator.haskell.org/D915


>---------------------------------------------------------------

577d315824440bba5e2f56d2eeba9bd8c5ee17e4
 Makefile                    | 28 ++++++++++++++++++----------
 ghc.mk                      |  6 ------
 mk/sub-makefile.mk          |  7 ++++++-
 testsuite/mk/boilerplate.mk |  7 +++++++
 4 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index 950126c..9913803 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,14 @@
 #
 # -----------------------------------------------------------------------------
 
+# Eliminate use of the built-in implicit rules, and clear out the default list
+# of suffixes for suffix rules. Speeds up make quite a bit. Both are needed
+# for the shortest `make -d` output.
+# Don't set --no-builtin-variables; some rules might stop working if you do
+# (e.g. 'make clean' in testsuite/ currently relies on an implicit $RM).
+MAKEFLAGS += --no-builtin-rules
+.SUFFIXES:
+
 ifeq "$(wildcard distrib/)" ""
 
 # We're in a bindist
@@ -21,7 +29,7 @@ default:
 
 .PHONY: install show
 install show:
-	$(MAKE) -r --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES
+	$(MAKE) --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES
 
 else
 
@@ -70,14 +78,14 @@ REALGOALS=$(filter-out binary-dist binary-dist-prep bootstrapping-files framewor
 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
 ifneq "$(OMIT_PHASE_0)" "YES"
 	@echo "===--- building phase 0"
-	$(MAKE) -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
+	$(MAKE) --no-print-directory -f ghc.mk phase=0 phase_0_builds
 endif
 ifneq "$(OMIT_PHASE_1)" "YES"
 	@echo "===--- building phase 1"
-	$(MAKE) -r --no-print-directory -f ghc.mk phase=1 phase_1_builds
+	$(MAKE) --no-print-directory -f ghc.mk phase=1 phase_1_builds
 endif
 	@echo "===--- building final phase"
-	$(MAKE) -r --no-print-directory -f ghc.mk phase=final $@
+	$(MAKE) --no-print-directory -f ghc.mk phase=final $@
 
 .PHONY: binary-dist
 binary-dist: binary-dist-prep
@@ -86,25 +94,25 @@ binary-dist: binary-dist-prep
 .PHONY: binary-dist-prep
 binary-dist-prep:
 ifeq "$(mingw32_TARGET_OS)" "1"
-	$(MAKE) -r --no-print-directory -f ghc.mk windows-binary-dist-prep
+	$(MAKE) --no-print-directory -f ghc.mk windows-binary-dist-prep
 else
 	rm -f bindist-list
-	$(MAKE) -r --no-print-directory -f ghc.mk bindist BINDIST=YES
-	$(MAKE) -r --no-print-directory -f ghc.mk unix-binary-dist-prep
+	$(MAKE) --no-print-directory -f ghc.mk bindist BINDIST=YES
+	$(MAKE) --no-print-directory -f ghc.mk unix-binary-dist-prep
 endif
 
 .PHONY: clean distclean maintainer-clean
 clean distclean maintainer-clean:
-	$(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
+	$(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
 	test ! -d testsuite || $(MAKE) -C testsuite $@
 
 .PHONY: $(filter clean_%,$(MAKECMDGOALS))
 $(filter clean_%, $(MAKECMDGOALS)) : clean_% :
-	$(MAKE) -r --no-print-directory -f ghc.mk $@ CLEANING=YES
+	$(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES
 
 .PHONY: bootstrapping-files show echo
 bootstrapping-files show echo:
-	$(MAKE) -r --no-print-directory -f ghc.mk $@
+	$(MAKE) --no-print-directory -f ghc.mk $@
 
 ifeq "$(darwin_TARGET_OS)" "1"
 .PHONY: framework-pkg
diff --git a/ghc.mk b/ghc.mk
index d918087..5c239cd 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -107,12 +107,6 @@ nothing=
 space=$(nothing) $(nothing)
 comma=,
 
-# Cancel all suffix rules.  Ideally we'd like to have 'make -r' turned on
-# by default, because that disables all the implicit rules, but there doesn't
-# seem to be a good way to do that.  This turns off all the old-style suffix
-# rules, which does half the job and speeds up make quite a bit:
-.SUFFIXES:
-
 # -----------------------------------------------------------------------------
 # Makefile debugging
 #
diff --git a/mk/sub-makefile.mk b/mk/sub-makefile.mk
index 0ed85c8..12f47f0 100644
--- a/mk/sub-makefile.mk
+++ b/mk/sub-makefile.mk
@@ -9,7 +9,12 @@
 #  make clean  ==>  make -C $(TOP) clean_dir
 #
 
-# Important, otherwise we get silly built-in rules:
+# Eliminate use of the built-in implicit rules, and clear out the default list
+# of suffixes for suffix rules. Speeds up make quite a bit. Both are needed
+# for the shortest `make -d` output.
+# Don't set --no-builtin-variables; some rules might stop working if you do
+# (e.g. 'make clean' in testsuite/ currently relies on an implicit $RM).
+MAKEFLAGS += --no-builtin-rules
 .SUFFIXES:
 
 TOPMAKE = $(MAKE) -C $(TOP)
diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk
index f8b1dcb..d5b7fb5 100644
--- a/testsuite/mk/boilerplate.mk
+++ b/testsuite/mk/boilerplate.mk
@@ -1,3 +1,10 @@
+# Eliminate use of the built-in implicit rules, and clear out the default list
+# of suffixes for suffix rules. Speeds up make quite a bit. Both are needed
+# for the shortest `make -d` output.
+# Don't set --no-builtin-variables; some rules might stop working if you do
+# (e.g. 'make clean' in testsuite/ currently relies on an implicit $RM).
+MAKEFLAGS += --no-builtin-rules
+.SUFFIXES:
 
 default: all
 



More information about the ghc-commits mailing list