[commit: ghc] master: Build system: check $CLEANING instead of $MAKECMDGOALS (4de8028)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4de8028d702abbf74cc2abf0c2bfe0c1ec29c26d/ghc

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

commit 4de8028d702abbf74cc2abf0c2bfe0c1ec29c26d
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Tue May 26 16:07:40 2015 +0200

    Build system: check $CLEANING instead of $MAKECMDGOALS
    
    To check if we're cleaning, always check the $CLEANING variable, instead
    of sometimes $CLEANING, sometimes $MAKECMDGOALS.
    
    [skip ci]


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

4de8028d702abbf74cc2abf0c2bfe0c1ec29c26d
 ghc.mk                           | 8 ++++----
 libraries/integer-gmp/gmp/ghc.mk | 2 +-
 rules/build-perl.mk              | 2 +-
 rules/build-prog.mk              | 6 +++---
 testsuite/mk/boilerplate.mk      | 1 +
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/ghc.mk b/ghc.mk
index 2f37be8..8ce26d2 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -140,7 +140,7 @@ echo:
 
 include mk/tree.mk
 
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$(CLEANING)" "YES"
 include mk/config.mk
 ifeq "$(ProjectVersion)" ""
 $(error Please run ./configure first)
@@ -155,7 +155,7 @@ include mk/custom-settings.mk
 SRC_CC_OPTS     += $(WERROR)
 SRC_HC_OPTS     += $(WERROR)
 
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$(CLEANING)" "YES"
 ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES"
 ifeq "$(findstring dyn,$(GhcLibWays))" ""
 $(error dyn is not in $$(GhcLibWays), but $$(DYNAMIC_GHC_PROGRAMS) is YES)
@@ -203,7 +203,7 @@ $(eval $(call clean-target,root,inplace,inplace/bin inplace/lib))
 # When we're just doing 'make clean' or 'make show', then we don't need
 # to build dependencies.
 
-ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifeq "$(CLEANING)" "YES"
 NO_INCLUDE_DEPS = YES
 NO_INCLUDE_PKGDATA = YES
 endif
@@ -650,7 +650,7 @@ endif
 
 ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
 BUILD_DIRS += libraries/integer-gmp/gmp
-else ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
+else ifeq "$(CLEANING)" "YES"
 BUILD_DIRS += libraries/integer-gmp/gmp
 endif
 
diff --git a/libraries/integer-gmp/gmp/ghc.mk b/libraries/integer-gmp/gmp/ghc.mk
index 78a7cf0..9c7a2a3 100644
--- a/libraries/integer-gmp/gmp/ghc.mk
+++ b/libraries/integer-gmp/gmp/ghc.mk
@@ -46,7 +46,7 @@ endif
 
 ifeq "$(phase)" "final"
 
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$(CLEANING)" "YES"
 include libraries/integer-gmp/gmp/config.mk
 endif
 
diff --git a/rules/build-perl.mk b/rules/build-perl.mk
index 3f7a026..51e92f7 100644
--- a/rules/build-perl.mk
+++ b/rules/build-perl.mk
@@ -52,7 +52,7 @@ $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE))
 clean_$1 : clean_$1_$2
 
 # INPLACE_BIN etc. might be empty if we're cleaning
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$$(CLEANING)" "YES"
 ifneq "$$(BINDIST)" "YES"
 $1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$$$(unlit_INPLACE) | $$$$(dir $$$$@)/.
 	"$$(unlit_INPLACE)" $$(UNLIT_OPTS) $$< $$@
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 88f1b53..9395704 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -81,13 +81,13 @@ endif
 $1_$2_depfile_base = $1/$2/build/.depend
 
 ifeq "$$($1_$2_INSTALL_INPLACE)" "NO"
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$$(CLEANING)" "YES"
 $1_$2_INPLACE = $$(error $1_$2 should not be installed inplace, but INPLACE var evaluated)
 else
 $1_$2_INPLACE =
 endif
 else
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$$(CLEANING)" "YES"
 ifneq "$$($$($1_$2_PROGNAME)_INPLACE)" ""
 $$(error $$($1_$2_PROGNAME)_INPLACE defined twice)
 endif
@@ -279,7 +279,7 @@ endif
 endif
 
 # INPLACE_BIN might be empty if we're distcleaning
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$$(CLEANING)" "YES"
 ifeq "$$($1_$2_INSTALL_INPLACE)" "YES"
 $$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG_INPLACE) | $$$$(dir $$$$@)/.
 	$$(INSTALL) -m 755 $$< $$@
diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk
index 43bc4df..f8b1dcb 100644
--- a/testsuite/mk/boilerplate.mk
+++ b/testsuite/mk/boilerplate.mk
@@ -187,6 +187,7 @@ $(ghc-config-mk) : $(TOP)/mk/ghc-config
 	$(TOP)/mk/ghc-config "$(TEST_HC)" >"$@"; if [ $$? != 0 ]; then $(RM) "$@"; exit 1; fi
 # If the ghc-config fails, remove $@, and fail
 
+# Note: $(CLEANING) is not defined in the testsuite.
 ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
 include $(ghc-config-mk)
 endif



More information about the ghc-commits mailing list