From cd12c32de77ac18a69ed1733a558095567ec5ba8 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 14 May 2009 10:56:45 +0000 Subject: [PATCH] make repeated 'make distclean' not fail --- Makefile | 5 ++++- ghc.mk | 9 ++++++++- rules/build-prog.mk | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d4303b6..e5b2115 100644 --- a/Makefile +++ b/Makefile @@ -32,11 +32,14 @@ else default : all @: +ifneq "$(findstring clean,$(MAKECMDGOALS))" "" +-include mk/config.mk +else include mk/config.mk - ifeq "$(ProjectVersion)" "" $(error Please run ./configure first) endif +endif include mk/custom-settings.mk diff --git a/ghc.mk b/ghc.mk index fa28608..3d5ead2 100644 --- a/ghc.mk +++ b/ghc.mk @@ -134,18 +134,23 @@ show: # ----------------------------------------------------------------------------- # Include subsidiary build-system bits +ifneq "$(findstring clean,$(MAKECMDGOALS))" "" +-include mk/config.mk +else include mk/config.mk - ifeq "$(ProjectVersion)" "" $(error Please run ./configure first) endif +endif # (Optional) build-specific configuration include mk/custom-settings.mk +ifeq "$(findstring clean,$(MAKECMDGOALS))" "" ifeq "$(GhcLibWays)" "" $(error $$(GhcLibWays) is empty, it must contain at least one way) endif +endif # ----------------------------------------------------------------------------- # Macros for standard targets @@ -559,9 +564,11 @@ libraries/base3-compat_dist-install_HC_OPTS += -XPackageImports ifneq "$(BINDIST)" "YES" +ifneq "$(BOOTSTRAPPING_CONF)" "" ifeq "$(wildcard $(BOOTSTRAPPING_CONF))" "" $(shell echo "[]" >$(BOOTSTRAPPING_CONF)) endif +endif $(eval $(call clean-target,$(BOOTSTRAPPING_CONF),,$(BOOTSTRAPPING_CONF))) diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 8f01e66..8397f3f 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -128,10 +128,13 @@ endif $(call all-target,$1_$2,$$($1_$2_INPLACE)) $(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE)) +# INPLACE_BIN might be empty if we're distcleaning +ifneq "$$(INPLACE_BIN)" "" $$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) $$(MKDIRHIER) $$(MKDIRHIER) $$(dir $$@) $$(CP) -p $$< $$@ touch $$@ +endif # touch is necessary; cp doesn't update the file time. endif -- 1.7.10.4