X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc.mk;h=f25163588ef58d15194f9a82b8c42b7ea0f122cf;hb=e86d72733e4eeda752a1b0b2874dd58090eae197;hp=c9b280984a405bcdbc4bc14263479e35c6afb60d;hpb=46aed8a4a084add708bbd119d19905105d5f0d72;p=ghc-hetmet.git diff --git a/ghc.mk b/ghc.mk index c9b2809..f251635 100644 --- a/ghc.mk +++ b/ghc.mk @@ -26,23 +26,22 @@ # # Once the new build system is in HEAD, and before 6.12: # +# * separate the logic of whether to do something from the test for +# existence of the tool to do it. For example, rather than checking +# if $DIR_DOCBOOK_XSL or $XSLTPROC is "", we should have a variable +# for controlling the building of the docs. # * remove old Makefiles, add new stubs for building in subdirs # * utils/hsc2hs/Makefile # * utils/haddock/Makefile -# * mk/oldconfig.mk.in # * docs/Makefile # * docs/docbook-cheat-sheet/Makefile # * docs/ext-core/Makefile # * docs/man/Makefile # * docs/storage-mgmt/Makefile -# * docs/users_guide/Makefile # * docs/vh/Makefile # * driver/Makefile -# * driver/ghc/Makefile -# * libraries/Makefile # * rts/dotnet/Makefile # * utils/Makefile -# * docbook PDFs, e.g. "dblatex -T db2latex users_guide.xml" # * GhcProfiled # * optionally install stage3? # * shared libraries, way dyn @@ -135,18 +134,23 @@ show: # ----------------------------------------------------------------------------- # Include subsidiary build-system bits +ifneq "$(findstring clean,$(MAKECMDGOALS))" "" +-include mk/config.mk +else 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 @@ -165,8 +169,6 @@ $(eval $(call clean-target,inplace,,inplace)) # When we're just doing 'make clean' or 'make show', then we don't need # to build dependencies. -NO_INCLUDE_DEPS = NO -NO_INCLUDE_PKGDATA = NO ifneq "$(findstring clean,$(MAKECMDGOALS))" "" NO_INCLUDE_DEPS = YES NO_INCLUDE_PKGDATA = YES @@ -318,13 +320,27 @@ endif PACKAGES += haskeline +PACKAGES_STAGE2 += \ + dph/dph-base \ + dph/dph-prim-interface \ + dph/dph-prim-seq \ + dph/dph-prim-par \ + dph/dph-seq \ + dph/dph-par + BOOT_PKGS = Cabal hpc extensible-exceptions -# The actual .a files: needed for dependencies. -ALL_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB)) +# The actual .a and .so/.dll files: needed for dependencies. +ALL_STAGE1_LIBS = $(foreach lib,$(PACKAGES),$(libraries/$(lib)_dist-install_v_LIB)) +ifeq "$(BuildSharedLibs)" "YES" +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)) -OTHER_LIBS = libffi/libHSffi.a libffi/HSffi.o +OTHER_LIBS = libffi/libHSffi$(v_libsuf) libffi/HSffi.o +ifeq "$(BuildSharedLibs)" "YES" +OTHER_LIBS += libffi/libHSffi$(dyn_libsuf) +endif ifeq "$(HaveLibGmp)" "NO" OTHER_LIBS += gmp/libgmp.a endif @@ -337,18 +353,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 @@ -465,11 +483,13 @@ endif BUILD_DIRS += \ utils/haddock \ + utils/haddock/doc \ $(patsubst %, libraries/%, $(PACKAGES)) \ + $(patsubst %, libraries/%, $(PACKAGES_STAGE2)) \ + libraries/dph \ compiler \ $(GHC_HSC2HS_DIR) \ $(GHC_PKG_DIR) \ - utils/hasktags \ utils/hpc \ utils/runghc \ ghc @@ -500,14 +520,13 @@ 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 @@ -520,7 +539,10 @@ 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 # dependency reasons, see the phase ordering), which doesn't @@ -536,9 +558,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))) @@ -678,7 +702,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) \ @@ -695,13 +719,13 @@ install_packages: libffi/package.conf.install rts/package.conf.install $(eval $(call bindist,.,\ LICENSE \ - configure config.sub config.guess \ + configure config.sub config.guess install-sh \ extra-gcc-opts.in \ Makefile \ mk/config.mk.in \ $(INPLACE_BIN)/mkdirhier \ $(INPLACE_BIN)/ghc-cabal \ - utils/pwd/pwd \ + utils/ghc-pwd/ghc-pwd \ $(BINDIST_WRAPPERS) \ $(BINDIST_LIBS) \ $(BINDIST_HI) \ @@ -721,14 +745,19 @@ $(eval $(call bindist,.,\ binary-dist: $(RM) -rf $(BIN_DIST_NAME) mkdir $(BIN_DIST_NAME) - set -e; for i in LICENSE compiler ghc rts libraries utils gmp docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess extra-gcc-opts.in ghc.mk inplace; do ln -s ../$$i $(BIN_DIST_NAME)/; done + set -e; for i in LICENSE compiler ghc rts libraries utils gmp docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.in ghc.mk inplace; do ln -s ../$$i $(BIN_DIST_NAME)/; done ln -s ../distrib/configure-bin.ac $(BIN_DIST_NAME)/configure.ac cd $(BIN_DIST_NAME) && autoreconf $(RM) -f $(BIN_DIST_TAR) # h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source # tree then we want to include the real file, not a symlink to it - $(TAR) hcf $(BIN_DIST_TAR) -T $(BIN_DIST_LIST) - bzip2 < $(BIN_DIST_TAR) > $(BIN_DIST_TAR_BZ2) + $(TAR) hcf - -T $(BIN_DIST_LIST) | bzip2 -c >$(BIN_DIST_TAR_BZ2) + +nTimes = set -e; for i in `seq 1 $(1)`; do echo Try "$$i: $(2)"; if $(2); then break; fi; done + +.PHONY: publish-binary-dist +publish-binary-dist: + $(call nTimes,10,$(PublishCp) $(BIN_DIST_TAR_BZ2) $(PublishLocation)/dist) # ----------------------------------------------------------------------------- # Source distributions @@ -764,10 +793,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 @@ -814,8 +840,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) @@ -826,14 +850,11 @@ sdist-manifest : $(SRC_DIST_TARBALL) # over SSH. ifneq "$(PublishLocation)" "" publish-sdist : - @for i in 0 1 2 3 4 5 6 7 8 9; do \ - echo "Try $$i: $(PublishCp) $(SRC_DIST_EXTRALIBS_TARBALL) $(PublishLocation)/dist"; \ - if $(PublishCp) $(SRC_DIST_EXTRALIBS_TARBALL) $(PublishLocation)/dist; then break; fi; \ - done - @for i in 0 1 2 3 4 5 6 7 8 9; do \ - echo "Try $$i: $(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist"; \ - if $(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist; then break; fi; \ - done + $(call nTimes,10,$(PublishCp) $(SRC_DIST_TARBALL) $(PublishLocation)/dist) +endif + +ifeq "$(GhcUnregisterised)" "YES" +SRC_CC_OPTS += -DNO_REGS -DUSE_MINIINTERPRETER endif # ----------------------------------------------------------------------------- @@ -841,6 +862,11 @@ endif .PHONY: clean +CLEAN_FILES += utils/ghc-pwd/ghc-pwd +CLEAN_FILES += utils/ghc-pwd/ghc-pwd.exe +CLEAN_FILES += utils/ghc-pwd/ghc-pwd.hi +CLEAN_FILES += utils/ghc-pwd/ghc-pwd.o + clean : clean_files .PHONY: clean_files clean_files : @@ -861,9 +887,16 @@ 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 $(RM) libraries/unix/include/HsUnixConfig.h.in $(RM) libraries/old-time/include/HsTimeConfig.h.in + +.PHONY: all_libraries +