Get rid of non-exhaustive lambda
[ghc-hetmet.git] / ghc.mk
diff --git a/ghc.mk b/ghc.mk
index f79732c..1a45caa 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -153,6 +153,7 @@ endif
 # -----------------------------------------------------------------------------
 # Utility definitions
 
+include rules/trace.mk
 include rules/make-command.mk
 
 # -----------------------------------------------------------------------------
@@ -279,6 +280,7 @@ include rules/build-package.mk
 include rules/build-package-way.mk
 include rules/haddock.mk
 include rules/tags-package.mk
+include rules/extra-packages.mk
 
 # -----------------------------------------------------------------------------
 # Registering hand-written package descriptions (used in libffi and rts)
@@ -298,20 +300,29 @@ include rules/bindist.mk
 # -----------------------------------------------------------------------------
 # Building libraries
 
-define addPackage # args: $1 = package, $2 = condition
-    ifneq "$2" ""
+define addPackageGeneral
+# args: $1 = PACKAGES variable, $2 = package, $3 = condition
+    ifeq "$3" ""
+        $1 += $2
+    else
         ifeq "$$(CLEANING)" "YES"
-            PACKAGES += $1
+            $1 += $2
         else
-            ifeq $2
-                PACKAGES += $1
+            ifeq $3
+                $1 += $2
             endif
         endif
-    else
-        PACKAGES += $1
     endif
 endef
 
+define addPackage # args: $1 = package, $2 = condition
+$(call addPackageGeneral,PACKAGES,$1,$2)
+endef
+
+define addPackage2 # args: $1 = package, $2 = condition
+$(call addPackageGeneral,PACKAGES_STAGE2,$1,$2)
+endef
+
 INTREE_ONLY_PACKAGES := haskeline mtl terminfo utf8-string xhtml
 
 $(foreach p,$(INTREE_ONLY_PACKAGES),$(eval libraries/$p_dist-install_HADDOCK_ME = NO))
@@ -355,28 +366,8 @@ $(eval $(call addPackage,terminfo,($$(Windows),NO)))
 
 $(eval $(call addPackage,haskeline))
 
-$(foreach pkg,$(EXTRA_PACKAGES),$(eval $(call addPackage,$(pkg))))
-
-
-# -------------------  Adding DPH packaes ---------------
+$(eval $(call extra-packages))
 
-# The DPH packages are added when:
-#   * not BootingFromHc (they aren't necessary for bootstrapping), and
-#     * not GhcProfiled (they need TH, so can't be compiled by a -prof GHC), or
-#     * CLEANING: when cleaning we always enable everything
-
-# if !BootingFromHc && (!GhcProfiled || CLEANING)
-
-ifneq "$(BootingFromHc)" "YES"
-ifneq "$(GhcProfiled) $(CLEANING)" "NO YES"
-PACKAGES_STAGE2 += dph/dph-base \
-       dph/dph-prim-interface \
-       dph/dph-prim-seq \
-       dph/dph-prim-par \
-       dph/dph-seq \
-       dph/dph-par
-endif
-endif  # BootingFromHc
 # ------------------------------------------------------- 
 
 
@@ -516,8 +507,6 @@ libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-ins
 #
 # The rest : libraries/*/dist-install, compiler/stage2, ghc/stage2
 
-BUILD_DIRS =
-
 ifneq "$(BINDIST)" "YES"
 BUILD_DIRS += \
    $(GHC_MKDIRHIER_DIR)
@@ -567,11 +556,6 @@ BUILD_DIRS += \
    $(patsubst %, libraries/%, $(PACKAGES))
 endif
 
-ifneq "$(BootingFromHc)" "YES"
-BUILD_DIRS += \
-   libraries/dph
-endif
-
 ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
 BUILD_DIRS += libraries/integer-gmp/gmp
 endif
@@ -756,7 +740,9 @@ $(foreach pkg,$(BOOT_PKGS),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$(GhcBo
 GHCI_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_GHCI_LIB)) \
            $(compiler_stage2_GHCI_LIB)
 
+ifeq "$(UseArchivesForGhci)" "NO"
 ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(GHCI_LIBS)
+endif
 
 endif
 
@@ -803,8 +789,10 @@ TAGS: TAGS_compiler
 # Installation
 
 install: install_packages install_libs install_libexecs install_headers \
-         install_libexec_scripts install_bins install_docs \
-                install_topdirs
+         install_libexec_scripts install_bins install_topdirs
+ifeq "$(HADDOCK_DOCS)" "YES"
+install: install_docs
+endif
 
 install_bins: $(INSTALL_BINS)
        $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
@@ -961,6 +949,7 @@ $(eval $(call bindist,.,\
     INSTALL \
     configure config.sub config.guess install-sh \
     extra-gcc-opts.in \
+    packages \
     Makefile \
     mk/config.mk.in \
     $(INPLACE_BIN)/mkdirhier \
@@ -997,6 +986,9 @@ $(eval $(call bindist,.,\
        libraries/gen_contents_index \
        libraries/prologue.txt \
        libraries/dph/LICENSE \
+       libraries/dph/ghc-packages \
+       libraries/dph/ghc-packages2 \
+       libraries/dph/ghc-stage2-package \
  ))
 endif
 # mk/project.mk gets an absolute path, so we manually include it in
@@ -1007,7 +999,7 @@ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk
 unix-binary-dist-prep:
        "$(RM)" $(RM_OPTS_REC) bindistprep/
        "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR)
-       set -e; for i in LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
+       set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done
        echo "HADDOCK_DOCS       = $(HADDOCK_DOCS)"       >> $(BIN_DIST_MK)
        echo "LATEX_DOCS         = $(LATEX_DOCS)"         >> $(BIN_DIST_MK)
        echo "BUILD_DOCBOOK_HTML = $(BUILD_DOCBOOK_HTML)" >> $(BIN_DIST_MK)