Build system improvements
authorIan Lynagh <igloo@earth.li>
Sat, 15 Jan 2011 23:19:27 +0000 (23:19 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 15 Jan 2011 23:19:27 +0000 (23:19 +0000)
We no longer use dummy-ghc; instead we don't configure most packages
until the stage1 compiler is available.

We also now use Cabal for building the ghc-bin package.

There are a couple more sanity checks too.

14 files changed:
Makefile
compiler/ghc.mk
docs/man/ghc.mk
ghc.mk
ghc/ghc-bin.cabal.in
ghc/ghc.mk
mk/config.mk.in
rules/build-package-data.mk
rules/build-package.mk
rules/build-perl.mk
rules/build-prog.mk
rules/docbook.mk
rules/package-config.mk
utils/dummy-ghc/ghc.mk [deleted file]

index 93ee7bc..12cae74 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -60,21 +60,25 @@ REALGOALS=$(filter-out binary-dist binary-dist-prep bootstrapping-files framewor
 # it does nothing if we specify a target that already exists.
 .PHONY: $(REALGOALS)
 $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
-       @echo "===--- updating makefiles phase 0"
-       $(MAKE) -r --no-print-directory -f ghc.mk phase=0 just-makefiles
+       @echo "===--- building phase 0"
+       $(MAKE) -r --no-print-directory -f ghc.mk phase=0 all
 ifneq "$(OMIT_PHASE_1)" "YES"
-       @echo "===--- updating makefiles phase 1"
-       $(MAKE) -r --no-print-directory -f ghc.mk phase=1 just-makefiles
+       @echo "===--- building phase 1"
+       $(MAKE) -r --no-print-directory -f ghc.mk phase=1 all
 endif
 ifneq "$(OMIT_PHASE_2)" "YES"
-       @echo "===--- updating makefiles phase 2"
-       $(MAKE) -r --no-print-directory -f ghc.mk phase=2 just-makefiles
+       @echo "===--- building phase 2"
+       $(MAKE) -r --no-print-directory -f ghc.mk phase=2 all
 endif
 ifneq "$(OMIT_PHASE_3)" "YES"
-       @echo "===--- updating makefiles phase 3"
-       $(MAKE) -r --no-print-directory -f ghc.mk phase=3 just-makefiles
+       @echo "===--- building phase 3"
+       $(MAKE) -r --no-print-directory -f ghc.mk phase=3 all
 endif
-       @echo "===--- finished updating makefiles"
+ifneq "$(OMIT_PHASE_4)" "YES"
+       @echo "===--- building phase 4"
+       $(MAKE) -r --no-print-directory -f ghc.mk phase=4 all
+endif
+       @echo "===--- building final phase"
        $(MAKE) -r --no-print-directory -f ghc.mk $@
 
 binary-dist: binary-dist-prep
index 978835f..c601f29 100644 (file)
@@ -535,7 +535,9 @@ compiler/stage1/inplace-pkg-config-munged: compiler/stage1/inplace-pkg-config
          < $< > $@
        "$(compiler_stage1_GHC_PKG)" update --force $(compiler_stage1_GHC_PKG_OPTS) $@
 
-$(compiler_stage1_v_LIB) : compiler/stage1/inplace-pkg-config-munged
+# We need to make sure the munged config is in the database before we
+# try to configure ghc-bin
+ghc/stage1/package-data.mk : compiler/stage1/inplace-pkg-config-munged
 endif
 
 endif
index 5407397..6775c55 100644 (file)
@@ -39,7 +39,9 @@ docs/man/flags.xml: docs/users_guide/flags.xml
        sed 1d $< >> $@
 
 ifeq "$(BUILD_MAN)" "YES"
+ifeq "$(phase)" ""
 $(eval $(call all-target,docs/man,$(MAN_PATH)))
+endif
 
 INSTALL_MANPAGES += $(MAN_PATH)
 
diff --git a/ghc.mk b/ghc.mk
index 6df7220..75419e0 100644 (file)
--- a/ghc.mk
+++ b/ghc.mk
@@ -282,6 +282,115 @@ include rules/bindist.mk
        "$(MKDIRHIER)" $@
 
 # -----------------------------------------------------------------------------
+# Phase handling
+
+phase_0_or_later = YES
+ifeq "$(findstring $(phase),0)" ""
+phase_0_done = YES
+phase_1_or_later = YES
+endif
+ifeq "$(findstring $(phase),0 1)" ""
+phase_1_done = YES
+phase_2_or_later = YES
+endif
+ifeq "$(findstring $(phase),0 1 2)" ""
+phase_2_done = YES
+phase_3_or_later = YES
+endif
+ifeq "$(findstring $(phase),0 1 2 3)" ""
+phase_3_done = YES
+phase_4_or_later = YES
+endif
+ifeq "$(findstring $(phase),0 1 2 3 4)" ""
+phase_4_done = YES
+endif
+
+includes_dist-derivedconstants_CONFIGURE_PHASE = 0
+includes_dist-ghcconstants_CONFIGURE_PHASE = 0
+
+# We do these first, as making the sources for some later
+# packages needs them, and we need the sources before we can
+# work out dependencies
+utils/hsc2hs_dist_CONFIGURE_PHASE = 0
+utils/unlit_dist_CONFIGURE_PHASE = 0
+utils/genprimopcode_dist_CONFIGURE_PHASE = 0
+
+# Then the bootlibs
+libraries/hpc_dist-boot_CONFIGURE_PHASE = 1
+libraries/extensible-exceptions_dist-boot_CONFIGURE_PHASE = 1
+libraries/Cabal_dist-boot_CONFIGURE_PHASE = 1
+libraries/binary_dist-boot_CONFIGURE_PHASE = 1
+libraries/bin-package-db_dist-boot_CONFIGURE_PHASE = 1
+
+# We put the stage 1 compiler package in a later phase than the bootlibs
+# for the same reasone we have the
+#     $(compiler_stage1_depfile_haskell) : $(BOOT_LIBS)
+# dependency below
+compiler_stage1_CONFIGURE_PHASE = 2
+
+# Now we make the stage 1 compiler binary. Again, in a later phase than
+# its package for the same reason as the
+#     $(ghc_stage1_depfile_haskell) : $(compiler_stage1_v_LIB)
+# dep below
+ghc_stage1_CONFIGURE_PHASE = 3
+
+# Finally, the stage1 compiler is used to make the dependencies for
+# everything else, so we can now build the rest.
+compiler_stage2_CONFIGURE_PHASE = 4
+ghc_stage2_CONFIGURE_PHASE = 4
+
+libraries/ghc-prim_dist-install_CONFIGURE_PHASE = 4
+libraries/integer-gmp_dist-install_CONFIGURE_PHASE = 4
+libraries/base_dist-install_CONFIGURE_PHASE = 4
+libraries/filepath_dist-install_CONFIGURE_PHASE = 4
+libraries/array_dist-install_CONFIGURE_PHASE = 4
+libraries/bytestring_dist-install_CONFIGURE_PHASE = 4
+libraries/containers_dist-install_CONFIGURE_PHASE = 4
+libraries/unix_dist-install_CONFIGURE_PHASE = 4
+libraries/old-locale_dist-install_CONFIGURE_PHASE = 4
+libraries/old-time_dist-install_CONFIGURE_PHASE = 4
+libraries/time_dist-install_CONFIGURE_PHASE = 4
+libraries/directory_dist-install_CONFIGURE_PHASE = 4
+libraries/process_dist-install_CONFIGURE_PHASE = 4
+libraries/extensible-exceptions_dist-install_CONFIGURE_PHASE = 4
+libraries/hpc_dist-install_CONFIGURE_PHASE = 4
+libraries/pretty_dist-install_CONFIGURE_PHASE = 4
+libraries/template-haskell_dist-install_CONFIGURE_PHASE = 4
+libraries/Cabal_dist-install_CONFIGURE_PHASE = 4
+libraries/binary_dist-install_CONFIGURE_PHASE = 4
+libraries/bin-package-db_dist-install_CONFIGURE_PHASE = 4
+libraries/mtl_dist-install_CONFIGURE_PHASE = 4
+libraries/utf8-string_dist-install_CONFIGURE_PHASE = 4
+libraries/xhtml_dist-install_CONFIGURE_PHASE = 4
+libraries/terminfo_dist-install_CONFIGURE_PHASE = 4
+libraries/haskeline_dist-install_CONFIGURE_PHASE = 4
+libraries/random_dist-install_CONFIGURE_PHASE = 4
+libraries/haskell98_dist-install_CONFIGURE_PHASE = 4
+libraries/haskell2010_dist-install_CONFIGURE_PHASE = 4
+libraries/primitive_dist-install_CONFIGURE_PHASE = 4
+libraries/vector_dist-install_CONFIGURE_PHASE = 4
+libraries/dph/dph-base_dist-install_CONFIGURE_PHASE = 4
+libraries/dph/dph-prim-interface_dist-install_CONFIGURE_PHASE = 4
+libraries/dph/dph-prim-seq_dist-install_CONFIGURE_PHASE = 4
+libraries/dph/dph-prim-par_dist-install_CONFIGURE_PHASE = 4
+libraries/dph/dph-seq_dist-install_CONFIGURE_PHASE = 4
+libraries/dph/dph-par_dist-install_CONFIGURE_PHASE = 4
+
+utils/hp2ps_dist_CONFIGURE_PHASE = 4
+utils/genapply_dist_CONFIGURE_PHASE = 4
+utils/haddock_dist_CONFIGURE_PHASE = 4
+utils/hsc2hs_dist-install_CONFIGURE_PHASE = 4
+utils/ghc-pkg_dist-install_CONFIGURE_PHASE = 4
+utils/hpc_dist_CONFIGURE_PHASE = 4
+utils/runghc_dist_CONFIGURE_PHASE = 4
+utils/ghctags_dist_CONFIGURE_PHASE = 4
+utils/ghc-pwd_dist_CONFIGURE_PHASE = 4
+utils/ghc-cabal_dist-install_CONFIGURE_PHASE = 4
+utils/mkUserGuidePart_dist_CONFIGURE_PHASE = 4
+utils/compare_sizes_dist_CONFIGURE_PHASE = 4
+
+
+# -----------------------------------------------------------------------------
 # Packages
 
 # --------------------------------
@@ -510,9 +619,11 @@ endif
 # ----------------------------------------------
 # Checking packages with 'cabal check'
 
+ifeq "$(phase)" ""
 ifeq "$(CHECK_PACKAGES)" "YES"
 all: check_packages
 endif
+endif
 
 # These packages don't pass the Cabal checks because hs-source-dirs
 # points outside the source directory. This isn't a real problem in
@@ -551,7 +662,7 @@ CHECKED_compiler = YES
 # So this is the final ordering:
 
 # Phase 0 : all package-data.mk files
-#           (requires ghc-cabal, ghc-pkg, mkdirhier, dummy-ghc etc.)
+#           (requires ghc-cabal, ghc-pkg, mkdirhier etc.)
 # Phase 1 : .depend files for bootstrap libs
 #           (requires hsc2hs)
 # Phase 2 : compiler/stage1/.depend
@@ -617,7 +728,6 @@ BUILD_DIRS += \
    utils/testremove \
    utils/ghctags \
    utils/ghc-pwd \
-   utils/dummy-ghc \
    $(GHC_CABAL_DIR) \
    utils/hpc \
    utils/runghc \
@@ -710,9 +820,11 @@ $(foreach p,$(STAGE0_PACKAGES),$(eval libraries/$p_dist-boot_DO_HADDOCK = NO))
 
 # Build the Haddock contents and index
 ifeq "$(HADDOCK_DOCS)" "YES"
-libraries/index.html: $(ALL_HADDOCK_FILES)
+libraries/index.html: inplace/bin/haddock $(ALL_HADDOCK_FILES)
        cd libraries && sh gen_contents_index --inplace
+ifeq "$(phase)" ""
 $(eval $(call all-target,library_doc_index,libraries/index.html))
+endif
 INSTALL_LIBRARY_DOCS += libraries/*.html libraries/*.gif libraries/*.css libraries/*.js
 CLEAN_FILES += libraries/doc-index* libraries/haddock*.css \
               libraries/haddock*.js libraries/index*.html libraries/*.gif
index 888883a..a9d150b 100644 (file)
@@ -18,24 +18,18 @@ Data-Files: extra-gcc-opts
 Build-Type: Simple
 Cabal-Version: >= 1.2
 
-Flag base3
-    Description: Choose the new smaller, split-up base package.
-
 Flag ghci
     Description: Build GHCi support.
 
 Executable ghc
     Main-Is: Main.hs
-    if flag(base3)
-        Build-Depends: base       >= 3   && < 5,
-                       array      >= 0.1 && < 0.3,
-                       bytestring >= 0.9 && < 0.10,
-                       directory  >= 1   && < 1.2,
-                       process    >= 1   && < 1.1
-    else
-        Build-Depends: base < 3
-    Build-Depends: base, ghc
-    Build-Depends: filepath >= 1 && < 1.2
+    Build-Depends: base       >= 3   && < 5,
+                   array      >= 0.1 && < 0.4,
+                   bytestring >= 0.9 && < 0.10,
+                   directory  >= 1   && < 1.2,
+                   process    >= 1   && < 1.1,
+                   filepath   >= 1   && < 1.3,
+                   ghc
     if os(windows)
         Build-Depends: Win32
     else
index 3b68d5b..e178a1a 100644 (file)
@@ -11,8 +11,8 @@
 # -----------------------------------------------------------------------------
 
 # ToDo
-ghc_USES_CABAL = NO
-ghc_PACKAGE = ghc-bin
+ghc_USES_CABAL = YES
+ghc_PACKAGE = ghc-bin
 
 ghc_stage1_HC_OPTS = $(GhcStage1HcOpts)
 ghc_stage2_HC_OPTS = $(GhcStage2HcOpts)
index 9c9d636..3fc0853 100644 (file)
@@ -434,7 +434,6 @@ GHC_PKG_PGM             = ghc-pkg$(exeext)
 GHC_LTX_PGM             = ltx$(exeext)
 GHC_MKDIRHIER_PGM       = mkdirhier
 GHC_LNDIR_PGM           = lndir
-GHC_DUMMY_GHC_PGM       = dummy-ghc$(exeext)
 
 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
 GHC_CP                 = "xcopy /y"
@@ -460,7 +459,6 @@ GHC_PKG_INPLACE             = $(INPLACE_BIN)/$(GHC_PKG_PGM)
 GHCTAGS_INPLACE                = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM)
 HSC2HS_INPLACE         = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM)
 GENPRIMOP_INPLACE      = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM)
-DUMMY_GHC_INPLACE      = $(INPLACE_BIN)/$(GHC_DUMMY_GHC_PGM)
 
 GENERATED_FILE  = chmod a-w
 EXECUTABLE_FILE = chmod +x
index ffaacd6..be33eab 100644 (file)
@@ -62,10 +62,13 @@ ifeq "$3" "0"
 $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS)
 endif
 
+$1/$2/inplace-pkg-config : $1/$2/package-data.mk
+$1/$2/build/autogen/cabal_macros.h : $1/$2/package-data.mk
+
 # This rule configures the package, generates the package-data.mk file
 # for our build system, and registers the package for use in-place in
 # the build tree.
-$1/$2/package-data.mk $1/$2/inplace-pkg-config $1/$2/build/autogen/cabal_macros.h : $$(GHC_CABAL_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$($1_$2_HC_CONFIG_DEP)
+$1/$2/package-data.mk : $$(GHC_CABAL_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$($1_$2_HC_CONFIG_DEP)
        "$$(GHC_CABAL_INPLACE)" configure --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" --with-gcc="$$(WhatGccIsCalled)" --configure-option=--with-cc="$$(WhatGccIsCalled)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -- $2 $1
 ifeq "$$($1_$2_PROG)" ""
 ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO"
index 7ce11fe..9e2bae3 100644 (file)
@@ -60,58 +60,71 @@ define build-package-helper
 # $2 = distdir
 # $3 = GHC stage to use (0 == bootstrapping compiler)
 
-# We don't install things compiled by stage 0, so no need to put them
-# in the bindist.
-ifneq "$$(BINDIST) $3" "YES 0"
+# --- CONFIGURATION
 
-$(call all-target,$1,all_$1_$2)
-# This give us things like
-#     all_libraries: all_libraries/base_dist-install
-ifneq "$$($1_$2_GROUP)" ""
-all_$$($1_$2_GROUP): all_$1_$2
-endif
+$(call package-config,$1,$2,$3)
 
-ifneq "$$(CHECKED_$1)" "YES"
-CHECKED_$1 = YES
-check_packages: check_$1
-.PHONY: check_$1
-check_$1: $$(GHC_CABAL_INPLACE)
-       $$(GHC_CABAL_INPLACE) check $1
+########################################
+ifeq "$$($1_$2_CONFIGURE_PHASE)" ""
+$$(error No configure phase for $1_$2)
+else ifeq "$$($1_$2_CONFIGURE_PHASE)" "$$(phase)"
+
+ifeq "$$(DEBUG)" "YES"
+$$(warning $1/$2 configure phase)
 endif
 
-# --- CONFIGURATION
+ifneq "$$(BINDIST)" "YES"
+$(call build-package-data,$1,$2,$3)
+endif
 
 ifneq "$$(NO_INCLUDE_PKGDATA)" "YES"
 include $1/$2/package-data.mk
 endif
 
-$(call package-config,$1,$2,$3)
-
-ifeq "$$($1_$2_DISABLE)" "YES"
+else ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_or_later)" "YES"
 
 ifeq "$$(DEBUG)" "YES"
-$$(warning $1/$2 disabled)
+$$(warning $1/$2 build phase)
+endif
+
+ifneq "$$(NO_INCLUDE_PKGDATA)" "YES"
+include $1/$2/package-data.mk
+ifeq "$$($1_$2_VERSION)" ""
+$$(error No version for $1_$2 found)
+endif
 endif
 
-# A package is disabled when we want to bring its package-data.mk file
-# up-to-date first, or due to other build dependencies.
+$(call all-target,$1,all_$1_$2)
 
-$(call all-target,$1_$2,$1/$2/package-data.mk)
+else
 
-ifneq "$$(BINDIST)" "YES"
-# We have a rule for package-data.mk only when the package is
-# disabled, because we want the build to fail if we haven't run phase 0.
-$(call build-package-data,$1,$2,$3)
+ifeq "$$(DEBUG)" "YES"
+$$(warning $1/$2 disabled phase)
 endif
 
-else
+endif
+########################################
 
-ifneq "$$(NO_INCLUDE_PKGDATA)" "YES"
-ifeq "$$($1_$2_VERSION)" ""
-$$(error phase ordering error: $1/$2 is enabled, but $1/$2/package-data.mk does not exist)
+# We don't install things compiled by stage 0, so no need to put them
+# in the bindist.
+ifneq "$$(BINDIST) $3" "YES 0"
+
+# This give us things like
+#     all_libraries: all_libraries/base_dist-install
+ifneq "$$($1_$2_GROUP)" ""
+all_$$($1_$2_GROUP): all_$1_$2
 endif
+
+ifneq "$$(CHECKED_$1)" "YES"
+CHECKED_$1 = YES
+check_packages: check_$1
+.PHONY: check_$1
+check_$1: $$(GHC_CABAL_INPLACE)
+       $$(GHC_CABAL_INPLACE) check $1
 endif
 
+ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_done)" "YES"
+
 # Sometimes we need to modify the automatically-generated package-data.mk
 # bindings in a special way for the GHC build system, so allow that here:
 $($1_PACKAGE_MAGIC)
index e13185d..c232193 100644 (file)
@@ -29,7 +29,9 @@ else
 $1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
 endif
 
+ifeq "$$(phase_1_or_later)" "YES"
 $(call all-target,$1_$2,$$($1_$2_INPLACE))
+endif
 
 $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE))
 .PHONY: clean_$1
index 473bae8..e303a44 100644 (file)
@@ -48,45 +48,106 @@ define build-prog-helper
 # $2 = distdir
 # $3 = GHC stage to use (0 == bootstrapping compiler)
 
-$(call all-target,$1,all_$1_$2)
-
 ifeq "$$($1_USES_CABAL)" "YES"
 $1_$2_USES_CABAL = YES
 endif
 
+$(call package-config,$1,$2,$3)
+
+ifeq "$$($1_$2_INSTALL_INPLACE)" "NO"
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+$1_$2_INPLACE = $$(error $1_$2 should not be installed inplace, but INPLACE var evaluated)
+else
+$1_$2_INPLACE =
+endif
+else
+# Where do we install the inplace version?
+ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO"
+$1_$2_INPLACE = $$(INPLACE_LIB)/$$($1_$2_PROG)
+else
+ifeq "$$($1_$2_TOPDIR)" "YES"
+$1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
+else
+$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
+endif
+endif
+endif
+
+########################################
+ifeq "$$($1_$2_CONFIGURE_PHASE)" ""
+$$(error No configure phase for $1_$2)
+else ifeq "$$($1_$2_CONFIGURE_PHASE)" "$$(phase)"
+
+ifeq "$$(DEBUG)" "YES"
+$$(warning $1/$2 configure phase)
+endif
+
+ifneq "$$(BINDIST)" "YES"
+$(call build-package-data,$1,$2,$3)
+endif
+
 ifeq "$$($1_$2_USES_CABAL)" "YES"
 ifneq "$$(NO_INCLUDE_PKGDATA)" "YES"
 include $1/$2/package-data.mk
 endif
 endif
 
-$(call package-config,$1,$2,$3)
-
-ifeq "$$($1_$2_USES_CABAL)$$($1_$2_VERSION)" "YES"
-$1_$2_DISABLE = YES
+# INPLACE_BIN might be empty if we're distcleaning
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$$($1_$2_INSTALL_INPLACE)" "NO"
+$$($1_$2_INPLACE) :
+       $$(error $1_$2 is configuring, but trying to build $$($1_$2_INPLACE)")
+endif
 endif
 
-ifeq "$$($1_$2_DISABLE)" "YES"
+else ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_or_later)" "YES"
 
 ifeq "$$(DEBUG)" "YES"
-$$(warning $1/$2 disabled)
+$$(warning $1/$2 build phase)
 endif
 
-# The following code to build the package all depends on settings
-# obtained from package-data.mk.  If we don't have package-data.mk
-# yet, then don't try to do anything else with this package.  Make will
-# try to build package-data.mk, then restart itself and we'll be in business.
+ifeq "$$($1_$2_USES_CABAL)" "YES"
+ifneq "$$(NO_INCLUDE_PKGDATA)" "YES"
+include $1/$2/package-data.mk
+ifeq "$$($1_$2_VERSION)" ""
+$$(error No version for $1_$2 found)
+endif
+endif
+endif
 
-$(call all-target,$1_$2,$1/$2/package-data.mk)
+$(call all-target,$1,all_$1_$2)
+$(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG))
 
-# We have a rule for package-data.mk only when the package is
-# disabled, because we want the build to fail if we haven't run phase 0.
-ifneq "$$(BINDIST)" "YES"
-$(call build-package-data,$1,$2,$3)
+# INPLACE_BIN might be empty if we're distcleaning
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$$($1_$2_INSTALL_INPLACE)" "NO"
+$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
+       "$$(CP)" -p $$< $$@
+       touch $$@
+endif
 endif
 
 else
 
+ifeq "$$(DEBUG)" "YES"
+$$(warning $1/$2 disabled phase)
+endif
+
+# INPLACE_BIN might be empty if we're distcleaning
+ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
+ifneq "$$($1_$2_INSTALL_INPLACE)" "NO"
+$$($1_$2_INPLACE) :
+       $$(error $1_$2 is disabled, but trying to build $$($1_$2_INPLACE)")
+endif
+endif
+
+endif
+########################################
+
+$(call shell-wrapper,$1,$2)
+
+ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_done)" "YES"
+
 ifneq "$$(BINDIST)" "YES"
 $1_$2_WAYS = v
 
@@ -153,37 +214,15 @@ endif
 $1/$2/build/tmp/$$($1_$2_PROG) : $$(ALL_STAGE1_LIBS) $$(ALL_RTS_LIBS) $$(OTHER_LIBS)
 endif
 endif
-endif
-
-ifeq "$$($1_$2_INSTALL_INPLACE)" "NO"
-$(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG))
-else
-# Where do we install the inplace version?
-ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO"
-$1_$2_INPLACE = $$(INPLACE_LIB)/$$($1_$2_PROG)
-else
-ifeq "$$($1_$2_TOPDIR)" "YES"
-$1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
-else
-$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
-endif
-endif
 
+ifneq "$$($1_$2_INSTALL_INPLACE)" "NO"
 $(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
-ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
-$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
-       "$$(CP)" -p $$< $$@
-       touch $$@
 endif
+$(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE))
 
 # touch is necessary; cp doesn't update the file time.
 endif
 
-$(call shell-wrapper,$1,$2)
-
 ifeq "$$($1_$2_INSTALL)" "YES"
 ifeq "$$($1_$2_TOPDIR)" "YES"
 INSTALL_TOPDIRS += $1/$2/build/tmp/$$($1_$2_PROG)
index 8488de1..ebc3751 100644 (file)
@@ -25,10 +25,12 @@ $(call all-target,$1,)
 
 .PHONY: html_$1
 
+ifeq "$$(phase)" ""
 ifeq "$$(BUILD_DOCBOOK_HTML)" "YES"
 $(call all-target,$1,html_$1)
 INSTALL_HTML_DOC_DIRS += $1/$2
 endif
+endif
 
 html_$1 : $1/$2/index.html
 
@@ -47,10 +49,12 @@ endif
 
 
 .PHONY: ps_$1
+ifeq "$$(phase)" ""
 ifeq "$$(BUILD_DOCBOOK_PS)" "YES"
 $(call all-target,$1,ps_$1)
 INSTALL_DOCS += $1/$2.ps
 endif
+endif
 
 ps_$1 : $1/$2.ps
 
@@ -60,10 +64,12 @@ $1/$2.ps: $$($1_DOCBOOK_SOURCES)
        [ -f $$@ ]
 endif
 
+ifeq "$$(phase)" ""
 ifeq "$$(BUILD_DOCBOOK_PDF)" "YES"
 $(call all-target,$1,pdf_$1)
 INSTALL_DOCS += $1/$2.pdf
 endif
+endif
 
 .PHONY: pdf_$1
 pdf_$1 : $1/$2.pdf
index fbed905..871fde6 100644 (file)
@@ -38,8 +38,8 @@ endif
 else
 $1_$2_ghc_ge_613 = YES
 $1_$2_HC_PKGCONF = 
-$1_$2_HC_CONFIG = $$(TOP)/$$(DUMMY_GHC_INPLACE)
-$1_$2_HC_CONFIG_DEP = $$(DUMMY_GHC_INPLACE)
+$1_$2_HC_CONFIG = $$(TOP)/$$(GHC_STAGE1)
+$1_$2_HC_CONFIG_DEP = $$(GHC_STAGE1)
 $1_$2_GHC_PKG = $$(TOP)/$$(GHC_PKG_INPLACE)
 $1_$2_GHC_PKG_DEP = $$(GHC_PKG_INPLACE)
 $1_$2_GHC_PKG_OPTS =
diff --git a/utils/dummy-ghc/ghc.mk b/utils/dummy-ghc/ghc.mk
deleted file mode 100644 (file)
index 72db6f0..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-# -----------------------------------------------------------------------------
-#
-# (c) 2009 The University of Glasgow
-#
-# This file is part of the GHC build system.
-#
-# To understand how the build system works and how to modify it, see
-#      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
-#      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
-#
-# -----------------------------------------------------------------------------
-
-# dummy-ghc
-
-# This is a tiny program to fool Cabal's configure that we have a
-# stage1 GHC, which lets us configure all the packages before we've
-# build stage1.
-
-utils/dummy-ghc_dist-dummy-ghc_MODULES = dummy-ghc
-utils/dummy-ghc_dist-dummy-ghc_PROG    = dummy-ghc$(exeext)
-
-# depend on project.mk, so we pick up the new version number if it changes.
-utils/dummy-ghc/dist-dummy-ghc/build/dummy-ghc.hs : utils/dummy-ghc/ghc.mk $(MKDIRHIER) mk/project.mk compiler/main/DynFlags.hs
-       "$(MKDIRHIER)" $(dir $@)
-       "$(RM)" $(RM_OPTS) $@
-       echo 'import System.Environment'                                  >> $@
-       echo 'import System.Cmd'                                          >> $@
-       echo 'import System.Exit'                                         >> $@
-       echo 'main :: IO ()'                                              >> $@
-       echo 'main = do args <- getArgs'                                  >> $@
-       echo '          case args of'                                     >> $@
-       echo '              ["--numeric-version"] ->'                     >> $@
-       echo '                  putStrLn "$(ProjectVersion)"'             >> $@
-       echo '              ["--supported-languages"] ->'                 >> $@
-       echo '                  mapM_ putStrLn extensions'                >> $@
-       echo '              _ ->'                                         >> $@
-       echo '                  do e <- rawSystem "$(GHC_STAGE0)" args'   >> $@
-       echo '                     exitWith e'                            >> $@
-# This unpleasant sed script grabs the lines between the
-#      xFlags ::
-# line and the
-#   ]
-# line of compiler/main/DynFlags.hs, and if they look like
-#   ( "PostfixOperators", ...
-# then it translates them into
-#   ["PostfixOperators", "NoPostfixOperators"] ++
-# Tabs are a pain to handle portably with sed, so rather than worrying
-# about them we just use tr to remove them all before we start.
-       echo 'extensions :: [String]'                                     >> $@
-       echo 'extensions ='                                               >> $@
-       '$(TR)' -d '\t' < compiler/main/DynFlags.hs | '$(SED)' '/^xFlags/,/]/s/^ *( *"\([^"]*\)"[^"]*/  ["\1", "No\1"] ++/p;d' >> $@
-       echo '  []'                                                       >> $@
-
-# We don't build dummy-ghc with Cabal, so we need to pass -package
-# flags manually
-utils/dummy-ghc_dist-dummy-ghc_HC_OPTS = -package process
-$(eval $(call build-prog,utils/dummy-ghc,dist-dummy-ghc,0))
-