Build system: check $CLEANING instead of $MAKECMDGOALS
authorThomas Miedema <thomasmiedema@gmail.com>
Tue, 26 May 2015 14:07:40 +0000 (16:07 +0200)
committerThomas Miedema <thomasmiedema@gmail.com>
Sat, 30 May 2015 14:49:08 +0000 (16:49 +0200)
To check if we're cleaning, always check the $CLEANING variable, instead
of sometimes $CLEANING, sometimes $MAKECMDGOALS.

[skip ci]

ghc.mk
libraries/integer-gmp/gmp/ghc.mk
rules/build-perl.mk
rules/build-prog.mk
testsuite/mk/boilerplate.mk

diff --git a/ghc.mk b/ghc.mk
index 2f37be8..8ce26d2 100644 (file)
--- 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
 
index 78a7cf0..9c7a2a3 100644 (file)
@@ -46,7 +46,7 @@ endif
 
 ifeq "$(phase)" "final"
 
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$(CLEANING)" "YES"
 include libraries/integer-gmp/gmp/config.mk
 endif
 
index 3f7a026..51e92f7 100644 (file)
@@ -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) $$< $$@
index 88f1b53..9395704 100644 (file)
@@ -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 $$< $$@
index 43bc4df..f8b1dcb 100644 (file)
@@ -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