Commit a3be88fd authored by Ian Lynagh's avatar Ian Lynagh

Build system improvements

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.
parent 18fe16c9
...@@ -60,21 +60,25 @@ REALGOALS=$(filter-out binary-dist binary-dist-prep bootstrapping-files framewor ...@@ -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. # it does nothing if we specify a target that already exists.
.PHONY: $(REALGOALS) .PHONY: $(REALGOALS)
$(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old $(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old
@echo "===--- updating makefiles phase 0" @echo "===--- building phase 0"
$(MAKE) -r --no-print-directory -f ghc.mk phase=0 just-makefiles $(MAKE) -r --no-print-directory -f ghc.mk phase=0 all
ifneq "$(OMIT_PHASE_1)" "YES" ifneq "$(OMIT_PHASE_1)" "YES"
@echo "===--- updating makefiles phase 1" @echo "===--- building phase 1"
$(MAKE) -r --no-print-directory -f ghc.mk phase=1 just-makefiles $(MAKE) -r --no-print-directory -f ghc.mk phase=1 all
endif endif
ifneq "$(OMIT_PHASE_2)" "YES" ifneq "$(OMIT_PHASE_2)" "YES"
@echo "===--- updating makefiles phase 2" @echo "===--- building phase 2"
$(MAKE) -r --no-print-directory -f ghc.mk phase=2 just-makefiles $(MAKE) -r --no-print-directory -f ghc.mk phase=2 all
endif endif
ifneq "$(OMIT_PHASE_3)" "YES" ifneq "$(OMIT_PHASE_3)" "YES"
@echo "===--- updating makefiles phase 3" @echo "===--- building phase 3"
$(MAKE) -r --no-print-directory -f ghc.mk phase=3 just-makefiles $(MAKE) -r --no-print-directory -f ghc.mk phase=3 all
endif 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 $@ $(MAKE) -r --no-print-directory -f ghc.mk $@
binary-dist: binary-dist-prep binary-dist: binary-dist-prep
......
...@@ -535,7 +535,9 @@ compiler/stage1/inplace-pkg-config-munged: compiler/stage1/inplace-pkg-config ...@@ -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_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
endif endif
......
...@@ -39,7 +39,9 @@ docs/man/flags.xml: docs/users_guide/flags.xml ...@@ -39,7 +39,9 @@ docs/man/flags.xml: docs/users_guide/flags.xml
sed 1d $< >> $@ sed 1d $< >> $@
ifeq "$(BUILD_MAN)" "YES" ifeq "$(BUILD_MAN)" "YES"
ifeq "$(phase)" ""
$(eval $(call all-target,docs/man,$(MAN_PATH))) $(eval $(call all-target,docs/man,$(MAN_PATH)))
endif
INSTALL_MANPAGES += $(MAN_PATH) INSTALL_MANPAGES += $(MAN_PATH)
......
...@@ -281,6 +281,115 @@ include rules/bindist.mk ...@@ -281,6 +281,115 @@ include rules/bindist.mk
%/. : | $(MKDIRHIER) %/. : | $(MKDIRHIER)
"$(MKDIRHIER)" $@ "$(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 # Packages
...@@ -510,9 +619,11 @@ endif ...@@ -510,9 +619,11 @@ endif
# ---------------------------------------------- # ----------------------------------------------
# Checking packages with 'cabal check' # Checking packages with 'cabal check'
ifeq "$(phase)" ""
ifeq "$(CHECK_PACKAGES)" "YES" ifeq "$(CHECK_PACKAGES)" "YES"
all: check_packages all: check_packages
endif endif
endif
# These packages don't pass the Cabal checks because hs-source-dirs # These packages don't pass the Cabal checks because hs-source-dirs
# points outside the source directory. This isn't a real problem in # points outside the source directory. This isn't a real problem in
...@@ -551,7 +662,7 @@ CHECKED_compiler = YES ...@@ -551,7 +662,7 @@ CHECKED_compiler = YES
# So this is the final ordering: # So this is the final ordering:
# Phase 0 : all package-data.mk files # 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 # Phase 1 : .depend files for bootstrap libs
# (requires hsc2hs) # (requires hsc2hs)
# Phase 2 : compiler/stage1/.depend # Phase 2 : compiler/stage1/.depend
...@@ -617,7 +728,6 @@ BUILD_DIRS += \ ...@@ -617,7 +728,6 @@ BUILD_DIRS += \
utils/testremove \ utils/testremove \
utils/ghctags \ utils/ghctags \
utils/ghc-pwd \ utils/ghc-pwd \
utils/dummy-ghc \
$(GHC_CABAL_DIR) \ $(GHC_CABAL_DIR) \
utils/hpc \ utils/hpc \
utils/runghc \ utils/runghc \
...@@ -710,9 +820,11 @@ $(foreach p,$(STAGE0_PACKAGES),$(eval libraries/$p_dist-boot_DO_HADDOCK = NO)) ...@@ -710,9 +820,11 @@ $(foreach p,$(STAGE0_PACKAGES),$(eval libraries/$p_dist-boot_DO_HADDOCK = NO))
# Build the Haddock contents and index # Build the Haddock contents and index
ifeq "$(HADDOCK_DOCS)" "YES" 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 cd libraries && sh gen_contents_index --inplace
ifeq "$(phase)" ""
$(eval $(call all-target,library_doc_index,libraries/index.html)) $(eval $(call all-target,library_doc_index,libraries/index.html))
endif
INSTALL_LIBRARY_DOCS += libraries/*.html libraries/*.gif libraries/*.css libraries/*.js INSTALL_LIBRARY_DOCS += libraries/*.html libraries/*.gif libraries/*.css libraries/*.js
CLEAN_FILES += libraries/doc-index* libraries/haddock*.css \ CLEAN_FILES += libraries/doc-index* libraries/haddock*.css \
libraries/haddock*.js libraries/index*.html libraries/*.gif libraries/haddock*.js libraries/index*.html libraries/*.gif
......
...@@ -18,24 +18,18 @@ Data-Files: extra-gcc-opts ...@@ -18,24 +18,18 @@ Data-Files: extra-gcc-opts
Build-Type: Simple Build-Type: Simple
Cabal-Version: >= 1.2 Cabal-Version: >= 1.2
Flag base3
Description: Choose the new smaller, split-up base package.
Flag ghci Flag ghci
Description: Build GHCi support. Description: Build GHCi support.
Executable ghc Executable ghc
Main-Is: Main.hs Main-Is: Main.hs
if flag(base3) Build-Depends: base >= 3 && < 5,
Build-Depends: base >= 3 && < 5, array >= 0.1 && < 0.4,
array >= 0.1 && < 0.3, bytestring >= 0.9 && < 0.10,
bytestring >= 0.9 && < 0.10, directory >= 1 && < 1.2,
directory >= 1 && < 1.2, process >= 1 && < 1.1,
process >= 1 && < 1.1 filepath >= 1 && < 1.3,
else ghc
Build-Depends: base < 3
Build-Depends: base, ghc
Build-Depends: filepath >= 1 && < 1.2
if os(windows) if os(windows)
Build-Depends: Win32 Build-Depends: Win32
else else
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# ToDo # ToDo
ghc_USES_CABAL = NO ghc_USES_CABAL = YES
# ghc_PACKAGE = ghc-bin ghc_PACKAGE = ghc-bin
ghc_stage1_HC_OPTS = $(GhcStage1HcOpts) ghc_stage1_HC_OPTS = $(GhcStage1HcOpts)
ghc_stage2_HC_OPTS = $(GhcStage2HcOpts) ghc_stage2_HC_OPTS = $(GhcStage2HcOpts)
......
...@@ -434,7 +434,6 @@ GHC_PKG_PGM = ghc-pkg$(exeext) ...@@ -434,7 +434,6 @@ GHC_PKG_PGM = ghc-pkg$(exeext)
GHC_LTX_PGM = ltx$(exeext) GHC_LTX_PGM = ltx$(exeext)
GHC_MKDIRHIER_PGM = mkdirhier GHC_MKDIRHIER_PGM = mkdirhier
GHC_LNDIR_PGM = lndir GHC_LNDIR_PGM = lndir
GHC_DUMMY_GHC_PGM = dummy-ghc$(exeext)
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
GHC_CP = "xcopy /y" GHC_CP = "xcopy /y"
...@@ -460,7 +459,6 @@ GHC_PKG_INPLACE = $(INPLACE_BIN)/$(GHC_PKG_PGM) ...@@ -460,7 +459,6 @@ GHC_PKG_INPLACE = $(INPLACE_BIN)/$(GHC_PKG_PGM)
GHCTAGS_INPLACE = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM) GHCTAGS_INPLACE = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM)
HSC2HS_INPLACE = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM) HSC2HS_INPLACE = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM)
GENPRIMOP_INPLACE = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM) GENPRIMOP_INPLACE = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM)
DUMMY_GHC_INPLACE = $(INPLACE_BIN)/$(GHC_DUMMY_GHC_PGM)
GENERATED_FILE = chmod a-w GENERATED_FILE = chmod a-w
EXECUTABLE_FILE = chmod +x EXECUTABLE_FILE = chmod +x
......
...@@ -62,10 +62,13 @@ ifeq "$3" "0" ...@@ -62,10 +62,13 @@ ifeq "$3" "0"
$1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS) $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS)
endif 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 # This rule configures the package, generates the package-data.mk file
# for our build system, and registers the package for use in-place in # for our build system, and registers the package for use in-place in
# the build tree. # 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 "$$(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)" "" ifeq "$$($1_$2_PROG)" ""
ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO" ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO"
......
...@@ -60,58 +60,71 @@ define build-package-helper ...@@ -60,58 +60,71 @@ define build-package-helper
# $2 = distdir # $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler) # $3 = GHC stage to use (0 == bootstrapping compiler)
# We don't install things compiled by stage 0, so no need to put them # --- CONFIGURATION
# in the bindist.
ifneq "$$(BINDIST) $3" "YES 0"
$(call all-target,$1,all_$1_$2) $(call package-config,$1,$2,$3)
# 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 ifeq "$$($1_$2_CONFIGURE_PHASE)" ""
check_packages: check_$1 $$(error No configure phase for $1_$2)
.PHONY: check_$1 else ifeq "$$($1_$2_CONFIGURE_PHASE)" "$$(phase)"
check_$1: $$(GHC_CABAL_INPLACE)
$$(GHC_CABAL_INPLACE) check $1 ifeq "$$(DEBUG)" "YES"
$$(warning $1/$2 configure phase)
endif endif
# --- CONFIGURATION ifneq "$$(BINDIST)" "YES"
$(call build-package-data,$1,$2,$3)
endif
ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" ifneq "$$(NO_INCLUDE_PKGDATA)" "YES"
include $1/$2/package-data.mk include $1/$2/package-data.mk
endif endif
$(call package-config,$1,$2,$3) else ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_or_later)" "YES"
ifeq "$$($1_$2_DISABLE)" "YES"
ifeq "$$(DEBUG)" "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 endif
# A package is disabled when we want to bring its package-data.mk file $(call all-target,$1,all_$1_$2)
# up-to-date first, or due to other build dependencies.
$(call all-target,$1_$2,$1/$2/package-data.mk) else
ifneq "$$(BINDIST)" "YES" ifeq "$$(DEBUG)" "YES"
# We have a rule for package-data.mk only when the package is $$(warning $1/$2 disabled phase)
# disabled, because we want the build to fail if we haven't run phase 0.
$(call build-package-data,$1,$2,$3)
endif endif
else endif
########################################
ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" # We don't install things compiled by stage 0, so no need to put them
ifeq "$$($1_$2_VERSION)" "" # in the bindist.
$$(error phase ordering error: $1/$2 is enabled, but $1/$2/package-data.mk does not exist) 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 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 endif
ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_done)" "YES"
# Sometimes we need to modify the automatically-generated package-data.mk # 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: # bindings in a special way for the GHC build system, so allow that here:
$($1_PACKAGE_MAGIC) $($1_PACKAGE_MAGIC)
......
...@@ -29,7 +29,9 @@ else ...@@ -29,7 +29,9 @@ else
$1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) $1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
endif endif
ifeq "$$(phase_1_or_later)" "YES"
$(call all-target,$1_$2,$$($1_$2_INPLACE)) $(call all-target,$1_$2,$$($1_$2_INPLACE))
endif
$(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE)) $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE))
.PHONY: clean_$1 .PHONY: clean_$1
......
...@@ -48,45 +48,106 @@ define build-prog-helper ...@@ -48,45 +48,106 @@ define build-prog-helper
# $2 = distdir # $2 = distdir
# $3 = GHC stage to use (0 == bootstrapping compiler) # $3 = GHC stage to use (0 == bootstrapping compiler)
$(call all-target,$1,all_$1_$2)
ifeq "$$($1_USES_CABAL)" "YES" ifeq "$$($1_USES_CABAL)" "YES"
$1_$2_USES_CABAL = YES $1_$2_USES_CABAL = YES
endif 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" ifeq "$$($1_$2_USES_CABAL)" "YES"
ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" ifneq "$$(NO_INCLUDE_PKGDATA)" "YES"
include $1/$2/package-data.mk include $1/$2/package-data.mk
endif endif
endif endif
$(call package-config,$1,$2,$3) # INPLACE_BIN might be empty if we're distcleaning
ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
ifeq "$$($1_$2_USES_CABAL)$$($1_$2_VERSION)" "YES" ifneq "$$($1_$2_INSTALL_INPLACE)" "NO"
$1_$2_DISABLE = YES $$($1_$2_INPLACE) :
$$(error $1_$2 is configuring, but trying to build $$($1_$2_INPLACE)")
endif
endif endif
ifeq "$$($1_$2_DISABLE)" "YES" else ifeq "$$(phase_$$($1_$2_CONFIGURE_PHASE)_or_later)" "YES"
ifeq "$$(DEBUG)" "YES" ifeq "$$(DEBUG)" "YES"
$$(warning $1/$2 disabled) $$(warning $1/$2 build phase)
endif endif
# The following code to build the package all depends on settings ifeq "$$($1_$2_USES_CABAL)" "YES"
# obtained from package-data.mk. If we don't have package-data.mk ifneq "$$(NO_INCLUDE_PKGDATA)" "YES"
# yet, then don't try to do anything else with this package. Make will include $1/$2/package-data.mk
# try to build package-data.mk, then restart itself and we'll be in business. 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 # INPLACE_BIN might be empty if we're distcleaning
# disabled, because we want the build to fail if we haven't run phase 0. ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
ifneq "$$(BINDIST)" "YES" ifneq "$$($1_$2_INSTALL_INPLACE)" "NO"
$(call build-package-data,$1,$2,$3) $$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
"$$(CP)" -p $$< $$@
touch $$@
endif
endif endif
else 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" ifneq "$$(BINDIST)" "YES"
$1_$2_WAYS = v $1_$2_WAYS = v
...@@ -153,37 +214,15 @@ endif ...@@ -153,37 +214,15 @@ endif
$1/$2/build/tmp/$$($1_$2_PROG) : $$(ALL_STAGE1_LIBS) $$(ALL_RTS_LIBS) $$(OTHER_LIBS) $1/$2/build/tmp/$$($1_$2_PROG) : $$(ALL_STAGE1_LIBS) $$(ALL_RTS_LIBS) $$(OTHER_LIBS)
endif endif
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 all-target,$1_$2,$$($1_$2_INPLACE))