Remove dead code isHsVar
[ghc-hetmet.git] / ghc.mk
diff --git a/ghc.mk b/ghc.mk
index f77f9eb..61e17ee 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -51,9 +51,7 @@
 #
 # Tickets we can now close, or fix and close:
 #
-#   * 2966 make sure --with-gcc does the right thing (#2966)
 #   * 1693 make distclean
-#   * 2689 make maintainer-clean
 #   * 3173 make install with DESTDIR
 
 # Possible cleanups:
 #           o libraries/*
 #           o compiler
 
+.PHONY: default all haddock
+
 default : all
 
 # Just bring makefiles up to date:
@@ -134,6 +134,8 @@ show:
 # -----------------------------------------------------------------------------
 # Include subsidiary build-system bits
 
+include mk/tree.mk
+
 ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
 include mk/config.mk
 ifeq "$(ProjectVersion)" ""
@@ -171,6 +173,10 @@ ifneq "$(findstring clean,$(MAKECMDGOALS))" ""
 NO_INCLUDE_DEPS = YES
 NO_INCLUDE_PKGDATA = YES
 endif
+ifneq "$(findstring bootstrapping-files,$(MAKECMDGOALS))" ""
+NO_INCLUDE_DEPS = YES
+NO_INCLUDE_PKGDATA = YES
+endif
 ifeq "$(findstring show,$(MAKECMDGOALS))" "show"
 NO_INCLUDE_DEPS = YES
 # We want package-data.mk for show
@@ -211,6 +217,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
 
@@ -227,6 +237,8 @@ $(foreach way,$(ALL_WAYS),\
 
 include rules/c-suffix-rules.mk
 
+endif
+
 # -----------------------------------------------------------------------------
 # Building package-data.mk files from .cabal files
 
@@ -318,6 +330,7 @@ endif
 
 PACKAGES += haskeline
 
+ifneq "$(BootingFromHc)" "YES"
 PACKAGES_STAGE2 += \
        dph/dph-base \
        dph/dph-prim-interface \
@@ -325,6 +338,7 @@ PACKAGES_STAGE2 += \
        dph/dph-prim-par \
        dph/dph-seq \
        dph/dph-par
+endif
 
 BOOT_PKGS = Cabal hpc extensible-exceptions
 
@@ -340,7 +354,8 @@ ifeq "$(BuildSharedLibs)" "YES"
 OTHER_LIBS  += libffi/libHSffi$(dyn_libsuf)
 endif
 ifeq "$(HaveLibGmp)" "NO"
-OTHER_LIBS += gmp/libgmp.a
+GMP_LIB = gmp/libgmp.a
+OTHER_LIBS += $(GMP_LIB)
 endif
 
 # We cannot run ghc-cabal to configure a package until we have
@@ -455,11 +470,15 @@ BUILD_DIRS += \
    gmp \
    docs/users_guide \
    libraries/Cabal/doc \
-   $(GHC_MANGLER_DIR) \
-   $(GHC_SPLIT_DIR) \
    $(GHC_UNLIT_DIR) \
    $(GHC_HP2PS_DIR)
 
+ifneq "$(GhcUnregisterised)" "YES"
+BUILD_DIRS += \
+   $(GHC_MANGLER_DIR) \
+   $(GHC_SPLIT_DIR)
+endif
+
 ifneq "$(BINDIST)" "YES"
 BUILD_DIRS += \
    $(GHC_GENPRIMOP_DIR)
@@ -485,9 +504,12 @@ BUILD_DIRS += \
 
 ifneq "$(CLEANING)" "YES"
 BUILD_DIRS += \
-   $(patsubst %, libraries/%, $(PACKAGES) $(PACKAGES_STAGE2)) \
+   $(patsubst %, libraries/%, $(PACKAGES) $(PACKAGES_STAGE2))
+ifneq "$(BootingFromHc)" "YES"
+BUILD_DIRS += \
    libraries/dph
 endif
+endif
 
 BUILD_DIRS += \
    compiler \
@@ -547,7 +569,7 @@ $(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-instal
 # XXX Hack; remove this
 $(foreach pkg,$(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += -Wwarn))
 
-# XXX we configure packages with the bootsrapping compiler (for
+# XXX we configure packages with the bootstrapping compiler (for
 # dependency reasons, see the phase ordering), which doesn't
 # necessarily support all the extensions we need, and Cabal filters
 # out the ones it thinks aren't supported.
@@ -741,6 +763,7 @@ $(eval $(call bindist,.,\
     $(filter-out %/project.mk,$(filter-out mk/config.mk,$(MAKEFILE_LIST))) \
        mk/fix_install_names.sh \
        mk/project.mk \
+       libraries/dph/LICENSE \
  ))
 # mk/project.mk gets an absolute path, so we manually include it in
 # the bindist with a relative path
@@ -857,7 +880,7 @@ publish-sdist :
 endif
 
 ifeq "$(GhcUnregisterised)" "YES"
-SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER
+SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
 endif
 
 # -----------------------------------------------------------------------------
@@ -869,6 +892,7 @@ CLEAN_FILES += utils/ghc-pwd/ghc-pwd
 CLEAN_FILES += utils/ghc-pwd/ghc-pwd.exe
 CLEAN_FILES += utils/ghc-pwd/ghc-pwd.hi
 CLEAN_FILES += utils/ghc-pwd/ghc-pwd.o
+CLEAN_FILES += libraries/bootstrapping.conf
 
 clean : clean_files
 .PHONY: clean_files
@@ -910,3 +934,9 @@ maintainer-clean : distclean
 
 .PHONY: all_libraries
 
+.PHONY: bootstrapping-files
+bootstrapping-files: $(OTHER_LIBS)
+bootstrapping-files: includes/ghcautoconf.h
+bootstrapping-files: includes/DerivedConstants.h
+bootstrapping-files: includes/GHCConstants.h
+