X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=ghc.mk;h=2bea8290e8de29308275a78d206e2c3ef0a9fbd8;hp=f8b015b75844cd02bcbfc393bf3193dd84fd45e7;hb=fa00cc50ecd1aa292657720b7594b7bdb82c970c;hpb=f45df74d9828987a0281d474f449234e19b92314 diff --git a/ghc.mk b/ghc.mk index f8b015b..2bea829 100644 --- a/ghc.mk +++ b/ghc.mk @@ -53,7 +53,6 @@ # # * 2966 make sure --with-gcc does the right thing (#2966) # * 1693 make distclean -# * 2689 make maintainer-clean # * 3173 make install with DESTDIR # Possible cleanups: @@ -134,18 +133,23 @@ show: # ----------------------------------------------------------------------------- # Include subsidiary build-system bits -include mk/config.mk +include mk/tree.mk +ifeq "$(findstring clean,$(MAKECMDGOALS))" "" +include mk/config.mk ifeq "$(ProjectVersion)" "" $(error Please run ./configure first) endif +endif # (Optional) build-specific configuration include mk/custom-settings.mk +ifeq "$(findstring clean,$(MAKECMDGOALS))" "" ifeq "$(GhcLibWays)" "" $(error $$(GhcLibWays) is empty, it must contain at least one way) endif +endif # ----------------------------------------------------------------------------- # Macros for standard targets @@ -168,6 +172,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 @@ -208,6 +216,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 @@ -224,6 +236,8 @@ $(foreach way,$(ALL_WAYS),\ include rules/c-suffix-rules.mk +endif + # ----------------------------------------------------------------------------- # Building package-data.mk files from .cabal files @@ -315,8 +329,8 @@ endif PACKAGES += haskeline -ifneq "$(wildcard libraries/dph)" "" -PACKAGES += \ +ifneq "$(BootingFromHc)" "YES" +PACKAGES_STAGE2 += \ dph/dph-base \ dph/dph-prim-interface \ dph/dph-prim-seq \ @@ -328,9 +342,9 @@ endif BOOT_PKGS = Cabal hpc extensible-exceptions # The actual .a and .so/.dll files: needed for dependencies. -ALL_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB)) +ALL_STAGE1_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB)) ifeq "$(BuildSharedLibs)" "YES" -ALL_LIBS += $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_dyn_LIB)) +ALL_STAGE1_LIBS += $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_dyn_LIB)) endif BOOT_LIBS = $(foreach lib,$(BOOT_PKGS),$(libraries/$(lib)_dist-boot_v_LIB)) @@ -339,7 +353,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 @@ -350,18 +365,20 @@ endif # know the dependencies until we've generated the pacakge-data.mk # files. define fixed_pkg_dep -libraries/$1/$2/package-data.mk : $(GHC_PKG_INPLACE) $$(if $$(fixed_pkg_prev),libraries/$$(fixed_pkg_prev)/$2/package-data.mk) +libraries/$1/$2/package-data.mk : $$(GHC_PKG_INPLACE) $$(if $$(fixed_pkg_prev),libraries/$$(fixed_pkg_prev)/$2/package-data.mk) fixed_pkg_prev:=$1 endef ifneq "$(BINDIST)" "YES" fixed_pkg_prev= -$(foreach pkg,$(PACKAGES),$(eval $(call fixed_pkg_dep,$(pkg),dist-install))) +$(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),$(eval $(call fixed_pkg_dep,$(pkg),dist-install))) # We assume that the stage2 compiler depends on all the libraries, so # they all get added to the package database before we try to configure # it -compiler/stage2/package-data.mk: $(foreach pkg,$(PACKAGES),libraries/$(pkg)/dist-install/package-data.mk) +compiler/stage2/package-data.mk: $(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),libraries/$(pkg)/dist-install/package-data.mk) +ghc/stage1/package-data.mk: compiler/stage1/package-data.mk +ghc/stage2/package-data.mk: compiler/stage2/package-data.mk # haddock depends on ghc and some libraries, but depending on GHC's # package-data.mk is sufficient, as that in turn depends on all the # libraries @@ -478,11 +495,21 @@ endif BUILD_DIRS += \ utils/haddock \ - $(patsubst %, libraries/%, $(PACKAGES)) \ + utils/haddock/doc + +ifneq "$(CLEANING)" "YES" +BUILD_DIRS += \ + $(patsubst %, libraries/%, $(PACKAGES) $(PACKAGES_STAGE2)) +ifneq "$(BootingFromHc)" "YES" +BUILD_DIRS += \ + libraries/dph +endif +endif + +BUILD_DIRS += \ compiler \ $(GHC_HSC2HS_DIR) \ $(GHC_PKG_DIR) \ - utils/hasktags \ utils/hpc \ utils/runghc \ ghc @@ -513,20 +540,16 @@ ifneq "$(findstring $(phase),0 1 2 3)" "" utils/haddock_dist_DISABLE = YES utils/runghc_dist_DISABLE = YES utils/hpc_dist_DISABLE = YES -utils/hasktags_dist_DISABLE = YES utils/hsc2hs_dist-install_DISABLE = YES utils/ghc-pkg_dist-install_DISABLE = YES compiler_stage2_DISABLE = YES compiler_stage3_DISABLE = YES ghc_stage2_DISABLE = YES ghc_stage3_DISABLE = YES -$(foreach lib,$(PACKAGES),$(eval \ +$(foreach lib,$(PACKAGES) $(PACKAGES_STAGE2),$(eval \ libraries/$(lib)_dist-install_DISABLE = YES)) endif -ifneq "$(wildcard libraries/dph)" "" -include libraries/dph/ghc.mk -endif include $(patsubst %, %/ghc.mk, $(BUILD_DIRS)) # We need -fno-warn-deprecated-flags to avoid failure with -Werror @@ -536,9 +559,12 @@ GhcBootLibHcOpts += -fno-warn-deprecated-flags endif # Add $(GhcLibHcOpts) to all library builds -$(foreach pkg,$(PACKAGES),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts))) +$(foreach pkg,$(PACKAGES) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts))) + +# 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. @@ -552,9 +578,11 @@ libraries/base3-compat_dist-install_HC_OPTS += -XPackageImports ifneq "$(BINDIST)" "YES" +ifneq "$(BOOTSTRAPPING_CONF)" "" ifeq "$(wildcard $(BOOTSTRAPPING_CONF))" "" $(shell echo "[]" >$(BOOTSTRAPPING_CONF)) endif +endif $(eval $(call clean-target,$(BOOTSTRAPPING_CONF),,$(BOOTSTRAPPING_CONF))) @@ -694,7 +722,7 @@ install_packages: libffi/package.conf.install rts/package.conf.install echo "[]" > $(INSTALLED_PACKAGE_CONF) $(INSTALLED_GHC_PKG_REAL) --force --global-conf $(INSTALLED_PACKAGE_CONF) update libffi/package.conf.install $(INSTALLED_GHC_PKG_REAL) --force --global-conf $(INSTALLED_PACKAGE_CONF) update rts/package.conf.install - $(foreach p, $(PACKAGES),\ + $(foreach p, $(PACKAGES) $(PACKAGES_STAGE2),\ $(GHC_CABAL_INPLACE) install \ $(INSTALLED_GHC_PKG_REAL) \ $(INSTALLED_PACKAGE_CONF) \ @@ -730,6 +758,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 @@ -785,10 +814,7 @@ SRC_DIST_FILES += \ aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \ ghc.spec.in ghc.spec extra-gcc-opts.in VERSION boot ghc.mk -EXTRA_LIBS=$(patsubst %, $(SRC_DIST_NAME)/%, $(shell grep -E "extralibs|dph" packages | grep -v "^\#" | sed "s/ .*//")) - SRC_DIST_TARBALL = ghc-$(ProjectVersion)-src.tar.bz2 -SRC_DIST_EXTRALIBS_TARBALL = ghc-$(ProjectVersion)-src-extralibs.tar.bz2 VERSION : echo $(ProjectVersion) >VERSION @@ -835,8 +861,6 @@ sdist-prep : .PHONY: sdist sdist : sdist-prep - $(TAR) chf - $(EXTRA_LIBS) | bzip2 >$(TOP)/$(SRC_DIST_EXTRALIBS_TARBALL) - $(RM) -rf $(EXTRA_LIBS) $(TAR) chf - $(SRC_DIST_NAME) 2>$src_log | bzip2 >$(TOP)/$(SRC_DIST_TARBALL) sdist-manifest : $(SRC_DIST_TARBALL) @@ -847,12 +871,11 @@ sdist-manifest : $(SRC_DIST_TARBALL) # over SSH. ifneq "$(PublishLocation)" "" publish-sdist : - $(call nTimes,10,$(PublishCp) $(SRC_DIST_EXTRALIBS_TARBALL) $(PublishLocation)/dist) $(call nTimes,10,$(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist) 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,9 @@ clean : clean_files .PHONY: clean_files clean_files : $(RM) $(CLEAN_FILES) + $(RM) -r $(patsubst %, libraries/%/dist, $(PACKAGES) $(PACKAGES_STAGE2)) + $(RM) -r $(patsubst %, libraries/%/dist-install, $(PACKAGES) $(PACKAGES_STAGE2)) + $(RM) -r $(patsubst %, libraries/%/dist-boot, $(PACKAGES) $(PACKAGES_STAGE2)) distclean : clean $(RM) config.cache config.status config.log mk/config.h mk/stamp-h @@ -880,12 +906,20 @@ distclean : clean $(RM) libraries/process/include/HsProcessConfig.h $(RM) libraries/unix/include/HsUnixConfig.h $(RM) libraries/old-time/include/HsTimeConfig.h + $(RM) $(patsubst %, libraries/%/config.log, $(PACKAGES) $(PACKAGES_STAGE2)) + $(RM) $(patsubst %, libraries/%/config.status, $(PACKAGES) $(PACKAGES_STAGE2)) + $(RM) $(patsubst %, libraries/%/include/Hs*Config.h, $(PACKAGES) $(PACKAGES_STAGE2)) + $(RM) -r $(patsubst %, libraries/%/autom4te.cache, $(PACKAGES) $(PACKAGES_STAGE2)) maintainer-clean : distclean $(RM) configure mk/config.h.in $(RM) -r autom4te.cache libraries/*/autom4te.cache $(RM) ghc.spec - $(RM) libraries/*/GNUmakefile libraries/*/ghc.mk libraries/*/configure + $(RM) $(patsubst %, libraries/%/GNUmakefile, \ + $(PACKAGES) $(PACKAGES_STAGE2)) + $(RM) $(patsubst %, libraries/%/ghc.mk, $(PACKAGES) $(PACKAGES_STAGE2)) + $(RM) $(patsubst %, libraries/%/configure, \ + $(PACKAGES) $(PACKAGES_STAGE2)) $(RM) libraries/base/include/HsBaseConfig.h.in $(RM) libraries/directory/include/HsDirectoryConfig.h.in $(RM) libraries/process/include/HsProcessConfig.h.in @@ -894,3 +928,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 +