Tweak bindist creation
[ghc-hetmet.git] / ghc.mk
diff --git a/ghc.mk b/ghc.mk
index 3d5ead2..3271dc4 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -134,9 +134,9 @@ show:
 # -----------------------------------------------------------------------------
 # Include subsidiary build-system bits
 
-ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
--include mk/config.mk
-else
+include mk/tree.mk
+
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
 include mk/config.mk
 ifeq "$(ProjectVersion)" ""
 $(error Please run ./configure first)
@@ -213,6 +213,10 @@ include rules/c-objs.mk
 # -----------------------------------------------------------------------------
 # Suffix rules
 
+# Suffix rules cause "make clean" to fail on Windows (trac #3233)
+# so we don't make any when cleaning.
+ifneq "$(CLEANING)" "YES"
+
 include rules/hs-suffix-rules-srcdir.mk
 include rules/hs-suffix-rules.mk
 
@@ -229,6 +233,8 @@ $(foreach way,$(ALL_WAYS),\
 
 include rules/c-suffix-rules.mk
 
+endif
+
 # -----------------------------------------------------------------------------
 # Building package-data.mk files from .cabal files
 
@@ -320,7 +326,6 @@ endif
 
 PACKAGES += haskeline
 
-ifneq "$(wildcard libraries/dph)" ""
 PACKAGES_STAGE2 += \
        dph/dph-base \
        dph/dph-prim-interface \
@@ -328,7 +333,6 @@ PACKAGES_STAGE2 += \
        dph/dph-prim-par \
        dph/dph-seq \
        dph/dph-par
-endif
 
 BOOT_PKGS = Cabal hpc extensible-exceptions
 
@@ -485,13 +489,18 @@ endif
 
 BUILD_DIRS += \
    utils/haddock \
-   utils/haddock/doc \
-   $(patsubst %, libraries/%, $(PACKAGES)) \
-   $(patsubst %, libraries/%, $(PACKAGES_STAGE2)) \
+   utils/haddock/doc
+
+ifneq "$(CLEANING)" "YES"
+BUILD_DIRS += \
+   $(patsubst %, libraries/%, $(PACKAGES) $(PACKAGES_STAGE2)) \
+   libraries/dph
+endif
+
+BUILD_DIRS += \
    compiler \
    $(GHC_HSC2HS_DIR) \
    $(GHC_PKG_DIR) \
-   utils/hasktags \
    utils/hpc \
    utils/runghc \
    ghc
@@ -522,7 +531,6 @@ ifneq "$(findstring $(phase),0 1 2 3)" ""
 utils/haddock_dist_DISABLE = YES
 utils/runghc_dist_DISABLE = YES
 utils/hpc_dist_DISABLE = YES
-utils/hasktags_dist_DISABLE = YES
 utils/hsc2hs_dist-install_DISABLE = YES
 utils/ghc-pkg_dist-install_DISABLE = YES
 compiler_stage2_DISABLE = YES
@@ -533,9 +541,6 @@ $(foreach lib,$(PACKAGES) $(PACKAGES_STAGE2),$(eval \
   libraries/$(lib)_dist-install_DISABLE = YES))
 endif
 
-ifneq "$(wildcard libraries/dph)" ""
-include libraries/dph/ghc.mk
-endif
 include $(patsubst %, %/ghc.mk, $(BUILD_DIRS))
 
 # We need -fno-warn-deprecated-flags to avoid failure with -Werror
@@ -799,10 +804,7 @@ SRC_DIST_FILES += \
        aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \
        ghc.spec.in ghc.spec extra-gcc-opts.in VERSION boot ghc.mk
 
-EXTRA_LIBS=$(patsubst %, $(SRC_DIST_NAME)/%, $(shell grep -E "extralibs|dph" packages | grep -v "^\#" | sed "s/ .*//"))
-
 SRC_DIST_TARBALL = ghc-$(ProjectVersion)-src.tar.bz2
-SRC_DIST_EXTRALIBS_TARBALL = ghc-$(ProjectVersion)-src-extralibs.tar.bz2
 
 VERSION :
        echo $(ProjectVersion) >VERSION
@@ -849,8 +851,6 @@ sdist-prep :
 
 .PHONY: sdist
 sdist : sdist-prep
-       $(TAR) chf - $(EXTRA_LIBS) | bzip2 >$(TOP)/$(SRC_DIST_EXTRALIBS_TARBALL)
-       $(RM) -rf $(EXTRA_LIBS)
        $(TAR) chf - $(SRC_DIST_NAME) 2>$src_log | bzip2 >$(TOP)/$(SRC_DIST_TARBALL)
 
 sdist-manifest : $(SRC_DIST_TARBALL)
@@ -861,7 +861,6 @@ sdist-manifest : $(SRC_DIST_TARBALL)
 # over SSH.
 ifneq "$(PublishLocation)" ""
 publish-sdist :
-       $(call nTimes,10,$(PublishCp) $(SRC_DIST_EXTRALIBS_TARBALL) $(PublishLocation)/dist)
        $(call nTimes,10,$(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist)
 endif
 
@@ -883,6 +882,9 @@ clean : clean_files
 .PHONY: clean_files
 clean_files :
        $(RM) $(CLEAN_FILES)
+       $(RM) -r $(patsubst %, libraries/%/dist, $(PACKAGES) $(PACKAGES_STAGE2))
+       $(RM) -r $(patsubst %, libraries/%/dist-install, $(PACKAGES) $(PACKAGES_STAGE2))
+       $(RM) -r $(patsubst %, libraries/%/dist-boot, $(PACKAGES) $(PACKAGES_STAGE2))
 
 distclean : clean
        $(RM) config.cache config.status config.log mk/config.h mk/stamp-h
@@ -894,12 +896,20 @@ distclean : clean
        $(RM) libraries/process/include/HsProcessConfig.h
        $(RM) libraries/unix/include/HsUnixConfig.h
        $(RM) libraries/old-time/include/HsTimeConfig.h
+       $(RM) $(patsubst %, libraries/%/config.log, $(PACKAGES) $(PACKAGES_STAGE2))
+       $(RM) $(patsubst %, libraries/%/config.status, $(PACKAGES) $(PACKAGES_STAGE2))
+       $(RM) $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES) $(PACKAGES_STAGE2))
+       $(RM) -r $(patsubst %, libraries/%/autom4te.cache, $(PACKAGES) $(PACKAGES_STAGE2))
 
 maintainer-clean : distclean
        $(RM) configure mk/config.h.in
        $(RM) -r autom4te.cache libraries/*/autom4te.cache
        $(RM) ghc.spec
-       $(RM) libraries/*/GNUmakefile libraries/*/ghc.mk libraries/*/configure 
+       $(RM) $(patsubst %, libraries/%/GNUmakefile, \
+               $(PACKAGES) $(PACKAGES_STAGE2))
+       $(RM) $(patsubst %, libraries/%/ghc.mk, $(PACKAGES) $(PACKAGES_STAGE2))
+       $(RM) $(patsubst %, libraries/%/configure, \
+               $(PACKAGES) $(PACKAGES_STAGE2))
        $(RM) libraries/base/include/HsBaseConfig.h.in
        $(RM) libraries/directory/include/HsDirectoryConfig.h.in
        $(RM) libraries/process/include/HsProcessConfig.h.in