X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=ghc.mk;h=fe5e8452c623fbd32632f9902707c6c4653f60ec;hp=b47b49c5e7329200847aef21fb391b59568b40f7;hb=e5c3b478b3cd1707cf122833822f44b2ac09b8e9;hpb=a54c59a58b6bb2fb5bbfd7378c55c4e0317442c4 diff --git a/ghc.mk b/ghc.mk index b47b49c..fe5e845 100644 --- a/ghc.mk +++ b/ghc.mk @@ -1,3 +1,4 @@ + # ----------------------------------------------------------------------------- # # (c) 2009 The University of Glasgow @@ -135,9 +136,14 @@ $(error $$(GhcLibWays) is empty, it must contain at least one way) endif endif +ifeq "$(phase)" "" +phase = final +endif + # ----------------------------------------------------------------------------- # Utility definitions +include rules/prof.mk include rules/trace.mk include rules/make-command.mk @@ -221,7 +227,9 @@ include rules/package-config.mk # ----------------------------------------------------------------------------- # Building dependencies +include rules/dependencies.mk include rules/build-dependencies.mk +include rules/include-dependencies.mk # ----------------------------------------------------------------------------- # Build package-data.mk files @@ -305,7 +313,7 @@ TH_PACKAGES := $(DPH_PACKAGES) # # We assume that the stage0 compiler has a suitable bytestring package, # so we don't have to include it below. -STAGE0_PACKAGES = Cabal hpc extensible-exceptions binary bin-package-db +STAGE0_PACKAGES = 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 @@ -388,6 +396,7 @@ $(eval $(call addPackage,template-haskell)) $(eval $(call addPackage,Cabal)) $(eval $(call addPackage,binary)) $(eval $(call addPackage,bin-package-db)) +$(eval $(call addPackage,hoopl)) $(eval $(call addPackage,mtl)) $(eval $(call addPackage,utf8-string)) $(eval $(call addPackage,xhtml)) @@ -430,13 +439,13 @@ ghc/stage2/package-data.mk: compiler/stage2/package-data.mk # package-data.mk is sufficient, as that in turn depends on all the # libraries utils/haddock/dist/package-data.mk: compiler/stage2/package-data.mk -utils/ghc-pwd/dist/package-data.mk: compiler/stage2/package-data.mk +utils/ghc-pwd/dist-install/package-data.mk: compiler/stage2/package-data.mk utils/ghc-cabal/dist-install/package-data.mk: compiler/stage2/package-data.mk utils/ghc-pkg/dist-install/package-data.mk: compiler/stage2/package-data.mk utils/hsc2hs/dist-install/package-data.mk: compiler/stage2/package-data.mk -utils/compare_sizes/dist/package-data.mk: compiler/stage2/package-data.mk -utils/runghc/dist/package-data.mk: compiler/stage2/package-data.mk +utils/compare_sizes/dist-install/package-data.mk: compiler/stage2/package-data.mk +utils/runghc/dist-install/package-data.mk: compiler/stage2/package-data.mk # add the final two package.conf dependencies: ghc-prim depends on RTS, # and RTS depends on libffi. @@ -493,19 +502,17 @@ libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-ins ifneq "$(CLEANING)" "YES" ifeq "$(INTEGER_LIBRARY)" "integer-gmp" libraries/base_dist-install_CONFIGURE_OPTS += --flags=-integer-simple +else ifeq "$(INTEGER_LIBRARY)" "integer-simple" +libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-simple else - ifeq "$(INTEGER_LIBRARY)" "integer-simple" - libraries/base_dist-install_CONFIGURE_OPTS += --flags=integer-simple - else $(error Unknown integer library: $(INTEGER_LIBRARY)) - endif endif endif # ---------------------------------------------- # Checking packages with 'cabal check' -ifeq "$(phase)" "" +ifeq "$(phase)" "final" ifeq "$(CHECK_PACKAGES)" "YES" all: check_packages endif @@ -538,7 +545,6 @@ BUILD_DIRS += \ ifneq "$(GhcUnregisterised)" "YES" BUILD_DIRS += \ - $(GHC_MANGLER_DIR) \ $(GHC_SPLIT_DIR) endif @@ -569,6 +575,8 @@ endif ifeq "$(INTEGER_LIBRARY)" "integer-gmp" BUILD_DIRS += libraries/integer-gmp/gmp +else ifneq "$(findstring clean,$(MAKECMDGOALS))" "" +BUILD_DIRS += libraries/integer-gmp/gmp endif BUILD_DIRS += \ @@ -603,69 +611,6 @@ BUILD_DIRS += \ $(patsubst %, libraries/%, $(PACKAGES_STAGE2)) endif -# ----------------------------------------------------------------------------- -# 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 -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 -$(foreach lib,$(STAGE0_PACKAGES),$(eval \ - libraries/$(lib)_dist-boot_CONFIGURE_PHASE = 1)) -compiler_stage1_CONFIGURE_PHASE = 1 -ghc_stage1_CONFIGURE_PHASE = 1 -driver/ghc_dist_CONFIGURE_PHASE = 1 -driver/ghci_dist_CONFIGURE_PHASE = 1 -driver/haddock_dist_CONFIGURE_PHASE = 1 - -# In phase 2, the phase 1 things actually get built - -# Finally, the stage1 compiler is used to make the dependencies for -# everything else, so we can now build the rest. -compiler_stage2_CONFIGURE_PHASE = 3 -ghc_stage2_CONFIGURE_PHASE = 3 - -$(foreach lib,$(PACKAGES) $(PACKAGES_STAGE2),$(eval \ - libraries/$(lib)_dist-install_CONFIGURE_PHASE = 3)) - -utils/touchy_dist_CONFIGURE_PHASE = 3 -utils/hp2ps_dist_CONFIGURE_PHASE = 3 -utils/genapply_dist_CONFIGURE_PHASE = 3 -utils/haddock_dist_CONFIGURE_PHASE = 3 -utils/hsc2hs_dist-install_CONFIGURE_PHASE = 3 -utils/ghc-pkg_dist-install_CONFIGURE_PHASE = 3 -utils/hpc_dist_CONFIGURE_PHASE = 3 -utils/runghc_dist_CONFIGURE_PHASE = 3 -utils/ghctags_dist_CONFIGURE_PHASE = 3 -utils/ghc-pwd_dist_CONFIGURE_PHASE = 3 -utils/ghc-cabal_dist-install_CONFIGURE_PHASE = 3 -utils/mkUserGuidePart_dist_CONFIGURE_PHASE = 3 -utils/compare_sizes_dist_CONFIGURE_PHASE = 3 - # ---------------------------------------------- # Actually include all the sub-ghc.mk's @@ -701,9 +646,9 @@ $(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: inplace/bin/haddock $(ALL_HADDOCK_FILES) +libraries/index.html: inplace/bin/haddock$(exeext) $(ALL_HADDOCK_FILES) cd libraries && sh gen_contents_index --inplace -ifeq "$(phase)" "" +ifeq "$(phase)" "final" $(eval $(call all-target,library_doc_index,libraries/index.html)) endif INSTALL_LIBRARY_DOCS += libraries/*.html libraries/*.gif libraries/*.css libraries/*.js @@ -735,6 +680,7 @@ $(eval $(call build-package,libraries/extensible-exceptions,dist-boot,0)) $(eval $(call build-package,libraries/Cabal,dist-boot,0)) $(eval $(call build-package,libraries/binary,dist-boot,0)) $(eval $(call build-package,libraries/bin-package-db,dist-boot,0)) +$(eval $(call build-package,libraries/hoopl,dist-boot,0)) # register the boot packages in strict sequence, because running # multiple ghc-pkgs in parallel doesn't work (registrations may get @@ -804,7 +750,7 @@ TAGS: TAGS_compiler # ----------------------------------------------------------------------------- # Installation -install: install_packages install_libs install_libexecs install_headers \ +install: install_libs install_packages install_libexecs install_headers \ install_libexec_scripts install_bins install_topdirs ifeq "$(HADDOCK_DOCS)" "YES" install: install_docs @@ -958,13 +904,13 @@ $(eval $(call bindist,.,\ README \ INSTALL \ configure config.sub config.guess install-sh \ - extra-gcc-opts.in \ + settings.in \ packages \ Makefile \ mk/config.mk.in \ $(INPLACE_BIN)/mkdirhier \ utils/ghc-cabal/dist-install/build/tmp/ghc-cabal \ - utils/ghc-pwd/dist/build/tmp/ghc-pwd \ + utils/ghc-pwd/dist-install/build/tmp/ghc-pwd \ $(BINDIST_WRAPPERS) \ $(BINDIST_PERL_SOURCES) \ $(BINDIST_LIBS) \ @@ -974,7 +920,6 @@ $(eval $(call bindist,.,\ $(includes_H_PLATFORM) \ $(includes_H_FILES) \ includes/ghcconfig.h \ - includes/rts/Config.h \ $(INSTALL_HEADERS) \ $(INSTALL_LIBEXECS) \ $(INSTALL_LIBEXEC_SCRIPTS) \ @@ -988,7 +933,7 @@ $(eval $(call bindist,.,\ compiler/stage2/doc \ $(wildcard libraries/*/dist-install/doc/) \ $(wildcard libraries/*/*/dist-install/doc/) \ - $(filter-out extra-gcc-opts,$(INSTALL_LIBS)) \ + $(filter-out settings,$(INSTALL_LIBS)) \ $(filter-out %/project.mk mk/config.mk %/mk/install.mk,$(MAKEFILE_LIST)) \ mk/project.mk \ mk/install.mk.in \ @@ -1009,7 +954,7 @@ BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk unix-binary-dist-prep: "$(RM)" $(RM_OPTS_REC) bindistprep/ "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR) - set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh extra-gcc-opts.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done + set -e; for i in packages LICENSE compiler ghc rts libraries utils docs libffi includes driver mk rules Makefile aclocal.m4 config.sub config.guess install-sh settings.in ghc.mk inplace distrib/configure.ac distrib/README distrib/INSTALL; do ln -s ../../$$i $(BIN_DIST_PREP_DIR)/; done echo "HADDOCK_DOCS = $(HADDOCK_DOCS)" >> $(BIN_DIST_MK) echo "LATEX_DOCS = $(LATEX_DOCS)" >> $(BIN_DIST_MK) echo "BUILD_DOCBOOK_HTML = $(BUILD_DOCBOOK_HTML)" >> $(BIN_DIST_MK) @@ -1098,7 +1043,7 @@ SRC_DIST_DIRS = mk rules docs distrib bindisttest libffi includes utils docs rts SRC_DIST_FILES += \ configure.ac config.guess config.sub configure \ aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \ - ghc.spec.in ghc.spec extra-gcc-opts.in VERSION \ + ghc.spec.in ghc.spec settings.in VERSION \ boot boot-pkgs packages ghc.mk SRC_DIST_TARBALL = $(SRC_DIST_NAME)-src.tar.bz2 @@ -1189,17 +1134,6 @@ clean : clean_files clean_libraries clean_files : "$(RM)" $(RM_OPTS) $(CLEAN_FILES) -ifneq "$(NO_CLEAN_GMP)" "YES" -CLEAN_FILES += libraries/integer-gmp/gmp/gmp.h -CLEAN_FILES += libraries/integer-gmp/gmp/libgmp.a - -clean : clean_gmp -.PHONY: clean_gmp -clean_gmp: - "$(RM)" $(RM_OPTS_REC) libraries/integer-gmp/gmp/objs - "$(RM)" $(RM_OPTS_REC) libraries/integer-gmp/gmp/gmpbuild -endif - .PHONY: clean_libraries clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES) $(PACKAGES_STAGE2)) clean_libraries: $(patsubst %,clean_libraries/%_dist-boot,$(STAGE0_PACKAGES)) @@ -1224,7 +1158,7 @@ distclean : clean "$(RM)" $(RM_OPTS) config.cache config.status config.log mk/config.h mk/stamp-h "$(RM)" $(RM_OPTS) mk/config.mk mk/are-validating.mk mk/project.mk "$(RM)" $(RM_OPTS) mk/config.mk.old mk/project.mk.old - "$(RM)" $(RM_OPTS) extra-gcc-opts docs/users_guide/ug-book.xml + "$(RM)" $(RM_OPTS) settings docs/users_guide/ug-book.xml "$(RM)" $(RM_OPTS) compiler/ghc.cabal compiler/ghc.cabal.old "$(RM)" $(RM_OPTS) ghc/ghc-bin.cabal "$(RM)" $(RM_OPTS) libraries/base/include/HsBaseConfig.h @@ -1265,3 +1199,27 @@ bootstrapping-files: includes/GHCConstants.h .DELETE_ON_ERROR: +# ----------------------------------------------------------------------------- +# Numbered phase targets + +.PHONY: phase_0_builds +phase_0_builds: $(utils/hsc2hs_dist_depfile_haskell) +phase_0_builds: $(utils/hsc2hs_dist_depfile_c_asm) +phase_0_builds: $(utils/genprimopcode_dist_depfile_haskell) +phase_0_builds: $(utils/genprimopcode_dist_depfile_c_asm) + +.PHONY: phase_1_builds +phase_1_builds: $(PACKAGE_DATA_MKS) + +# ----------------------------------------------------------------------------- +# Support for writing GHC passes in Coq + +compiler/hetmet/Makefile: + git submodule update --init compiler/hetmet + cd compiler/hetmet/; git checkout master +compiler/hetmet/build/CoqPass.hs: compiler/hetmet/Makefile $(wildcard compiler/hetmet/src/*.v) $(wildcard compiler/hetmet/src/*.hs) + cd compiler/hetmet; make build/CoqPass.hs +compiler/stage1/build/CoqPass.hs: compiler/hetmet/build/CoqPass.hs + cp compiler/hetmet/build/CoqPass.hs $@ +compiler/stage2/build/CoqPass.hs: compiler/hetmet/build/CoqPass.hs + cp compiler/hetmet/build/CoqPass.hs $@