Commit 043d70f0 authored by Simon Marlow's avatar Simon Marlow

sanitise naming of package lists

The *predicates* all start with "PKGS_THAT_...", e.g.:

  PKGS_THAT_BUILD_WITH_STAGE0   (previously "PACKAGES_STAGE0")
  PKGS_THAT_BUILD_WITH_STAGE2   (previously "STAGE2_PACKAGES")
  PKGS_THAT_USE_TH              (previously "TH_PACKAGES)
  etc. (there are a few more)

the lists of packages to build are now consistently named:

  PACKAGES_STAGE0
  PACKAGES_STAGE1  (previously just "PACKAGES")
  PACKAGES_STAGE2
parent 78e6b615
......@@ -174,8 +174,8 @@ sub boot_pkgs {
or die "Opening $package/ghc.mk failed: $!";
print GHCMK "${package}_PACKAGE = ${pkg}\n";
print GHCMK "${package}_dist-install_GROUP = libraries\n";
print GHCMK "\$(if \$(filter ${dir},\$(PACKAGES_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
print GHCMK "\$(eval \$(call build-package,${package},dist-install,\$(if \$(filter ${dir},\$(STAGE2_PACKAGES)),2,1)))\n";
print GHCMK "\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE0)),\$(eval \$(call build-package,${package},dist-boot,0)))\n";
print GHCMK "\$(eval \$(call build-package,${package},dist-install,\$(if \$(filter ${dir},\$(PKGS_THAT_BUILD_WITH_STAGE2)),2,1)))\n";
close GHCMK
or die "Closing $package/ghc.mk failed: $!";
......
......@@ -33,7 +33,7 @@
# then we don't have to use -osuf/-hisuf. We would have to install
# them in different places too, so we'd need ghc-pkg support for packages
# of different ways.
# * make PACKAGES generated by './configure' or './boot'?
# * make PACKAGES_STAGE1 generated by './configure' or './boot'?
# * we should use a directory of package.conf files rather than a single
# file for the inplace package database, so that we can express
# dependencies more accurately. Otherwise it's possible to get into
......@@ -284,28 +284,28 @@ include rules/bindist.mk
%/. : | $(MKDIRHIER)
"$(MKDIRHIER)" $@
# -----------------------------------------------------------------------------
# Packages
# --------------------------------
# -----------------------------------------------------------------------------
# Properties of packages
# These lists say "if this package is built, here's a property it has"
# They do not say "this package will be built"; see $(PACKAGES_xx) for that
# Packages that are built but not installed
INTREE_ONLY_PACKAGES := haskeline mtl terminfo utf8-string xhtml
PKGS_THAT_ARE_INTREE_ONLY := haskeline mtl terminfo utf8-string xhtml
DPH_PACKAGES := dph/dph-base dph/dph-prim-interface dph/dph-prim-seq \
PKGS_THAT_ARE_DPH := dph/dph-base dph/dph-prim-interface dph/dph-prim-seq \
dph/dph-common dph/dph-prim-par dph/dph-par dph/dph-seq \
vector primitive random
# Packages that, if present, must be built by the stage2 compiler,
# because they use TH and/or annotations, or depend on other stage2
# packages:
STAGE2_PACKAGES := $(DPH_PACKAGES) haskell98 haskell2010
PKGS_THAT_BUILD_WITH_STAGE2 := $(PKGS_THAT_ARE_DPH) haskell98 haskell2010
# Packages that we shouldn't build if we don't have TH (e.g. because
# we're building a profiled compiler):
TH_PACKAGES := $(DPH_PACKAGES)
PKGS_THAT_USE_TH := $(PKGS_THAT_ARE_DPH)
# Packages that are built by stage0, in addition to stage1. These
# packages are dependencies of GHC, that we do not assume the stage0
......@@ -313,11 +313,11 @@ TH_PACKAGES := $(DPH_PACKAGES)
#
# We assume that the stage0 compiler has a suitable bytestring package,
# so we don't have to include it below.
PACKAGES_STAGE0 = Cabal/cabal hpc extensible-exceptions binary bin-package-db hoopl
PKGS_THAT_BUILD_WITH_STAGE0 = Cabal/cabal hpc extensible-exceptions binary bin-package-db hoopl
# These packages are installed, but are installed hidden
# Why install them at all? Because the 'ghc' package depends on them
HIDDEN_PACKAGES = binary
PKGS_THAT_ARE_HIDDEN = binary
# $(EXTRA_PACKAGES) is another classification, of packages built but
# not installed
......@@ -326,19 +326,24 @@ HIDDEN_PACKAGES = binary
# this ghc.mk
# --------------------------------
# ----------------------------------------------------------------------------
# Packages to build
# The lists of packages that we *actually* going to build in each stage:
#
# $(PACKAGES_STAGE0) does double duty; it really is the list of packages
# we build the bootstrap compiler in stage 0
#
# $(PACKAGES) A list of directories relative to libraries/ containing
# packages that will be built by stage1, in dependency
# order.
#
# $(PACKAGES_STAGE2) Ditto, for stage2.
# $(PACKAGES_STAGE0)
# $(PACKAGES_STAGE1)
# $(PACKAGES_STAGE2)
#
# These are automatically derived from
# (a) the set of packages in this source tree
# (b) the predicates above, e.g. $(PKGS_THAT_BUILD_WITH_STAGE2)
# (c) which platform we're on, and a few other things
# no processing to do on this one: it really is the list of packages
# to build with stage 0.
PACKAGES_STAGE0 = $(PKGS_THAT_BUILD_WITH_STAGE0)
define addPackageGeneral
# args: $1 = PACKAGES variable, $2 = package, $3 = condition
......@@ -356,11 +361,11 @@ define addPackageGeneral
endef
define addPackage # args: $1 = package, $2 = condition
ifneq "$(filter $1,$(TH_PACKAGES)) $(GhcProfiled)" "$1 YES"
ifeq "$(filter $1,$(STAGE2_PACKAGES))" "$1"
ifneq "$(filter $1,$(PKGS_THAT_USE_TH)) $(GhcProfiled)" "$1 YES"
ifeq "$(filter $1,$(PKGS_THAT_BUILD_WITH_STAGE2))" "$1"
$(call addPackageGeneral,PACKAGES_STAGE2,$1,$2)
else
$(call addPackageGeneral,PACKAGES,$1,$2)
$(call addPackageGeneral,PACKAGES_STAGE1,$1,$2)
endif
endif
endef
......@@ -411,7 +416,7 @@ $(eval $(call extra-packages))
# configured and registered all of its dependencies. So the following
# hack forces all the configure steps to happen in exactly the following order:
#
# $(PACKAGES) ghc(stage2) $(PACKAGES_STAGE2)
# $(PACKAGES_STAGE1) ghc(stage2) $(PACKAGES_STAGE2)
#
# Ideally we should use the correct dependencies here to allow more
# parallelism, but we don't know the dependencies until we've
......@@ -423,7 +428,7 @@ endef
ifneq "$(BINDIST)" "YES"
fixed_pkg_prev=
$(foreach pkg,$(PACKAGES),$(eval $(call fixed_pkg_dep,$(pkg),dist-install)))
$(foreach pkg,$(PACKAGES_STAGE1),$(eval $(call fixed_pkg_dep,$(pkg),dist-install)))
# the GHC package doesn't live in libraries/, so we add its dependency manually:
compiler/stage2/package-data.mk: $(fixed_pkg_prev)
......@@ -461,9 +466,9 @@ BOOT_PKG_CONSTRAINTS := \
--constraint "$p == $(shell grep -i "^Version:" libraries/$d/$p.cabal | sed "s/[^0-9.]//g")"))
# The actual .a and .so/.dll files: needed for dependencies.
ALL_STAGE1_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB))
ALL_STAGE1_LIBS = $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_v_LIB))
ifeq "$(BuildSharedLibs)" "YES"
ALL_STAGE1_LIBS += $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_dyn_LIB))
ALL_STAGE1_LIBS += $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_dyn_LIB))
endif
BOOT_LIBS = $(foreach lib,$(PACKAGES_STAGE0),$(libraries/$(lib)_dist-boot_v_LIB))
......@@ -572,7 +577,7 @@ endif
ifneq "$(CLEANING)" "YES"
BUILD_DIRS += \
$(patsubst %, libraries/%, $(PACKAGES))
$(patsubst %, libraries/%, $(PACKAGES_STAGE1))
endif
ifeq "$(INTEGER_LIBRARY)" "integer-gmp"
......@@ -636,7 +641,7 @@ stage1_libs : $(ALL_STAGE1_LIBS)
# libraries/<pkg>_dist-install_HC_OPTS += -Wwarn
# Add $(GhcLibHcOpts) to all package builds
$(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts)))
$(foreach pkg,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts)))
# Add $(GhcBootLibHcOpts) to all stage0 package builds
$(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$(GhcBootLibHcOpts)))
......@@ -645,7 +650,7 @@ $(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$
# Haddock-related bits
# Don't run Haddock for the package that will not be installed
$(foreach p,$(INTREE_ONLY_PACKAGES),$(eval libraries/$p_dist-install_DO_HADDOCK = NO))
$(foreach p,$(PKGS_THAT_ARE_INTREE_ONLY),$(eval libraries/$p_dist-install_DO_HADDOCK = NO))
# We don't haddock the bootstrapping libraries
$(foreach p,$(PACKAGES_STAGE0),$(eval libraries/$p_dist-boot_DO_HADDOCK = NO))
......@@ -691,7 +696,7 @@ ifneq "$(BINDIST)" "YES"
# ghc-stage2. DPH includes a bit of Template Haskell which needs the
# GHCI libs, and we don't have a better way to express that dependency.
#
GHCI_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_GHCI_LIB)) \
GHCI_LIBS = $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_GHCI_LIB)) \
$(compiler_stage2_GHCI_LIB)
ifeq "$(UseArchivesForGhci)" "NO"
......@@ -848,14 +853,14 @@ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
endif
INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES)) \
INSTALLED_PKG_DIRS := $(addprefix libraries/,$(PACKAGES_STAGE1)) \
compiler \
$(addprefix libraries/,$(PACKAGES_STAGE2))
ifeq "$(InstallExtraPackages)" "NO"
INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(EXTRA_PACKAGES)),\
$(INSTALLED_PKG_DIRS))
endif
INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(INTREE_ONLY_PACKAGES)),\
INSTALLED_PKG_DIRS := $(filter-out $(addprefix libraries/,$(PKGS_THAT_ARE_INTREE_ONLY)),\
$(INSTALLED_PKG_DIRS))
# Set the INSTALL_DISTDIR_p for each package; compiler is special
......@@ -884,7 +889,7 @@ install_packages: libffi/package.conf.install rts/package.conf.install
'$(ghclibdir)' \
'$(docdir)/html/libraries' \
$(RelocatableBuild)))
$(foreach p, $(HIDDEN_PACKAGES), \
$(foreach p, $(PKGS_THAT_ARE_HIDDEN), \
$(call make-command, \
"$(INSTALLED_GHC_PKG_REAL)" \
--global-conf "$(INSTALLED_PACKAGE_CONF)" hide $p))
......@@ -1135,19 +1140,19 @@ clean_files :
"$(RM)" $(RM_OPTS) $(CLEAN_FILES)
.PHONY: clean_libraries
clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES) $(PACKAGES_STAGE2))
clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
clean_libraries: $(patsubst %,clean_libraries/%_dist-boot,$(PACKAGES_STAGE0))
clean_libraries:
"$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/dist, $(PACKAGES) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/*.buildinfo, $(PACKAGES) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/dist, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/*.buildinfo, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
# We have to define a clean target for each library manually, because the
# libraries/*/ghc.mk files are not included when we're cleaning.
ifeq "$(CLEANING)" "YES"
$(foreach lib,$(PACKAGES_STAGE0),\
$(eval $(call clean-target,libraries/$(lib),dist-boot,libraries/$(lib)/dist-boot)))
$(foreach lib,$(PACKAGES) $(PACKAGES_STAGE2),\
$(foreach lib,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),\
$(eval $(call clean-target,libraries/$(lib),dist-install,libraries/$(lib)/dist-install)))
endif
......@@ -1171,20 +1176,20 @@ distclean : clean
"$(RM)" $(RM_OPTS_REC) utils/ghc-pwd/dist
"$(RM)" $(RM_OPTS_REC) inplace
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.log, $(PACKAGES) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/autom4te.cache, $(PACKAGES) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.log, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/config.status, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS_REC) $(patsubst %, libraries/%/autom4te.cache, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
maintainer-clean : distclean
"$(RM)" $(RM_OPTS) configure mk/config.h.in
"$(RM)" $(RM_OPTS_REC) autom4te.cache libraries/*/autom4te.cache
"$(RM)" $(RM_OPTS) ghc.spec
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/GNUmakefile, \
$(PACKAGES) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/ghc.mk, $(PACKAGES) $(PACKAGES_STAGE2))
$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/ghc.mk, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) $(patsubst %, libraries/%/configure, \
$(PACKAGES) $(PACKAGES_STAGE2))
$(PACKAGES_STAGE1) $(PACKAGES_STAGE2))
"$(RM)" $(RM_OPTS) libraries/base/include/HsBaseConfig.h.in
"$(RM)" $(RM_OPTS) libraries/directory/include/HsDirectoryConfig.h.in
"$(RM)" $(RM_OPTS) libraries/process/include/HsProcessConfig.h.in
......
......@@ -97,7 +97,7 @@ ifneq "$(BINDIST)" "YES"
ghc/stage1/build/tmp/$(ghc_stage1_PROG) : $(BOOT_LIBS)
ifeq "$(GhcProfiled)" "YES"
ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(compiler_stage2_p_LIB)
ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_p_LIB))
ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(foreach lib,$(PACKAGES_STAGE1),$(libraries/$(lib)_dist-install_p_LIB))
endif
# Modules here import HsVersions.h, so we need ghc_boot_platform.h
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment