From 6fd9b0a1c6b076ef1977db1a2ce8b9505b9a3254 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 5 Aug 2022 22:29:57 -0400 Subject: Drop make build system Here we at long last remove the `make`-based build system, it having been replaced with the Shake-based Hadrian build system. Users are encouraged to refer to the documentation in `hadrian/doc` and this [1] blog post for details on using Hadrian. Closes #17527. [1] https://www.haskell.org/ghc/blog/20220805-make-to-hadrian.html --- MAKEHELP.md | 96 -- Makefile | 233 ----- bindisttest/ghc.mk | 55 -- boot | 83 -- compiler/Makefile | 24 - compiler/ghc.mk | 294 ------- docs/users_guide/ghc.mk | 50 -- driver/ghc.mk | 22 - driver/ghc/ghc.mk | 24 - driver/ghci/ghc.mk | 67 -- driver/haddock/ghc.mk | 24 - ghc.mk | 1594 ---------------------------------- ghc/ghc.mk | 179 ---- libffi/ghc.mk | 132 --- libraries/ghc-bignum/gmp/ghc.mk | 141 --- libraries/ghc-boot/ghc.mk | 58 -- mk/compiler-ghc.mk | 58 -- mk/custom-settings.mk | 14 - mk/flavours/bench-cross-ncg.mk | 15 - mk/flavours/bench-cross.mk | 15 - mk/flavours/bench-llvm.mk | 10 - mk/flavours/bench.mk | 10 - mk/flavours/devel-cross-ncg.mk | 18 - mk/flavours/devel1.mk | 16 - mk/flavours/devel2.mk | 16 - mk/flavours/dwarf.mk | 14 - mk/flavours/perf-cross-ncg.mk | 14 - mk/flavours/perf-cross.mk | 14 - mk/flavours/perf-llvm.mk | 8 - mk/flavours/perf.mk | 8 - mk/flavours/prof-llvm.mk | 12 - mk/flavours/prof.mk | 11 - mk/flavours/quick-cross-ncg.mk | 15 - mk/flavours/quick-cross.mk | 15 - mk/flavours/quick-llvm.mk | 10 - mk/flavours/quick.mk | 10 - mk/flavours/quickest.mk | 10 - mk/flavours/validate.mk | 56 -- mk/sub-makefile.mk | 67 -- mk/tree.mk | 73 -- mk/validate.mk.sample | 4 - mk/warnings.mk | 155 ---- mk/ways.mk | 105 --- rts/ghc.mk | 684 --------------- rts/include/ghc.mk | 303 ------- rules/add-dependency.mk | 15 - rules/all-target.mk | 18 - rules/bindist.mk | 32 - rules/build-dependencies.mk | 161 ---- rules/build-package-data.mk | 145 ---- rules/build-package-way.mk | 151 ---- rules/build-package.mk | 171 ---- rules/build-prog.mk | 336 ------- rules/c-objs.mk | 18 - rules/c-sources.mk | 18 - rules/c-suffix-rules.mk | 64 -- rules/clean-target.mk | 21 - rules/cmm-objs.mk | 16 - rules/cmm-suffix-rules.mk | 52 -- rules/cxx-suffix-rules.mk | 44 - rules/dependencies.mk | 38 - rules/distdir-opts.mk | 111 --- rules/distdir-way-opts.mk | 220 ----- rules/foreachLibrary.mk | 59 -- rules/haddock.mk | 93 -- rules/hi-rule.mk | 110 --- rules/hs-objs.mk | 17 - rules/hs-sources.mk | 58 -- rules/hs-suffix-rules-srcdir.mk | 50 -- rules/hs-suffix-way-rules-srcdir.mk | 94 -- rules/hs-suffix-way-rules.mk | 132 --- rules/include-dependencies.mk | 45 - rules/includes-sources.mk | 26 - rules/library-path.mk | 21 - rules/make-command.mk | 21 - rules/manual-package-config.mk | 45 - rules/package-config.mk | 69 -- rules/pretty_commands.mk | 13 - rules/prof.mk | 20 - rules/sdist-ghc-file.mk | 77 -- rules/shell-wrapper.mk | 120 --- rules/sphinx.mk | 77 -- rules/trace.mk | 21 - rules/way-prelims.mk | 36 - testsuite/driver/testglobals.py | 2 +- testsuite/driver/testlib.py | 2 +- testsuite/mk/test.mk | 4 +- testsuite/tests/linters/notes.stdout | 2 - utils/check-exact/ghc.mk | 18 - utils/check-ppr/ghc.mk | 18 - utils/compare_sizes/ghc.mk | 9 - utils/count-deps/ghc.mk | 18 - utils/deriveConstants/ghc.mk | 20 - utils/gen-dll/ghc.mk | 19 - utils/genapply/ghc.mk | 30 - utils/genprimopcode/ghc.mk | 19 - utils/ghc-cabal/ghc.mk | 97 --- utils/ghc-pkg/ghc.mk | 98 --- utils/hp2ps/ghc.mk | 42 - utils/hpc/ghc.mk | 21 - utils/iserv/ghc.mk | 113 --- utils/mkdirhier/ghc.mk | 22 - utils/remote-iserv/ghc.mk | 113 --- utils/runghc/ghc.mk | 43 - utils/testremove/ghc.mk | 9 - utils/touchy/ghc.mk | 18 - utils/unlit/ghc.mk | 34 - validate | 36 + 108 files changed, 40 insertions(+), 8438 deletions(-) delete mode 100644 MAKEHELP.md delete mode 100644 Makefile delete mode 100644 bindisttest/ghc.mk delete mode 100644 compiler/Makefile delete mode 100644 compiler/ghc.mk delete mode 100644 docs/users_guide/ghc.mk delete mode 100644 driver/ghc.mk delete mode 100644 driver/ghc/ghc.mk delete mode 100644 driver/ghci/ghc.mk delete mode 100644 driver/haddock/ghc.mk delete mode 100644 ghc.mk delete mode 100644 ghc/ghc.mk delete mode 100644 libffi/ghc.mk delete mode 100644 libraries/ghc-bignum/gmp/ghc.mk delete mode 100644 libraries/ghc-boot/ghc.mk delete mode 100644 mk/compiler-ghc.mk delete mode 100644 mk/custom-settings.mk delete mode 100644 mk/flavours/bench-cross-ncg.mk delete mode 100644 mk/flavours/bench-cross.mk delete mode 100644 mk/flavours/bench-llvm.mk delete mode 100644 mk/flavours/bench.mk delete mode 100644 mk/flavours/devel-cross-ncg.mk delete mode 100644 mk/flavours/devel1.mk delete mode 100644 mk/flavours/devel2.mk delete mode 100644 mk/flavours/dwarf.mk delete mode 100644 mk/flavours/perf-cross-ncg.mk delete mode 100644 mk/flavours/perf-cross.mk delete mode 100644 mk/flavours/perf-llvm.mk delete mode 100644 mk/flavours/perf.mk delete mode 100644 mk/flavours/prof-llvm.mk delete mode 100644 mk/flavours/prof.mk delete mode 100644 mk/flavours/quick-cross-ncg.mk delete mode 100644 mk/flavours/quick-cross.mk delete mode 100644 mk/flavours/quick-llvm.mk delete mode 100644 mk/flavours/quick.mk delete mode 100644 mk/flavours/quickest.mk delete mode 100644 mk/flavours/validate.mk delete mode 100644 mk/sub-makefile.mk delete mode 100644 mk/tree.mk delete mode 100644 mk/validate.mk.sample delete mode 100644 mk/warnings.mk delete mode 100644 mk/ways.mk delete mode 100644 rts/ghc.mk delete mode 100644 rts/include/ghc.mk delete mode 100644 rules/add-dependency.mk delete mode 100644 rules/all-target.mk delete mode 100644 rules/bindist.mk delete mode 100644 rules/build-dependencies.mk delete mode 100644 rules/build-package-data.mk delete mode 100644 rules/build-package-way.mk delete mode 100644 rules/build-package.mk delete mode 100644 rules/build-prog.mk delete mode 100644 rules/c-objs.mk delete mode 100644 rules/c-sources.mk delete mode 100644 rules/c-suffix-rules.mk delete mode 100644 rules/clean-target.mk delete mode 100644 rules/cmm-objs.mk delete mode 100644 rules/cmm-suffix-rules.mk delete mode 100644 rules/cxx-suffix-rules.mk delete mode 100644 rules/dependencies.mk delete mode 100644 rules/distdir-opts.mk delete mode 100644 rules/distdir-way-opts.mk delete mode 100644 rules/foreachLibrary.mk delete mode 100644 rules/haddock.mk delete mode 100644 rules/hi-rule.mk delete mode 100644 rules/hs-objs.mk delete mode 100644 rules/hs-sources.mk delete mode 100644 rules/hs-suffix-rules-srcdir.mk delete mode 100644 rules/hs-suffix-way-rules-srcdir.mk delete mode 100644 rules/hs-suffix-way-rules.mk delete mode 100644 rules/include-dependencies.mk delete mode 100644 rules/includes-sources.mk delete mode 100644 rules/library-path.mk delete mode 100644 rules/make-command.mk delete mode 100644 rules/manual-package-config.mk delete mode 100644 rules/package-config.mk delete mode 100644 rules/pretty_commands.mk delete mode 100644 rules/prof.mk delete mode 100644 rules/sdist-ghc-file.mk delete mode 100644 rules/shell-wrapper.mk delete mode 100644 rules/sphinx.mk delete mode 100644 rules/trace.mk delete mode 100644 rules/way-prelims.mk delete mode 100644 utils/check-exact/ghc.mk delete mode 100644 utils/check-ppr/ghc.mk delete mode 100644 utils/compare_sizes/ghc.mk delete mode 100644 utils/count-deps/ghc.mk delete mode 100644 utils/deriveConstants/ghc.mk delete mode 100644 utils/gen-dll/ghc.mk delete mode 100644 utils/genapply/ghc.mk delete mode 100644 utils/genprimopcode/ghc.mk delete mode 100644 utils/ghc-cabal/ghc.mk delete mode 100644 utils/ghc-pkg/ghc.mk delete mode 100644 utils/hp2ps/ghc.mk delete mode 100644 utils/hpc/ghc.mk delete mode 100644 utils/iserv/ghc.mk delete mode 100644 utils/mkdirhier/ghc.mk delete mode 100644 utils/remote-iserv/ghc.mk delete mode 100644 utils/runghc/ghc.mk delete mode 100644 utils/testremove/ghc.mk delete mode 100644 utils/touchy/ghc.mk delete mode 100644 utils/unlit/ghc.mk diff --git a/MAKEHELP.md b/MAKEHELP.md deleted file mode 100644 index ce27e1a516..0000000000 --- a/MAKEHELP.md +++ /dev/null @@ -1,96 +0,0 @@ -Quick `make` guide for GHC -========================== - -For a "Getting Started" guide, see: - - - https://gitlab.haskell.org/ghc/ghc/wikis/building/quick-start - - https://gitlab.haskell.org/ghc/ghc/wikis/building/using - - https://gitlab.haskell.org/ghc/ghc/wikis/building/standard-targets - -Common commands: - - - `make` - - Builds everything: ghc stages 1 and 2, all libraries and tools. - - - `make -j2` - - Parallel build: runs up to 2 commands at a time. - - - `cd ; make` - - Builds everything in the given directory. - - - `cd ; make help` - - Shows the targets available in - - - `make install` - - `make install-strip` - - Installs GHC, libraries and tools under $(prefix). The install-strip - variant strips executable files while installing them. - - - `make sdist` - - `make binary-dist` - - Builds a source or binary distribution respectively - - - `make show VALUE=` - - `make show! VALUE=` - - Show the value of make variable . The show! variant works right after - ./configure (it skips reading package-data.mk files). - - - `make clean` - - `make distclean` - - `make maintainer-clean` - - Various levels of cleaning: "clean" restores the tree to the - state after "./configure", "distclean" restores to the state - after "python3 boot", and maintainer-clean restores the tree to the - completely clean checked-out state. - -Using `make` in subdirectories -============================== - - - `make` - - Builds everything in this directory (including dependencies elsewhere - in the tree, if necessary) - - - `make fast` - - The same as 'make', but omits some phases and does not - recalculate dependencies. Useful for saving time if you are sure - the rest of the tree is up to date. - - - `make clean` - - `make distclean` - - `make maintainer-clean` - - Clean just this directory - - - `make html` - - `make pdf` - - `make ps` - - Make documentation in this directory (if any) - - - `make show VALUE=` - - `make show! VALUE=` - - Show the value of make variable . The show! variant works right after - ./configure (it skips reading package-data.mk files). - - - `make ` - - Bring a particular file up to date, e.g. make dist/build/Module.o - The name is relative to the current directory - -Useful links: -============= - -See also "new Hadrian build system": - - - https://gitlab.haskell.org/ghc/ghc/wikis/building/hadrian diff --git a/Makefile b/Makefile deleted file mode 100644 index 389bfd32f8..0000000000 --- a/Makefile +++ /dev/null @@ -1,233 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# Eliminate use of the built-in implicit rules, and clear out the default list -# of suffixes for suffix rules. Speeds up make quite a bit. Both are needed -# for the shortest `make -d` output. -# Don't set --no-builtin-variables; some rules might stop working if you do -# (e.g. 'make clean' in testsuite/ currently relies on an implicit $RM). -MAKEFLAGS += --no-builtin-rules -.SUFFIXES: - - -# ----------------------------------------------------------------------------- -# Sanitize environment - -# See #11530 -export GREP_OPTIONS := - -ifneq "$(filter maintainer-clean distclean clean clean_% help,$(MAKECMDGOALS))" "" --include mk/config.mk -else -include mk/config.mk -ifeq "$(ProjectVersion)" "" -$(error Please run ./configure first) -endif -endif - -include mk/custom-settings.mk - - -ifeq "$(wildcard distrib/)" "" - -# We're in a bindist - -.PHONY: default -default: - @echo 'Run "make install" to install' - @false - -.PHONY: install show -install show: - $(MAKE) --no-print-directory -f ghc.mk $@ BINDIST=YES NO_INCLUDE_DEPS=YES - -# Note [install-strip] -# ~~~~~~~~~~~~~~~~~~~~ -# install-strip is like install, but it strips the executable files while -# installing them. -# -# From http://www.gnu.org/prep/standards/html_node/Standard-Targets.html: -# -# "install-strip should not strip the executables in the build directory -# which are being copied for installation. It should only strip the copies -# that are installed. " - -.PHONY: install-strip -install-strip: - # See Note [install-strip]. - $(MAKE) --no-print-directory -f ghc.mk INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install BINDIST=YES NO_INCLUDE_DEPS=YES - -else - -.PHONY: default -default : all - @: - -# For help, type 'make help' -.PHONY: help -help: - @cat MAKEHELP.md - -# No need to update makefiles for these targets: -# (the ones we're filtering out) -REALGOALS=$(filter-out \ - binary-dist \ - binary-dist-prep \ - install-strip \ - sdist sdist-ghc \ - sdist-ghc-prep \ - sdist-windows-tarballs \ - sdist-windows-tarballs-prep \ - sdist-testsuite \ - sdist-testsuite-prep \ - bootstrapping-files \ - framework-pkg \ - clean \ - clean_% \ - distclean \ - maintainer-clean \ - show \ - show! \ - echo \ - help \ - test \ - fulltest \ - slowtest \ - fasttest \ - fast \ - ,$(MAKECMDGOALS)) - -# configure touches certain files even if they haven't changed. This -# can mean a lot of unnecessary recompilation after a re-configure, so -# here we cache the old versions of these files so we can restore the -# timestamps. -%.old: % - @set -x && test -f $@ && cmp -s $< $@ || cp -p $< $@ - touch -r $@ $< - - -# NB. not the same as saying '%: ...', which doesn't do the right thing: -# it does nothing if we specify a target that already exists. -.PHONY: $(REALGOALS) all -$(REALGOALS) all: mk/config.mk.old mk/project.mk.old compiler/ghc.cabal.old -ifneq "$(OMIT_PHASE_0)" "YES" - @echo "===--- building phase 0" - $(MAKE) --no-print-directory -f ghc.mk phase=0 phase_0_builds -endif -ifneq "$(OMIT_PHASE_1)" "YES" - @echo "===--- building phase 1" - $(MAKE) --no-print-directory -f ghc.mk phase=1 phase_1_builds -endif - @echo "===--- building final phase" - $(MAKE) --no-print-directory -f ghc.mk phase=final $@ - -# if BINARY_DIST_DIR is not set, assume we want the old -# behaviour of placing the binary dist into the current -# directory. Provide BINARY_DIST_DIR to put the final -# binary distribution elsewhere. -BINARY_DIST_DIR ?= . - -.PHONY: binary-dist -binary-dist: binary-dist-prep - mv bindistprep/*.tar.$(TAR_COMP_EXT) "$(BINARY_DIST_DIR)" - -.PHONY: binary-dist-prep -binary-dist-prep: -ifeq "$(mingw32_TARGET_OS)" "1" - $(MAKE) --no-print-directory -f ghc.mk windows-binary-dist-prep -else - rm -f bindist-list - $(MAKE) --no-print-directory -f ghc.mk bindist-list BINDIST=YES - $(MAKE) --no-print-directory -f ghc.mk unix-binary-dist-prep -endif - -.PHONY: install-strip -install-strip: - # See Note [install-strip]. - $(MAKE) --no-print-directory -f ghc.mk INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install - -.PHONY: sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep -# Just running `./boot && ./configure && make sdist` should work, so skip -# phase 0 and 1 and don't build any dependency files. -sdist sdist-ghc sdist-ghc-prep sdist-windows-tarballs sdist-windows-tarballs-prep sdist-testsuite sdist-testsuite-prep : - $(MAKE) --no-print-directory -f ghc.mk $@ NO_INCLUDE_DEPS=YES NO_INCLUDE_PKGDATA=YES - -.PHONY: clean distclean maintainer-clean -clean distclean maintainer-clean: - $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES - test ! -d testsuite || $(MAKE) -C testsuite $@ - -.PHONY: $(filter clean_%,$(MAKECMDGOALS)) -$(filter clean_%, $(MAKECMDGOALS)) : clean_% : - $(MAKE) --no-print-directory -f ghc.mk $@ CLEANING=YES - -.PHONY: bootstrapping-files show echo -bootstrapping-files show echo: - $(MAKE) --no-print-directory -f ghc.mk $@ - -.PHONY: show! -show!: - $(MAKE) --no-print-directory -f ghc.mk show NO_INCLUDE_PKGDATA=YES - -ifeq "$(darwin_TARGET_OS)" "1" -.PHONY: framework-pkg -framework-pkg: - $(MAKE) -C distrib/MacOS $@ -endif - -# If the user says 'make A B', then we don't want to invoke two -# instances of the rule above in parallel: -.NOTPARALLEL: - -endif - -# Note [validate and testsuite speed] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# There are 3 different validate and testsuite speed settings: -# fast, normal and slow. -# -# how how used -# cd tests config. many many by -# validate && make speed= tests ways whom -# ============================================================================= -# --fast fast 2 some 1+exs Travis (to stay within time limit) -# --normal test 1 all 1+exs Phabricator (slow takes too long?) -# --slow slow 0 all all Nightly (slow is ok) -# -# accept 1 all 1 -# -# `--fast` and `--normal` run one default way, as well as any other ways which -# are explicitly requested by the test using extra_ways(). -# -# `make accept` should run all tests exactly once. There is no point in -# accepting a test for multiple ways, since it should produce the same output -# for all ways. -# -# To make sure all .stderr and .stdout files in the testsuite are never -# out-of-date, it is useful if Phabricator, via a normal `./validate` and `make -# test`, runs each test at least once. -.PHONY: fasttest -fasttest: - $(MAKE) -C testsuite/tests SUMMARY_FILE=../../testsuite_summary.txt fast - -.PHONY: test -test: - $(MAKE) -C testsuite/tests SUMMARY_FILE=../../testsuite_summary.txt - -.PHONY: slowtest fulltest -slowtest fulltest: - $(MAKE) -C testsuite/tests SUMMARY_FILE=../../testsuite_summary.txt slow - -.PHONY: fast -fast: - @echo "You can use 'make fast' only from inside a sub-component directory." - @exit 1 diff --git a/bindisttest/ghc.mk b/bindisttest/ghc.mk deleted file mode 100644 index b1bd16d8ce..0000000000 --- a/bindisttest/ghc.mk +++ /dev/null @@ -1,55 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -ifeq "$(TEST_PREP)" "YES" -BIN_DIST_TEST_TAR_COMP = $(BIN_DIST_PREP_TAR_COMP) -else -BIN_DIST_TEST_TAR_COMP = $(BIN_DIST_TAR_COMP) -endif - -.PHONY: test_bindist -test_bindist: - "$(RM)" $(RM_OPTS_REC) bindisttest/$(BIN_DIST_INST_SUBDIR) - "$(RM)" $(RM_OPTS_REC) bindisttest/a - "$(RM)" $(RM_OPTS) bindisttest/HelloWorld - "$(RM)" $(RM_OPTS) bindisttest/HelloWorld.o - "$(RM)" $(RM_OPTS) bindisttest/HelloWorld.hi - "$(RM)" $(RM_OPTS) bindisttest/output -# We use the a/b/c subdirectory as configure looks for install-sh in -# . .. ../.. and we don't want it to find the build system's install-sh. -# -# NB. tar has funny interpretation of filenames sometimes (thinking -# c:/foo is a remote file), so it's safer to bzip and then pipe into -# tar rather than using tar -xjf: - mkdir bindisttest/a - mkdir bindisttest/a/b - mkdir bindisttest/a/b/c - cd bindisttest/a/b/c/ && $(TAR_COMP_CMD) -cd ../../../../$(BIN_DIST_TEST_TAR_COMP) | $(TAR_CMD) -xf - - $(SHELL) bindisttest/checkBinaries.sh $(ProjectVersion) -ifeq "$(Windows_Host)" "YES" - mv bindisttest/a/b/c/$(BIN_DIST_NAME) $(BIN_DIST_INST_DIR) -else - cd bindisttest/a/b/c/$(BIN_DIST_NAME) && ./configure --prefix=$(TOP)/$(BIN_DIST_INST_DIR) CC="$(CC)" - cd bindisttest/a/b/c/$(BIN_DIST_NAME) && $(MAKE) install -endif -ifeq "$(GhcProfiled)" "NO" - $(BIN_DIST_INST_DIR)/bin/runghc bindisttest/HelloWorld > bindisttest/output - $(CONTEXT_DIFF) bindisttest/output bindisttest/expected_output -endif - $(BIN_DIST_INST_DIR)/bin/ghc --make bindisttest/HelloWorld - bindisttest/HelloWorld > bindisttest/output - $(CONTEXT_DIFF) bindisttest/output bindisttest/expected_output -# Without --no-user-package-db we might pick up random packages from ~/.ghc - $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-db - -$(eval $(call clean-target,bindisttest,all,$(BIN_DIST_INST_DIR) $(wildcard bindisttest/a/b/c/*) bindisttest/HelloWorld bindisttest/HelloWorld.o bindisttest/HelloWorld.hi bindisttest/output)) - diff --git a/boot b/boot index a8cf8c49c0..872eeb01f6 100755 --- a/boot +++ b/boot @@ -56,70 +56,6 @@ def check_boot_packages(): Maybe you haven't run 'git submodule update --init'? """ % license_path) -# Create libraries/*/{ghc.mk,GNUmakefile} -def boot_pkgs(): - library_dirs = [] - - for package in glob.glob("libraries/*/"): - packages_file = os.path.join(package, 'ghc-packages') - print(package) - if os.path.isfile(packages_file): - for subpkg in open(packages_file, 'r'): - library_dirs.append(os.path.join(package, subpkg.strip())) - elif package in EXCEPTIONS: - library_dirs.append(EXCEPTIONS[package]) - else: - library_dirs.append(package) - - for package in library_dirs: - if package[-1] == '/': - # drop trailing '/' - package = package[:-1] - - dir_ = os.path.relpath(package, 'libraries') - cabals = glob.glob(os.path.join(package, '*.cabal.in')) - if len(cabals) == 0: - cabals = glob.glob(os.path.join(package, '*.cabal')) - - if len(cabals) > 1: - die('Too many .cabal files in %s' % package) - elif len(cabals) == 1: - cabal = cabals[0] - - if os.path.isfile(cabal): - # strip both .cabal and .in - pkg = os.path.splitext(os.path.splitext(os.path.basename(cabal))[0])[0] - top = os.path.join(*['..'] * len(os.path.normpath(package).split(os.path.sep))) - - ghc_mk = os.path.join(package, 'ghc.mk') - if os.path.exists(ghc_mk): - print('Skipping %s which already exists' % ghc_mk) - continue - print('Creating %s' % ghc_mk) - with open(ghc_mk, 'w') as f: - f.write(dedent( - """\ - {package}_PACKAGE = {pkg} - {package}_dist-install_GROUP = libraries - $(if $(filter {dir},$(PACKAGES_STAGE0)),$(eval $(call build-package,{package},dist-boot,0))) - $(if $(filter {dir},$(PACKAGES_STAGE1)),$(eval $(call build-package,{package},dist-install,1))) - $(if $(filter {dir},$(PACKAGES_STAGE2)),$(eval $(call build-package,{package},dist-install,2))) - """.format(package = package, - pkg = pkg, - dir = dir_))) - - makefile = os.path.join(package, 'GNUmakefile') - with open(makefile, 'w') as f: - f.write(dedent( - """\ - dir = {package} - TOP = {top} - include $(TOP)/mk/sub-makefile.mk - FAST_MAKE_OPTS += stage=0 - """.format(package = package, top = top) - )) - - def autoreconf(): # Run autoreconf on everything that needs it. processes = {} @@ -154,24 +90,5 @@ def autoreconf(): if fail: sys.exit(1) -def check_build_mk(): - if not args.validate and not os.path.isfile("mk/build.mk"): - print(dedent( - """ - WARNING: You don't have a mk/build.mk file. - - By default a standard GHC build will be done, which uses optimisation - and builds the profiling libraries. This will take a long time, so may - not be what you want if you are developing GHC or the libraries, rather - than simply building it to use it. - - For information on creating a mk/build.mk file, please see: - https://gitlab.haskell.org/ghc/ghc/wikis/building/using#build-configuration - """)) - check_boot_packages() -if not args.hadrian: - boot_pkgs() autoreconf() -if not args.hadrian: - check_build_mk() diff --git a/compiler/Makefile b/compiler/Makefile deleted file mode 100644 index 514b345dd3..0000000000 --- a/compiler/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# If the user says 'make' or 'make stage=2' here, we behave as if they were -# in the ghc directory instead, so that the executable GHC gets built. -.PHONY: default_to_ghc all_ghc -default_to_ghc : all_ghc - -dir = compiler - -include ../mk/compiler-ghc.mk - -all_ghc : - +$(TOPMAKE) all_ghc $(EXTRA_MAKE_OPTS) - diff --git a/compiler/ghc.mk b/compiler/ghc.mk deleted file mode 100644 index 4b33936afa..0000000000 --- a/compiler/ghc.mk +++ /dev/null @@ -1,294 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009-2012 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# ----------------------------------------------------------------------------- -# Create compiler configuration -# -# The 'echo' commands simply spit the values of various make variables -# into Config.hs, whence they can be compiled and used by GHC itself - -compiler_stage1_C_FILES_NODEPS = compiler/cbits/cutils.c - -# TODO(@Ericson2314) Get rid of compiler-specific stage indices. I think the -# argument was stage n ghc is used to build stage n everything else, but I -# don't buy that argument. - -ifneq "$(BINDIST)" "YES" - -$(foreach n,1 2 3, \ - $(eval compiler/stage$n/package-data.mk : compiler/stage$n/build/GHC/Settings/Config.hs) \ - $(eval compiler/stage$n/build/GHC/Platform/Constants.o: compiler/stage$n/build/GHC/Platform/Constants.hs) \ - ) -endif - -BUILDPLATFORM_1 = $(BUILDPLATFORM) -BUILDPLATFORM_2 = $(HOSTPLATFORM) -BUILDPLATFORM_3 = $(TARGETPLATFORM) - -HOSTPLATFORM_1 = $(HOSTPLATFORM) -HOSTPLATFORM_2 = $(TARGETPLATFORM) -HOSTPLATFORM_3 = $(TARGETPLATFORM) - -define compilerConfig -# $1 = compile stage (1-indexed) -compiler/stage$1/build/GHC/Settings/Config.hs : mk/config.mk mk/project.mk | $$$$(dir $$$$@)/. - $$(call removeFiles,$$@) - @echo 'Creating $$@ ... ' - @echo 'module GHC.Settings.Config' >> $$@ - @echo ' ( module GHC.Version' >> $$@ - @echo ' , cBuildPlatformString' >> $$@ - @echo ' , cHostPlatformString' >> $$@ - @echo ' , cProjectName' >> $$@ - @echo ' , cBooterVersion' >> $$@ - @echo ' , cStage' >> $$@ - @echo ' ) where' >> $$@ - @echo >> $$@ - @echo 'import GHC.Prelude' >> $$@ - @echo >> $$@ - @echo 'import GHC.Version' >> $$@ - @echo >> $$@ - @echo 'cBuildPlatformString :: String' >> $$@ - @echo 'cBuildPlatformString = "$(BUILDPLATFORM_$1)"' >> $$@ - @echo >> $$@ - @echo 'cHostPlatformString :: String' >> $$@ - @echo 'cHostPlatformString = "$(HOSTPLATFORM_$1)"' >> $$@ - @echo >> $$@ - @echo 'cProjectName :: String' >> $$@ - @echo 'cProjectName = "$(ProjectName)"' >> $$@ - @echo >> $$@ - @echo 'cBooterVersion :: String' >> $$@ - @echo 'cBooterVersion = "$(GhcVersion)"' >> $$@ - @echo >> $$@ - @echo 'cStage :: String' >> $$@ - @echo 'cStage = show ($1 :: Int)' >> $$@ - @echo done. - -compiler/stage$1/build/GHC/Platform/Constants.hs : $$(deriveConstants_INPLACE) | $$$$(dir $$$$@)/. - $$< --gen-haskell-type -o $$@ -endef - -$(eval $(call compilerConfig,1)) -$(eval $(call compilerConfig,2)) -$(eval $(call compilerConfig,3)) - -# ---------------------------------------------------------------------------- -# Generate supporting stuff for GHC/Builtin/PrimOps.hs -# from GHC/Builtin/primops.txt - -PRIMOP_BITS_NAMES = primop-data-decl.hs-incl \ - primop-tag.hs-incl \ - primop-list.hs-incl \ - primop-has-side-effects.hs-incl \ - primop-out-of-line.hs-incl \ - primop-commutable.hs-incl \ - primop-code-size.hs-incl \ - primop-can-fail.hs-incl \ - primop-strictness.hs-incl \ - primop-fixity.hs-incl \ - primop-primop-info.hs-incl \ - primop-vector-uniques.hs-incl \ - primop-vector-tys.hs-incl \ - primop-vector-tys-exports.hs-incl \ - primop-vector-tycons.hs-incl \ - primop-docs.hs-incl - -PRIMOP_BITS_STAGE1 = $(addprefix compiler/stage1/build/,$(PRIMOP_BITS_NAMES)) -PRIMOP_BITS_STAGE2 = $(addprefix compiler/stage2/build/,$(PRIMOP_BITS_NAMES)) -PRIMOP_BITS_STAGE3 = $(addprefix compiler/stage3/build/,$(PRIMOP_BITS_NAMES)) - -define preprocessCompilerFiles -# $1 = compiler stage (build system stage + 1) -compiler/stage$1/build/primops.txt: \ - compiler/GHC/Builtin/primops.txt.pp - $$(HS_CPP) -P \ - -x c $$< | grep -v '^#pragma GCC' > $$@ - -compiler/stage$1/build/primop-data-decl.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --data-decl < $$< > $$@ -compiler/stage$1/build/primop-tag.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --primop-tag < $$< > $$@ -compiler/stage$1/build/primop-list.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --primop-list < $$< > $$@ -compiler/stage$1/build/primop-has-side-effects.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --has-side-effects < $$< > $$@ -compiler/stage$1/build/primop-out-of-line.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --out-of-line < $$< > $$@ -compiler/stage$1/build/primop-commutable.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --commutable < $$< > $$@ -compiler/stage$1/build/primop-code-size.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --code-size < $$< > $$@ -compiler/stage$1/build/primop-can-fail.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --can-fail < $$< > $$@ -compiler/stage$1/build/primop-strictness.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --strictness < $$< > $$@ -compiler/stage$1/build/primop-fixity.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --fixity < $$< > $$@ -compiler/stage$1/build/primop-primop-info.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --primop-primop-info < $$< > $$@ -compiler/stage$1/build/primop-vector-uniques.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --primop-vector-uniques < $$< > $$@ -compiler/stage$1/build/primop-vector-tys.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --primop-vector-tys < $$< > $$@ -compiler/stage$1/build/primop-vector-tys-exports.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --primop-vector-tys-exports < $$< > $$@ -compiler/stage$1/build/primop-vector-tycons.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --primop-vector-tycons < $$< > $$@ -compiler/stage$1/build/primop-docs.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --wired-in-docs < $$< > $$@ - -# Usages aren't used any more; but the generator -# can still generate them if we want them back -compiler/stage$1/build/primop-usage.hs-incl: compiler/stage$1/build/primops.txt $$$$(genprimopcode_INPLACE) - "$$(genprimopcode_INPLACE)" --usage < $$< > $$@ - -endef - -$(eval $(call preprocessCompilerFiles,1)) -$(eval $(call preprocessCompilerFiles,2)) -$(eval $(call preprocessCompilerFiles,3)) - -# ----------------------------------------------------------------------------- -# Configuration - -ifeq "$(GhcWithInterpreter)" "YES" -compiler_stage2_CONFIGURE_OPTS += --flags=internal-interpreter - -endif - -ifeq "$(TargetOS_CPP)" "openbsd" -compiler_CONFIGURE_OPTS += --ld-options=-E -endif - -ifeq "$(WITH_TERMINFO)" "NO" -compiler_stage2_CONFIGURE_OPTS += --flags=-terminfo -endif - -# Careful optimisation of the parser: we don't want to throw everything -# at it, because that takes too long and doesn't buy much, but we do want -# to inline certain key external functions, so we instruct GHC not to -# throw away inlinings as it would normally do in -O0 mode. -# Since GHC version 7.8, we need -fcmm-sink to be -# passed to the compiler. This is required on x86 to avoid the -# register allocator running out of stack slots when compiling this -# module with -fPIC -dynamic. -# See #8182 for all the details -compiler/stage1/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas -fcmm-sink -compiler/stage2/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas -fcmm-sink -compiler/stage3/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas -fcmm-sink - -ifeq "$(GhcProfiled)" "YES" -# If we're profiling GHC then we want SCCs. However, adding -auto-all -# everywhere tends to give a hard-to-read profile, and adds lots of -# overhead. A better approach is to proceed top-down; identify the -# parts of the compiler of interest, and then add further cost centres -# as necessary. Turn on -fprof-auto for individual modules like this: - -# compiler/GHC/Driver/Pipeline_HC_OPTS += -fprof-auto -compiler/GHC/Driver/Make_HC_OPTS += -fprof-auto -compiler/GHC_HC_OPTS += -fprof-auto - -# or alternatively add {-# OPTIONS_GHC -fprof-auto #-} to the top of -# modules you're interested in. - -# We seem to still build the vanilla libraries even if we say -# --disable-library-vanilla, but installation then fails, as Cabal -# doesn't copy the vanilla .hi files, but ghc-pkg complains about -# their absence when we register the package. So for now, we just -# leave the vanilla libraries enabled. -# compiler_stage2_CONFIGURE_OPTS += --disable-library-vanilla -compiler_stage2_CONFIGURE_OPTS += --ghc-pkg-option=--force -endif - -compiler_stage3_CONFIGURE_OPTS := $(compiler_stage2_CONFIGURE_OPTS) - -compiler/stage1/package-data.mk : compiler/ghc.mk -compiler/stage2/package-data.mk : compiler/ghc.mk -compiler/stage3/package-data.mk : compiler/ghc.mk - -# ----------------------------------------------------------------------------- -# And build the package - -compiler_PACKAGE = ghc - -# Don't do splitting for the GHC package, it takes too long and -# there's not much benefit. -compiler_stage1_SplitSections = NO -compiler_stage2_SplitSections = NO -compiler_stage3_SplitSections = NO - -# if stage is set to something other than "1" or "", disable stage 1 -# See Note [Stage1Only vs stage=1] in mk/config.mk.in. -ifneq "$(filter-out 1,$(stage))" "" -compiler_stage1_NOT_NEEDED = YES -endif -# if stage is set to something other than "2" or "", disable stage 2 -ifneq "$(filter-out 2,$(stage))" "" -compiler_stage2_NOT_NEEDED = YES -endif -# stage 3 has to be requested explicitly with stage=3 -ifneq "$(stage)" "3" -compiler_stage3_NOT_NEEDED = YES -endif -$(eval $(call build-package,compiler,stage1,0)) -$(eval $(call build-package,compiler,stage2,1)) -$(eval $(call build-package,compiler,stage3,2)) - -# We only want to turn keepCAFs on if we will be loading dynamic -# Haskell libraries with GHCi. We therefore filter the object file -# out for non-dynamic ways. -define keepCAFsForGHCiDynOnly -# $1 = stage -# $2 = way -ifeq "$$(findstring dyn, $2)" "" -compiler_stage$1_$2_C_OBJS := $$(filter-out %/keepCAFsForGHCi.$$($2_osuf),$$(compiler_stage$1_$2_C_OBJS)) -endif -endef -$(foreach w,$(compiler_stage1_WAYS),$(eval $(call keepCAFsForGHCiDynOnly,1,$w))) -$(foreach w,$(compiler_stage2_WAYS),$(eval $(call keepCAFsForGHCiDynOnly,2,$w))) -$(foreach w,$(compiler_stage3_WAYS),$(eval $(call keepCAFsForGHCiDynOnly,3,$w))) - -# after build-package, because that adds --enable-library-for-ghci -# to compiler_stage*_CONFIGURE_OPTS: -# We don't build the GHCi library for the ghc package. We can load it -# the .a file instead, and as object splitting isn't on for the ghc -# package this isn't much slower.However, not building the package saves -# a significant chunk of disk space. -compiler_stage1_CONFIGURE_OPTS += --disable-library-for-ghci -compiler_stage2_CONFIGURE_OPTS += --disable-library-for-ghci -compiler_stage3_CONFIGURE_OPTS += --disable-library-for-ghci - -# after build-package, because that sets compiler_stage1_HC_OPTS: - -ifeq "$(V)" "0" -compiler_stage1_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage1HcOpts) -compiler_stage2_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage2HcOpts) -compiler_stage3_HC_OPTS += $(filter-out -Rghc-timing,$(GhcHcOpts)) $(GhcStage3HcOpts) -else -compiler_stage1_HC_OPTS += $(GhcHcOpts) $(GhcStage1HcOpts) -compiler_stage2_HC_OPTS += $(GhcHcOpts) $(GhcStage2HcOpts) -compiler_stage3_HC_OPTS += $(GhcHcOpts) $(GhcStage3HcOpts) -endif - -ifneq "$(BINDIST)" "YES" - -$(compiler_stage1_depfile_haskell) : $(COMPILER_INCLUDES_DEPS) $(PRIMOP_BITS_STAGE1) -$(compiler_stage2_depfile_haskell) : $(COMPILER_INCLUDES_DEPS) $(PRIMOP_BITS_STAGE2) -$(compiler_stage3_depfile_haskell) : $(COMPILER_INCLUDES_DEPS) $(PRIMOP_BITS_STAGE3) - -$(foreach way,$(compiler_stage1_WAYS),\ - compiler/stage1/build/PrimOp.$($(way)_osuf)) : $(PRIMOP_BITS_STAGE1) -$(foreach way,$(compiler_stage2_WAYS),\ - compiler/stage2/build/PrimOp.$($(way)_osuf)) : $(PRIMOP_BITS_STAGE2) -$(foreach way,$(compiler_stage3_WAYS),\ - compiler/stage3/build/PrimOp.$($(way)_osuf)) : $(PRIMOP_BITS_STAGE3) - -endif diff --git a/docs/users_guide/ghc.mk b/docs/users_guide/ghc.mk deleted file mode 100644 index af051227fc..0000000000 --- a/docs/users_guide/ghc.mk +++ /dev/null @@ -1,50 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -docs/users_guide_RST_SOURCES := $(wildcard docs/users_guide/*.rst) - -$(eval $(call sphinx,docs/users_guide,users_guide)) - -html_docs/users_guide : docs/users_guide/images/prof_scc.svg - -# man page -docs/users_guide_MAN_RST_SOURCES := docs/users_guide/ghc.rst - -MAN_SECTION := 1 -MAN_PAGES := docs/users_guide/build-man/ghc.1 - -ifneq "$(BINDIST)" "YES" -$(MAN_PAGES): $(docs/users_guide_MAN_RST_SOURCES) - $(SPHINXBUILD) -b man -d docs/users_guide/.doctrees-man docs/users_guide docs/users_guide/build-man -endif - -$(eval $(call clean-target,users-guide,manpage,docs/users_guide/.doctrees-man/ docs/users_guide/build-man/)) - -man : $(MAN_PAGES) - -ifeq "$(BUILD_MAN)" "YES" -ifeq "$(phase)" "final" -$(eval $(call all-target,users_guide/man,$(MAN_PAGES))) -endif - -INSTALL_MANPAGES += $(MAN_PAGES) - -install: install_man - -.PHONY: install_man -install_man: $(MAN_PAGES) - $(INSTALL_DIR) "$(DESTDIR)$(mandir)" - $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)" - $(INSTALL_MAN) $(INSTALL_OPTS) $(MAN_PAGES) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)" - -endif diff --git a/driver/ghc.mk b/driver/ghc.mk deleted file mode 100644 index c1adefe5dc..0000000000 --- a/driver/ghc.mk +++ /dev/null @@ -1,22 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -$(eval $(call all-target,driver,$(INPLACE_LIB)/ghc-usage.txt $(INPLACE_LIB)/ghci-usage.txt)) - -$(INPLACE_LIB)/ghc-usage.txt: driver/ghc-usage.txt - cp $< $@ - -$(INPLACE_LIB)/ghci-usage.txt: driver/ghci-usage.txt - cp $< $@ - -INSTALL_LIBS += driver/ghc-usage.txt driver/ghci-usage.txt - diff --git a/driver/ghc/ghc.mk b/driver/ghc/ghc.mk deleted file mode 100644 index 46fccefdfa..0000000000 --- a/driver/ghc/ghc.mk +++ /dev/null @@ -1,24 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -ifeq "$(Windows_Host)" "YES" - -driver/ghc_dist_C_SRCS = ghc.c ../utils/cwrapper.c ../utils/getLocation.c -driver/ghc_dist_CC_OPTS += -I driver/utils -driver/ghc_dist_PROGNAME = ghc-$(ProjectVersion) -driver/ghc_dist_INSTALL = YES -driver/ghc_dist_INSTALL_INPLACE = NO - -$(eval $(call build-prog,driver/ghc,dist,0)) - -endif - diff --git a/driver/ghci/ghc.mk b/driver/ghci/ghc.mk deleted file mode 100644 index 9ddab61649..0000000000 --- a/driver/ghci/ghc.mk +++ /dev/null @@ -1,67 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -ifeq "$(GhcWithInterpreter)" "YES" -ifneq "$(Windows_Host)" "YES" - -install: install_driver_ghci - -.PHONY: install_driver_ghci -install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci-$(ProjectVersion) -install_driver_ghci: - $(INSTALL_DIR) "$(DESTDIR)$(bindir)" - $(call removeFiles, "$(WRAPPER)") - $(CREATE_SCRIPT) "$(WRAPPER)" - echo '#!/bin/sh' >> "$(WRAPPER)" - echo 'exec "$(bindir)/$(CrossCompilePrefix)ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)" - $(EXECUTABLE_FILE) "$(WRAPPER)" - $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci") - $(LN_S) $(CrossCompilePrefix)ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci" - -else # Windows_Host... - -driver/ghci_dist_C_SRCS = ghci.c ../utils/cwrapper.c ../utils/getLocation.c ../utils/isMinTTY.c -driver/ghci_dist_CC_OPTS += -I driver/utils -driver/ghci_dist_PROGNAME = ghci -driver/ghci_dist_INSTALL = YES -driver/ghci_dist_INSTALL_INPLACE = YES -driver/ghci_dist_OTHER_OBJS = driver/ghci/ghci.res - -$(eval $(call build-prog,driver/ghci,dist,1)) - -driver/ghci_dist_PROG_VER = ghci-$(ProjectVersion)$(exeext1) - -INSTALL_BINS += driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG_VER) - -driver/ghci/ghci.res : driver/ghci/ghci.rc driver/ghci/ghci.ico - "$(WINDRES)" --preprocessor="$(CPP) -xc -DRC_INVOKED" -o driver/ghci/ghci.res -i driver/ghci/ghci.rc -O coff - -driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG_VER) : driver/ghci/dist/build/tmp/$(driver/ghci_dist_PROG) - "$(CP)" $< $@ - -install : install_driver_ghcii - -.PHONY: install_driver_ghcii -install_driver_ghcii: GHCII_SCRIPT=$(DESTDIR)$(bindir)/ghcii.sh -install_driver_ghcii: GHCII_SCRIPT_VERSIONED = $(DESTDIR)$(bindir)/ghcii-$(ProjectVersion).sh -install_driver_ghcii: - $(INSTALL_DIR) "$(DESTDIR)$(bindir)" - $(call removeFiles,"$(GHCII_SCRIPT)") - echo "#!/bin/sh" >> $(GHCII_SCRIPT) - echo 'exec "$$(dirname "$$0")"/ghc --interactive "$$@"' >> $(GHCII_SCRIPT) - $(EXECUTABLE_FILE) $(GHCII_SCRIPT) - cp $(GHCII_SCRIPT) $(GHCII_SCRIPT_VERSIONED) - $(EXECUTABLE_FILE) $(GHCII_SCRIPT_VERSIONED) - -endif -endif - diff --git a/driver/haddock/ghc.mk b/driver/haddock/ghc.mk deleted file mode 100644 index 24417b8d7f..0000000000 --- a/driver/haddock/ghc.mk +++ /dev/null @@ -1,24 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -ifeq "$(Windows_Host)" "YES" - -driver/haddock_dist_C_SRCS = haddock.c ../utils/cwrapper.c ../utils/getLocation.c -driver/haddock_dist_CC_OPTS += -I driver/utils -driver/haddock_dist_PROGNAME = haddock-$(ProjectVersion) -driver/haddock_dist_INSTALL = YES -driver/haddock_dist_INSTALL_INPLACE = NO - -$(eval $(call build-prog,driver/haddock,dist,0)) - -endif - diff --git a/ghc.mk b/ghc.mk deleted file mode 100644 index f0b76b9640..0000000000 --- a/ghc.mk +++ /dev/null @@ -1,1594 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009-2013 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# ToDo List. -# -# * remove old Makefiles, add new stubs for building in subdirs -# * docs/Makefile -# * docs/storage-mgmt/Makefile -# * docs/vh/Makefile -# * rts/dotnet/Makefile -# * utils/Makefile -# * add Makefiles for the rest of the utils/ programs that aren't built -# by default (need to exclude them from 'make all' too) - -# Possible cleanups: -# -# * per-source-file dependencies instead of one .depend file? -# * eliminate undefined variables, and use --warn-undefined-variables? -# * put outputs from different ways in different subdirs of distdir/build, -# 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_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 -# a state where the package database is out of date, and the build -# system doesn't know. - -# Approximate build order. -# -# The actual build order is defined by dependencies, and the phase -# ordering used to ensure correct ordering of makefile-generation; see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture/idiom/phase-ordering -# -# * With bootstrapping compiler: -# o Build utils/ghc-cabal -# o Build utils/ghc-pkg -# o Build utils/hsc2hs -# o Build utils/genprimopcode -# o Build utils/deriveConstants -# * For each package: -# o configure, generate package-data.mk and inplace-pkg-config -# o register each package into inplace/lib/package.conf -# * build libffi (if not disabled by --with-system-libffi) -# * With bootstrapping compiler: -# o Build libraries/{filepath,hpc,Cabal} -# o Build compiler (stage 1) -# * With stage 1 compiler: -# o Build libraries/* -# o Build rts -# o Build utils/* (except haddock) -# o Build compiler (stage 2) -# * With stage 2 compiler: -# o Build utils/haddock -# o Build compiler (stage 3) (optional) -# * With haddock: -# o libraries/* -# o compiler - -.PHONY: default all haddock - -# We need second expansion for the way we handle directories, so that -# | $$$$(dir $$$$@)/. -# expands to the directory of a rule that uses a % pattern. -.SECONDEXPANSION: - -default : all - - -################################################## -# Check that we have a new enough 'make' - -HAVE_EVAL := NO -$(eval HAVE_EVAL := YES) - -ifeq "$(HAVE_EVAL)" "NO" -$(error Your make does not support eval. You need GNU make >= 3.81) -endif - -ifeq "$(abspath /)" "" -$(error Your make does not support abspath. You need GNU make >= 3.81) -endif -################################################## - -# ----------------------------------------------------------------------------- -# Catch make if it runs away into an infinite loop -ifeq "$(MAKE_RESTARTS)" "" -else ifeq "$(MAKE_RESTARTS)" "1" -else -$(error Make has restarted itself $(MAKE_RESTARTS) times; is there a makefile bug? See https://gitlab.haskell.org/ghc/ghc/wikis/building/troubleshooting#make-has-restarted-itself-3-times-is-there-a-makefile-bug for details) -endif - -# ----------------------------------------------------------------------------- -# Misc GNU make utils - -nothing= -space=$(nothing) $(nothing) -comma=, - -# ----------------------------------------------------------------------------- -# Makefile debugging -# -# to see the effective value used for a Makefile variable, do -# make show VALUE=MY_VALUE -# - -show: - @echo '$(VALUE)="$($(VALUE))"' - -# echo is used by the nightly builders to query the build system for -# information. -# Using printf means that we don't get a trailing newline. We escape -# backslashes and double quotes in the string to protect them from the -# shell, and percent signs to protect them from printf. -echo: - @printf "$(subst %,%%,$(subst ",\",$(subst \,\\\\,$($(VALUE)))))" - -# ----------------------------------------------------------------------------- -# Include subsidiary build-system bits - -include mk/tree.mk - -ifneq "$(CLEANING)" "YES" -include mk/config.mk -ifeq "$(ProjectVersion)" "" -$(error Please run ./configure first) -endif -endif - -include mk/ways.mk - -# (Optional) build-specific configuration -include mk/custom-settings.mk - -# The user can reset SRC_HC_OPTS from mk/build.mk. Since we try to append -# '-Wall' to it in mk/warnings.mk, we have to include mk/warnings.mk after -# mk/custom-settings.mk. -include mk/warnings.mk - -# ----------------------------------------------------------------------------- -# Check for inconsistent settings, after reading mk/build.mk. -# Although mk/config.mk should always contain consistent settings (set by -# configure), mk/build.mk can contain pretty much anything. - -ifneq "$(CLEANING)" "YES" - -ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES" -ifeq "$(findstring dyn,$(GhcLibWays))" "" -$(error dyn is not in $$(GhcLibWays), but $$(DYNAMIC_GHC_PROGRAMS) is YES) -endif -else -ifeq "$(findstring v,$(GhcLibWays))" "" -$(error v is not in $$(GhcLibWays), and $$(DYNAMIC_GHC_PROGRAMS) is not YES) -endif -endif - -ifeq "$(GhcProfiled)" "YES" -ifeq "$(findstring p,$(GhcLibWays))" "" -$(error p is not in $$(GhcLibWays), and $$(GhcProfiled) is YES) -endif -endif - -ifeq "$(BUILD_SPHINX_HTML)" "YES" -ifeq "$(SPHINXBUILD)" "" -$(error BUILD_SPHINX_HTML=YES, but `sphinx-build` was not found. \ - Create a file `mk/validate.mk` containing `BUILD_SPHINX_HTML=NO` \ - (when validating), or install `sphinx-build` and rerun `./configure`. \ - See https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation) -endif -endif - -ifeq "$(BUILD_SPHINX_PDF)" "YES" -ifeq "$(XELATEX)" "" -$(error BUILD_SPHINX_PDF=YES, but `xelatex` was not found. \ - Install `xelatex`, then rerun `./configure`. \ - See https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation) -endif -ifeq "$(MAKEINDEX)" "" -$(error BUILD_SPHINX_PDF=YES, but `makeindex` was not found. \ - Install `xelatex`, then rerun `./configure`. \ - See https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation) -endif -endif - -ifeq "$(HSCOLOUR_SRCS)" "YES" -ifeq "$(HSCOLOUR_CMD)" "" -$(error HSCOLOUR_SRCS=YES, but HSCOLOUR_CMD is empty. \ - Run `cabal install hscolour`, then rerun `./configure`. \ - See https://gitlab.haskell.org/ghc/ghc/wikis/building/preparation) -endif -endif - -ifeq "$(HADDOCK_DOCS)" "YES" -ifneq "$(CrossCompiling) $(Stage1Only)" "NO NO" -$(error Can not build haddock docs when CrossCompiling or Stage1Only. \ - Set HADDOCK_DOCS=NO in your mk/build.mk file. \ - See Note [No stage2 packages when CrossCompiling or Stage1Only]) -endif -endif - -endif # CLEANING - -# ----------------------------------------------------------------------------- - -ifeq "$(phase)" "" -phase = final -endif - -# ----------------------------------------------------------------------------- -# Utility definitions - -include rules/prof.mk -include rules/trace.mk -include rules/library-path.mk -include rules/add-dependency.mk -include rules/make-command.mk -include rules/pretty_commands.mk - -# ----------------------------------------------------------------------------- -# Macros for standard targets - -include rules/all-target.mk -include rules/clean-target.mk - -# ----------------------------------------------------------------------------- -# The inplace tree - -$(eval $(call clean-target,root,inplace,inplace/bin inplace/lib)) - -# ----------------------------------------------------------------------------- -# Whether to build dependencies or not - -# When we're just doing 'make clean' or 'make show', then we don't need -# to build dependencies. - -ifeq "$(CLEANING)" "YES" -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 -endif - -# ----------------------------------------------------------------------------- -# Ways - -include rules/way-prelims.mk - -$(foreach way,$(ALL_WAYS),\ - $(eval $(call way-prelims,$(way)))) - -ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES" -GHCI_WAY = dyn -HADDOCK_WAY = dyn -else -GHCI_WAY = v -HADDOCK_WAY = v -endif - -WINDOWS_DYN_PROG_RTS := rts -ifeq "$(GhcThreaded)" "YES" -WINDOWS_DYN_PROG_RTS := $(WINDOWS_DYN_PROG_RTS)_thr -endif -ifeq "$(GhcDebugged)" "YES" -WINDOWS_DYN_PROG_RTS := $(WINDOWS_DYN_PROG_RTS)_debug -endif -WINDOWS_DYN_PROG_RTS := $(WINDOWS_DYN_PROG_RTS)_dyn_LIB_FILE - -# ----------------------------------------------------------------------------- -# Compilation Flags - -include rules/distdir-opts.mk -include rules/distdir-way-opts.mk - -# ----------------------------------------------------------------------------- -# Finding source files and object files - -include rules/hs-sources.mk -include rules/c-sources.mk -include rules/includes-sources.mk -include rules/hs-objs.mk -include rules/c-objs.mk -include rules/cmm-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-way-rules-srcdir.mk -include rules/hs-suffix-way-rules.mk -include rules/hi-rule.mk -include rules/c-suffix-rules.mk -include rules/cxx-suffix-rules.mk -include rules/cmm-suffix-rules.mk -endif - -# ----------------------------------------------------------------------------- -# Building package-data.mk files from .cabal files - -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 - -include rules/build-package-data.mk - -# ----------------------------------------------------------------------------- -# Build and install a program - -include rules/build-prog.mk -include rules/shell-wrapper.mk - -# ----------------------------------------------------------------------------- -# Build a package - -include rules/build-package.mk -include rules/build-package-way.mk -include rules/haddock.mk -include rules/foreachLibrary.mk - -# ----------------------------------------------------------------------------- -# Registering hand-written package descriptions (used in rts) - -include rules/manual-package-config.mk - -# ----------------------------------------------------------------------------- -# Docs - -include rules/sphinx.mk - -# ----------------------------------------------------------------------------- -# Making bindists and sdists - -include rules/bindist.mk -include rules/sdist-ghc-file.mk - -# ----------------------------------------------------------------------------- -# Directories - -# Don't try to delete directories: -.PRECIOUS: %/. - -# Create build directories on demand. NB. the | below: this indicates -# that $(MKDIRHIER) is an order-only dependency, which means that this -# rule fires after building mkdirhier, but we won't try to recreate -# directories if mkdirhier changes. -%/. : | $(MKDIRHIER) - "$(MKDIRHIER)" $@ - -# ----------------------------------------------------------------------------- -# Lax dependencies - -ifeq "$(LAX_DEPENDENCIES)" "YES" -LAX_DEPS_FOLLOW = | -else -LAX_DEPS_FOLLOW = -endif - -# This is a bit of a hack. When LAX_DEPS_FOLLOW is | some rules end up -# looking like -# target: a | b | c -# The first | signals the start of the order-only dependencies, but make -# treats the second | as a dependency. So we need to tell make how to -# build that dependency. - -.PHONY: | -| : - @: - -# ----------------------------------------------------------------------------- -# Packages to build -# The lists of packages that we *actually* going to build in each stage: -# -# $(PACKAGES_STAGE0) -# $(PACKAGES_STAGE1) -# $(PACKAGES_STAGE2) -# -# Note that we need to add them to these variables in dependency -# order, as this is the order that they get configured in. - -ifeq "$(CLEANING)" "YES" - -define addLibraryForCleaning -# We just add all packages to both the stage 0 and stage 1 lists. -# Stage 2 gets cleaned in the same way as stage 1, so no need to -# add it there. -PACKAGES_STAGE0 += $1 -PACKAGES_STAGE1 += $1 -endef -$(eval $(call foreachLibrary,addLibraryForCleaning)) - -else # CLEANING - -# Packages that are built by stage0. These packages are dependencies of -# programs such as GHC and ghc-pkg, that we do not assume the stage0 -# compiler already has installed (or up-to-date enough). -# Note that these must be given in topological order. -PACKAGES_STAGE0 = binary transformers mtl hpc ghc-boot-th ghc-boot template-haskell text parsec Cabal/Cabal-syntax Cabal/Cabal ghc-heap exceptions ghci -ifeq "$(Windows_Host)" "NO" -PACKAGES_STAGE0 += terminfo -endif - -PACKAGES_STAGE1 += ghc-prim -PACKAGES_STAGE1 += ghc-bignum -PACKAGES_STAGE1 += base -PACKAGES_STAGE1 += filepath -PACKAGES_STAGE1 += array -PACKAGES_STAGE1 += deepseq -PACKAGES_STAGE1 += pretty -PACKAGES_STAGE1 += ghc-boot-th -PACKAGES_STAGE1 += template-haskell -PACKAGES_STAGE1 += bytestring -PACKAGES_STAGE1 += containers/containers - -ifeq "$(Windows_Target)" "YES" -PACKAGES_STAGE1 += Win32 -endif -PACKAGES_STAGE1 += time -ifeq "$(Windows_Target)" "NO" -PACKAGES_STAGE1 += unix -endif - -PACKAGES_STAGE1 += directory -PACKAGES_STAGE1 += process -PACKAGES_STAGE1 += hpc -PACKAGES_STAGE1 += binary -PACKAGES_STAGE1 += transformers -PACKAGES_STAGE1 += mtl -PACKAGES_STAGE1 += ghc-boot -PACKAGES_STAGE1 += text -PACKAGES_STAGE1 += parsec -PACKAGES_STAGE1 += Cabal/Cabal-syntax -PACKAGES_STAGE1 += Cabal/Cabal -PACKAGES_STAGE1 += ghc-compact -PACKAGES_STAGE1 += ghc-heap -PACKAGES_STAGE1 += integer-gmp # compat library - -ifeq "$(HADDOCK_DOCS)" "YES" -PACKAGES_STAGE1 += xhtml -endif - -ifeq "$(WITH_TERMINFO)" "YES" -PACKAGES_STAGE1 += terminfo -else -libraries/haskeline_CONFIGURE_OPTS += --flags=-terminfo -endif - -# ghc-cabal doesn't currently support packages containing both libraries -# and executables. This flag disables the latter. -libraries/haskeline_CONFIGURE_OPTS += --flags=-examples - -# Disable text's dependency on simdutf due to packaging considerations -# described in #20724. -libraries/text_CONFIGURE_OPTS += --flags=-simdutf - -# Filepath is vendored for template-haskell to avoid making it non-resinstallable. -# see #21738 -libraries/template-haskell_CONFIGURE_OPTS += --flags=+vendor-filepath - -libraries/ghc-bignum_CONFIGURE_OPTS += -f $(BIGNUM_BACKEND) - -ifeq "$(BIGNUM_BACKEND)" "gmp" -GMP_ENABLED = YES -libraries/ghc-bignum_CONFIGURE_OPTS += --configure-option="--with-gmp" -else -GMP_ENABLED = NO -endif - -PACKAGES_STAGE1 += stm -PACKAGES_STAGE1 += exceptions -PACKAGES_STAGE1 += haskeline -PACKAGES_STAGE1 += ghci -PACKAGES_STAGE1 += libiserv - -# See Note [No stage2 packages when CrossCompiling or Stage1Only]. -# See Note [Stage1Only vs stage=1] in mk/config.mk.in. -ifeq "$(CrossCompiling) $(Stage1Only)" "NO NO" -define addExtraPackage -ifeq "$2" "-" -# Do nothing; this package is already handled above -else ifeq "$2" "extra" -ifeq "$$(BUILD_EXTRA_PKGS)" "YES" -PACKAGES_STAGE2 += $1 -endif -else -$$(error Unknown package tag: $2) -endif -endef -$(eval $(call foreachLibrary,addExtraPackage)) -endif - -# We install all packages that we build. -INSTALL_PACKAGES := $(addprefix libraries/,$(PACKAGES_STAGE1)) -# See Note [Stage1Only vs stage=1] in mk/config.mk.in. -ifneq "$(Stage1Only)" "YES" -INSTALL_PACKAGES += compiler -endif -INSTALL_PACKAGES += $(addprefix libraries/,$(PACKAGES_STAGE2)) - -endif # CLEANING - -# Note [Dependencies between package-data.mk files] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# We cannot run ghc-cabal to configure a package until we have -# configured and registered all of its dependencies. So the following -# hack forces all the configure steps to happen in exactly the following order: -# -# $(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 -# generated the package-data.mk files. -define fixed_pkg_dep -libraries/$1/$2/package-data.mk : $$(fixed_pkg_prev) -fixed_pkg_prev:=libraries/$1/$2/package-data.mk -endef - -ifneq "$(BINDIST)" "YES" -fixed_pkg_prev= -$(foreach pkg,$(PACKAGES_STAGE1),$(eval $(call fixed_pkg_dep,$(pkg),dist-install))) - -# Intermezzo: utils that we build with the stage1 compiler. They depend on -# the stage1 packages, so we have to make sure those packages get configured -# and registered before we can start with these. Note that they don't depend on -# eachother, so we can configure them in parallel. -utils/ghc-cabal/dist-install/package-data.mk: $(fixed_pkg_prev) -utils/hpc/dist-install/package-data.mk: $(fixed_pkg_prev) -utils/ghc-pkg/dist-install/package-data.mk: $(fixed_pkg_prev) -utils/hsc2hs/dist-install/package-data.mk: $(fixed_pkg_prev) -utils/compare_sizes/dist-install/package-data.mk: $(fixed_pkg_prev) -utils/runghc/dist-install/package-data.mk: $(fixed_pkg_prev) -utils/iserv/stage2/package-data.mk: $(fixed_pkg_prev) -utils/iserv/stage2_p/package-data.mk: $(fixed_pkg_prev) -utils/iserv/stage2_dyn/package-data.mk: $(fixed_pkg_prev) -ifeq "$(Windows_Host)" "YES" -utils/gen-dll/dist-install/package-data.mk: $(fixed_pkg_prev) -endif -linters/linters-common/dist-install/package-data.mk: $(fixed_pkg_prev) -linters/lint-notes/dist-install/package-data.mk: $(fixed_pkg_prev) linters/linters-common/dist-install/package-data.mk -linters/lint-whitespace/dist-install/package-data.mk: $(fixed_pkg_prev) linters/linters-common/dist-install/package-data.mk - -# the GHC package doesn't live in libraries/, so we add its dependency manually: -compiler/stage2/package-data.mk: $(fixed_pkg_prev) - -# and continue with PACKAGES_STAGE2, which depend on GHC: -fixed_pkg_prev:=compiler/stage2/package-data.mk -$(foreach pkg,$(PACKAGES_STAGE2),$(eval $(call fixed_pkg_dep,$(pkg),dist-install))) - -ghc/stage1/package-data.mk: compiler/stage1/package-data.mk -ghc/stage2/package-data.mk: compiler/stage2/package-data.mk - -# Utils that we build with the stage2 compiler. -# They depend on the ghc library and some other libraries, but depending on -# the ghc library's package-data.mk is sufficient, as that in turn depends on -# all the other libraries' package-data.mk files. -utils/haddock/dist/package-data.mk: compiler/stage2/package-data.mk -utils/check-ppr/dist-install/package-data.mk: compiler/stage2/package-data.mk -utils/check-exact/dist-install/package-data.mk: compiler/stage2/package-data.mk -utils/count-deps/dist-install/package-data.mk: compiler/stage2/package-data.mk - -# ensure that system-cxx-std-lib is installed in the inplace compiler by -# injecting a dependency from ghc-prim -libraries/ghc-prim/dist-install/package-data.mk : inplace/lib/package.conf.d/system-cxx-std-lib-1.0.conf - -# add the final package.conf dependency: ghc-prim depends on RTS -libraries/ghc-prim/dist-install/package-data.mk : rts/dist-install/package.conf.inplace -endif - -# -------------------------------- -# Misc package-related settings - -# Run Haddock for the packages that will be installed. We need to handle -# compiler specially due to the different dist directory name. -$(foreach p,$(INSTALL_PACKAGES),$(eval $p_dist-install_DO_HADDOCK = YES)) -compiler_stage2_DO_HADDOCK = YES - -BOOT_PKG_CONSTRAINTS := \ - $(foreach d,$(PACKAGES_STAGE0),\ - $(foreach p,$(basename $(notdir $(wildcard libraries/$d/*.cabal))),\ - --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. -$(foreach way,$(GhcLibWays),$(eval ALL_STAGE1_$(way)_LIBS = $$(foreach lib,$$(PACKAGES_STAGE1),$$(libraries/$$(lib)_dist-install_$(way)_LIB)))) - -ALL_STAGE1_LIBS = $(ALL_STAGE1_v_LIBS) - -ifeq "$(BuildSharedLibs)" "YES" -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)) - -# Only build internal interpreter support for the stage2 ghci lib -libraries/ghci_dist-install_CONFIGURE_OPTS += --flags=internal-interpreter - -# ---------------------------------------- -# Special magic for the ghc-prim package - -# We want the ghc-prim package to include the GHC.Prim module when it -# is registered, but not when it is built, because GHC.Prim is not a -# real source module, it is built-in to GHC. - -# Strip it out again before building the package: -define libraries/ghc-prim_PACKAGE_MAGIC -libraries/ghc-prim_dist-install_MODULES := $$(filter-out GHC.Prim,$$(libraries/ghc-prim_dist-install_MODULES)) -endef - -PRIMOPS_TXT_STAGE1 = compiler/stage1/build/primops.txt - -libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs : $$(genprimopcode_INPLACE) $(PRIMOPS_TXT_STAGE1) | $$(dir $$@)/. - "$(genprimopcode_INPLACE)" --make-haskell-wrappers < $(PRIMOPS_TXT_STAGE1) >$@ - -# Required so that Haddock documents the primops. -libraries/ghc-prim_dist-install_EXTRA_HADDOCK_SRCS = libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs - -# ----------------------------------------------------------------------------- -# Include build instructions from all subdirs -BUILD_DIRS += utils/mkdirhier -BUILD_DIRS += utils/touchy -BUILD_DIRS += utils/unlit -BUILD_DIRS += utils/hp2ps -BUILD_DIRS += utils/genprimopcode -BUILD_DIRS += driver -BUILD_DIRS += driver/ghci -BUILD_DIRS += driver/ghc -BUILD_DIRS += driver/haddock -BUILD_DIRS += libffi -BUILD_DIRS += utils/deriveConstants -BUILD_DIRS += rts/include -BUILD_DIRS += rts -BUILD_DIRS += bindisttest -BUILD_DIRS += utils/genapply -ifeq "$(Windows_Host)" "YES" -BUILD_DIRS += utils/gen-dll -endif - -# When cleaning, don't add any library packages to BUILD_DIRS. We include -# ghc.mk files for all BUILD_DIRS, but they don't exist until after running -# `./boot`. Running `make clean` before anything else, as well as running -# `make maintainer-clean` twice, should work. -ifneq "$(CLEANING)" "YES" -# These are deliberately in reverse order, so as to ensure that -# there is no need to have them in dependency order. That's important -# because it's tricky to ensure that they are in dependency order when -# cross-compiling, as some packages may only be in PACKAGES_STAGE0 -# or PACKAGES_STAGE1. -BUILD_DIRS += $(patsubst %, libraries/%, $(PACKAGES_STAGE2)) -BUILD_DIRS += $(patsubst %, libraries/%, $(PACKAGES_STAGE1)) -BUILD_DIRS += $(patsubst %, libraries/%, $(filter-out $(PACKAGES_STAGE1),$(PACKAGES_STAGE0))) -endif - -ifeq "$(BIGNUM_BACKEND)" "gmp" -BUILD_DIRS += libraries/ghc-bignum/gmp -endif -BUILD_DIRS += utils/haddock -BUILD_DIRS += utils/haddock/doc -BUILD_DIRS += compiler -BUILD_DIRS += utils/hsc2hs -BUILD_DIRS += utils/ghc-pkg -BUILD_DIRS += utils/testremove -BUILD_DIRS += utils/check-ppr -BUILD_DIRS += utils/check-exact -BUILD_DIRS += utils/count-deps -BUILD_DIRS += utils/ghc-cabal -BUILD_DIRS += utils/hpc -BUILD_DIRS += utils/runghc -BUILD_DIRS += ghc -BUILD_DIRS += docs/users_guide -BUILD_DIRS += utils/compare_sizes -BUILD_DIRS += utils/iserv -BUILD_DIRS += linters/linters-common -BUILD_DIRS += linters/lint-notes -BUILD_DIRS += linters/lint-whitespace - -# ---------------------------------------------- -# Actually include the sub-ghc.mk's - -ifeq "$(CLEANING)" "YES" -# Don't exclude any BUILD_DIRS when cleaning. When you for example build -# haddock once, but later set HADDOCK_DOCS back to NO, then 'make clean' -# should still clean the haddock directory. -else # CLEANING -ifeq "$(BINDIST)" "YES" -BUILD_DIRS := $(filter-out utils/mkdirhier,$(BUILD_DIRS)) -BUILD_DIRS := $(filter-out utils/genprimopcode,$(BUILD_DIRS)) -BUILD_DIRS := $(filter-out bindisttest,$(BUILD_DIRS)) -BUILD_DIRS := $(filter-out utils/genapply,$(BUILD_DIRS)) -endif -ifeq "$(HADDOCK_DOCS)" "NO" -BUILD_DIRS := $(filter-out utils/haddock,$(BUILD_DIRS)) -BUILD_DIRS := $(filter-out utils/haddock/doc,$(BUILD_DIRS)) -endif -ifeq "$(BUILD_SPHINX_HTML) $(BUILD_SPHINX_PDF)" "NO NO" -BUILD_DIRS := $(filter-out docs/users_guide,$(BUILD_DIRS)) -# Don't to build this little utility if we're not building the User's Guide. -endif -ifeq "$(Windows_Host)" "NO" -BUILD_DIRS := $(filter-out utils/touchy,$(BUILD_DIRS)) -endif -ifeq "$(GhcWithInterpreter)" "NO" -# runghc is just GHCi in disguise -BUILD_DIRS := $(filter-out utils/runghc,$(BUILD_DIRS)) -endif -ifneq "$(CrossCompiling) $(Stage1Only)" "NO NO" -# See Note [No stage2 packages when CrossCompiling or Stage1Only]. -# See Note [Stage1Only vs stage=1] in mk/config.mk.in. -BUILD_DIRS := $(filter-out utils/check-ppr,$(BUILD_DIRS)) -BUILD_DIRS := $(filter-out utils/check-exact,$(BUILD_DIRS)) -BUILD_DIRS := $(filter-out utils/count-deps,$(BUILD_DIRS)) -endif -endif # CLEANING - -include $(patsubst %, %/ghc.mk, $(BUILD_DIRS)) - -# A useful pseudo-target (must be after the include above, because it needs -# the value of things like $(libraries/base_dist-install_v_LIB). -.PHONY: stage1_libs -stage1_libs : $(ALL_STAGE1_LIBS) - -# We need this extra dependency when building our own libffi, because -# GHCi.FFI.hs #includes ffi.h -ifneq "$(UseSystemLibFFI)" "YES" -libraries/ghci/dist-install/build/GHCi/FFI.hs : $(libffi_HEADERS) -endif - -# ---------------------------------------------- -# Per-package compiler flags -# -# If you want to add per-package compiler flags, see `mk/warnings.mk`. - -# Add $(GhcLib(Extra)HcOpts) to all package builds -$(foreach pkg,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_HC_OPTS += $$(GhcLibHcOpts))) -$(foreach pkg,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2),$(eval libraries/$(pkg)_dist-install_EXTRA_HC_OPTS += $$(GhcLibExtraHcOpts))) - -# Add $(GhcBootLib(Extra)HcOpts) to all stage0 package builds -$(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_HC_OPTS += $$(GhcBootLibHcOpts))) -$(foreach pkg,$(PACKAGES_STAGE0),$(eval libraries/$(pkg)_dist-boot_EXTRA_HC_OPTS += $$(GhcBootLibExtraHcOpts))) - -# ----------------------------------------------------------------------------- -# Bootstrapping libraries - -# We need to build a few libraries with the installed GHC, since GHC itself -# and some of the tools depend on them: - -ifneq "$(BINDIST)" "YES" - -ifneq "$(BOOTSTRAPPING_CONF)" "" -ifeq "$(wildcard $(BOOTSTRAPPING_CONF))" "" -$(shell "$(GHC_PKG)" init $(BOOTSTRAPPING_CONF)) -endif -endif - -$(eval $(call clean-target,root,bootstrapping_conf,$(BOOTSTRAPPING_CONF))) - -# register the boot packages in strict sequence, because running -# multiple ghc-pkgs in parallel doesn't work (registrations may get -# lost). -fixed_pkg_prev= -$(foreach pkg,$(PACKAGES_STAGE0),$(eval $(call fixed_pkg_dep,$(pkg),dist-boot))) -# ghc-pkg, unlike other utils that we build with the stage0 compiler (TODO: is -# this really true?), depends on several boot packages (e.g. Cabal and -# ghc-boot). They need to be configured before ghc-pkg, so we add a -# dependency between their package-data.mk files. See also Note -# [Dependencies between package-data.mk files]. -utils/ghc-pkg/dist/package-data.mk: $(fixed_pkg_prev) -compiler/stage1/package-data.mk: $(fixed_pkg_prev) -endif - -ifneq "$(BINDIST)" "YES" -# Make sure we have all the GHCi libs by the time we've built -# ghc-stage2. -# -GHCI_LIBS = \ - $(foreach way,$(GhcLibWays),\ - $(foreach lib,$(PACKAGES_STAGE1),\ - $(libraries/$(lib)_dist-install_$(way)_GHCI_LIB)) \ - $(compiler_stage2_$(way)_GHCI_LIB)) - -ifeq "$(UseArchivesForGhci)" "NO" -ghc/stage2/build/tmp/$(ghc_stage2_PROG) : $(GHCI_LIBS) -endif - -ifeq "$(UseArchivesForGhci)" "YES" -GHCI_lib_way = v -else -GHCI_lib_way = GHCI -endif - -# Deps for TH uses in libraries -$(foreach way, $(GhcLibWays),$(eval \ -libraries/vector/dist-install/build/Data/Vector/Fusion/Stream/Monadic.$($(way)_osuf): \ - $(libraries/primitive_dist-install_$(GHCI_lib_way)_LIB) \ - )) -endif - -# ----------------------------------------------- -# Haddock-related bits - -# Build the Haddock contents and index -ifeq "$(HADDOCK_DOCS)" "YES" -libraries/dist-haddock/index.html: $(haddock_INPLACE) $(ALL_HADDOCK_FILES) - cd libraries && sh gen_contents_index --intree -ifeq "$(phase)" "final" -$(eval $(call all-target,library_doc_index,libraries/dist-haddock/index.html)) -endif -INSTALL_LIBRARY_DOCS += libraries/dist-haddock/* -endif - -# ----------------------------------------------------------------------------- -# system-cxx-std-lib - -inplace/lib/package.conf.d/system-cxx-std-lib-1.0.conf : mk/system-cxx-std-lib-1.0.conf $(ghc-pkg_INPLACE) - "$(ghc-pkg_INPLACE)" update --force $< - -# ----------------------------------------------------------------------------- -# Creating a local mingw copy on Windows - -ifeq "$(Windows_Host)" "YES" - -install : install_mingw -.PHONY: install_mingw -install_mingw : $(INPLACE_MINGW) - "$(CP)" -Rp $(INPLACE_MINGW) $(prefix) - -endif # Windows_Host - -# the following is the work around suggested by @carter in #17418 during install -# time. This should help us with code signing issues by removing extended -# attribuets from all files. -ifeq "$(Darwin_Host)" "YES" -XATTR ?= /usr/bin/xattr - -install : install_darwin -.PHONY: install_darwin -install_darwin: - if [ -e "${XATTR}" ]; then "${XATTR}" -c -r .; fi -endif # Darwin_Host - -ifneq "$(BINDIST)" "YES" -$(ghc-prim-$(libraries/ghc-prim_dist-install_VERSION)_HADDOCK_FILE): \ - libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs -endif # BINDIST - -libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs: \ - $(PRIMOPS_TXT_STAGE1) $$(genprimopcode_INPLACE) \ - | $$(dir $$@)/. - "$(genprimopcode_INPLACE)" --make-haskell-source < $< > $@ - -# ----------------------------------------------------------------------------- -# Installation - -install: install_libs install_packages install_libexecs \ - install_bins install_libexec_scripts -ifeq "$(HADDOCK_DOCS)" "YES" -install: install_docs -endif - -define installLibsTo -# $1 = libraries to install -# $2 = directory to install to -# -# The .dll case calls STRIP_CMD explicitly, instead of `install -s`, because -# on Win64, "install -s" calls a strip that doesn't understand 64bit binaries. -# For some reason, this means the DLLs end up non-executable, which means -# executables that use them just segfault. - $(INSTALL_DIR) $2 - for i in $1; do \ - case $$i in \ - *.a) \ - $(INSTALL_DATA) $(INSTALL_OPTS) $$i $2; \ - $(RANLIB_CMD) $2/`basename $$i` ;; \ - *.dll) \ - $(INSTALL_PROGRAM) $(INSTALL_OPTS) $$i $2 ; \ - $(STRIP_CMD) $2/`basename $$i` ;; \ - *.so) \ - $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $2 ;; \ - *.dylib) \ - $(INSTALL_SHLIB) $(INSTALL_OPTS) $$i $2;; \ - *) \ - $(INSTALL_DATA) $(INSTALL_OPTS) $$i $2; \ - esac; \ - done -endef - -install_bins: $(INSTALL_BINS) $(INSTALL_SCRIPTS) - $(INSTALL_DIR) "$(DESTDIR)$(bindir)" -ifneq "$(INSTALL_BINS)" "" - for i in $(INSTALL_BINS); do \ - $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(bindir)" ; \ - done -endif -ifneq "$(INSTALL_SCRIPTS)" "" - for i in $(INSTALL_SCRIPTS); do \ - $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(bindir)" ; \ - done -endif - -install_libs: $(INSTALL_LIBS) - $(call installLibsTo, $(INSTALL_LIBS), "$(DESTDIR)$(ghclibdir)") - -# We rename ghc-stage2, so that the right program name is used in error -# messages etc. But not on windows. -RENAME_LIBEXEC_GHC_STAGE_TO_GHC = YES -ifeq "$(Stage1Only) $(Windows_Host)" "YES YES" -# resulting ghc-stage1 is built to run on windows -RENAME_LIBEXEC_GHC_STAGE_TO_GHC = NO -endif -ifeq "$(Stage1Only) $(Windows_Target)" "NO YES" -# resulting ghc-stage1 is built to run on windows -RENAME_LIBEXEC_GHC_STAGE_TO_GHC = NO -endif - -install_libexecs: $(INSTALL_LIBEXECS) -ifneq "$(INSTALL_LIBEXECS)" "" - $(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)/bin" - for i in $(INSTALL_LIBEXECS); do \ - $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)/bin"; \ - done -ifeq "$(RENAME_LIBEXEC_GHC_STAGE_TO_GHC)" "YES" - "$(MV)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc" -endif -endif - -install_libexec_scripts: $(INSTALL_LIBEXEC_SCRIPTS) -ifneq "$(INSTALL_LIBEXEC_SCRIPTS)" "" - $(INSTALL_DIR) "$(DESTDIR)$(ghclibexecdir)/bin" - for i in $(INSTALL_LIBEXEC_SCRIPTS); do \ - $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(ghclibexecdir)/bin"; \ - done -endif - -install_docs: $(INSTALL_DOCS) - $(INSTALL_DIR) "$(DESTDIR)$(docdir)" -ifneq "$(INSTALL_DOCS)" "" - for i in $(INSTALL_DOCS); do \ - $(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)"; \ - done -endif - $(INSTALL_DIR) "$(DESTDIR)$(docdir)/html" - $(INSTALL_DOC) $(INSTALL_OPTS) docs/index.html "$(DESTDIR)$(docdir)/html" -ifneq "$(INSTALL_LIBRARY_DOCS)" "" - $(INSTALL_DIR) "$(DESTDIR)$(docdir)/html/libraries" - for i in $(INSTALL_LIBRARY_DOCS); do \ - $(INSTALL_DOC) $(INSTALL_OPTS) $$i "$(DESTDIR)$(docdir)/html/libraries/"; \ - done - $(INSTALL_DATA) $(INSTALL_OPTS) libraries/prologue.txt "$(DESTDIR)$(docdir)/html/libraries/" - $(INSTALL_SCRIPT) $(INSTALL_OPTS) libraries/gen_contents_index "$(DESTDIR)$(docdir)/html/libraries/" -endif -ifneq "$(INSTALL_HTML_DOC_DIRS)" "" - for i in $(INSTALL_HTML_DOC_DIRS); do \ - $(CP) -Rp $$i "$(DESTDIR)$(docdir)/html"; \ - done - for i in "$(DESTDIR)$(docdir)/html"/*/.doctrees; do \ - if [ -d "$$i" ]; then \ - rm -r "$$i"; \ - fi \ - done -endif - -INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d - -ifeq "$(BINDIST) $(CrossCompiling)" "NO YES" -# when installing ghc-stage2 we can't run target's -# 'ghc-pkg' and 'ghc-stage2' but those are needed for registration. -INSTALLED_GHC_REAL=$(TOP)/inplace/bin/ghc-stage1 -INSTALLED_GHC_PKG_REAL=$(TOP)/$(ghc-pkg_DIST_BINARY) -else # CrossCompiling -# Install packages in the right order, so that ghc-pkg doesn't complain. -# Also, install ghc-pkg first. -ifeq "$(Windows_Host)" "NO" -INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc -INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc-pkg -else -INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe -INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe -endif -endif # CrossCompiling - -# Set the INSTALL_DISTDIR_p for each package; compiler is special -$(foreach p,$(filter-out compiler,$(INSTALL_PACKAGES)),\ - $(eval INSTALL_DISTDIR_$p = dist-install)) -INSTALL_DISTDIR_compiler = stage2 - -# Now we can do the installation -install_packages: install_libexecs -install_packages: rts/dist-install/package.conf.install mk/system-cxx-std-lib-1.0.conf - $(INSTALL_DIR) "$(DESTDIR)$(topdir)" - $(call removeTrees,"$(INSTALLED_PACKAGE_CONF)") - $(INSTALL_DIR) "$(INSTALLED_PACKAGE_CONF)" - $(INSTALL_DIR) "$(DESTDIR)$(topdir)/rts" - $(call installLibsTo, $(RTS_INSTALL_LIBS), "$(DESTDIR)$(topdir)/rts") - $(foreach p, $(INSTALL_PACKAGES), \ - $(call make-command, \ - "$(ghc-cabal_INPLACE)" copy \ - $p $(INSTALL_DISTDIR_$p) \ - "$(STRIP_CMD)" \ - '$(DESTDIR)' \ - '$(prefix)' \ - '$(ghclibdir)' \ - '$(docdir)/html/libraries' \ - '$(GhcLibWays)')) - "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/dist-install/package.conf.install - "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update mk/system-cxx-std-lib-1.0.conf - $(foreach p, $(INSTALL_PACKAGES), \ - $(call make-command, \ - "$(ghc-cabal_INPLACE)" register \ - $p $(INSTALL_DISTDIR_$p) \ - "$(INSTALLED_GHC_REAL)" \ - "$(INSTALLED_GHC_PKG_REAL)" \ - "$(DESTDIR)$(topdir)" \ - '$(DESTDIR)' \ - '$(prefix)' \ - '$(ghclibdir)' \ - '$(docdir)/html/libraries' \ - $(RelocatableBuild))) -# when we install the packages above, ghc-pkg obeys umask when creating -# the package.conf files, but for everything else we specify the -# permissions. We therefore now fix the permissions of package.cache. -# This means "sudo make install" does the right thing even if it runs -# with an 077 umask. - for f in '$(INSTALLED_PACKAGE_CONF)'/*; do $(CREATE_DATA) "$$f"; done - -# Finally, update package.cache to ensure it's newer than the registration -# files. This avoids #13375. - "$(INSTALLED_GHC_PKG_REAL)" --global-package-db "$(INSTALLED_PACKAGE_CONF)" recache - -# ----------------------------------------------------------------------------- -# Binary distributions - -ifneq "$(CLEANING)" "YES" -# This rule seems to hold some files open on Windows which prevents -# cleaning, perhaps due to the $(wildcard). - -$(eval $(call bindist-list,.,\ - LICENSE \ - README \ - INSTALL \ - configure config.sub config.guess install-sh \ - llvm-targets \ - llvm-passes \ - packages \ - Makefile \ - mk/config.mk.in \ - mk/system-cxx-std-lib-1.0.conf.in \ - $(INPLACE_BIN)/mkdirhier \ - utils/ghc-cabal/dist-install/build/tmp/ghc-cabal \ - $(BINDIST_WRAPPERS) \ - $(BINDIST_LIBS) \ - $(BINDIST_HI) \ - $(BINDIST_EXTRAS) \ - rts/include/Makefile \ - $(includes_dist-install_H_FILES) \ - $(libffi_HEADERS) \ - $(INSTALL_LIBEXECS) \ - $(INSTALL_LIBEXEC_SCRIPTS) \ - $(INSTALL_BINS) \ - $(INSTALL_SCRIPTS) \ - $(INSTALL_MANPAGES) \ - $(INSTALL_DOCS) \ - $(INSTALL_LIBRARY_DOCS) \ - $(addsuffix /*,$(INSTALL_HTML_DOC_DIRS)) \ - docs/index.html \ - $(wildcard compiler/stage2/doc) \ - $(wildcard libraries/*/dist-install/doc/) \ - $(wildcard libraries/*/*/dist-install/doc/) \ - $(filter-out llvm-targets llvm-passes $(includes_SETTINGS),$(INSTALL_LIBS)) \ - $(RTS_INSTALL_LIBS) \ - $(filter-out %/project.mk mk/config.mk %/mk/install.mk,$(MAKEFILE_LIST)) \ - mk/project.mk \ - mk/install.mk.in \ - bindist.mk \ - libraries/gen_contents_index \ - libraries/prologue.txt \ - )) -endif -# mk/project.mk gets an absolute path, so we manually include it in -# the bindist with a relative path - -BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk - -# Note [Persist CrossCompiling in binary distributions] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# The build system uses the CrossCompiling variable to decide whether or not we -# should build various packages that must be built using the compiler. -# Consequently, it is important that we persist its value in the binary -# distribution so we know during `make install` not to go looking for files that -# would have been built for these packages. Failing to do this causes #13325. -# -# See Note [No stage2 packages when CrossCompiling or Stage1Only]. - -unix-binary-dist-prep: $(includes_dist-install_H_FILES_GENERATED) - $(call removeTrees,bindistprep/) - "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR) - set -e; for i in packages LICENSE compiler ghc rts libraries linters utils docs libffi includes driver mk rules Makefile m4 aclocal.m4 config.sub config.guess install-sh llvm-targets llvm-passes 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 "BUILD_SPHINX_HTML = $(BUILD_SPHINX_HTML)" >> $(BIN_DIST_MK) - echo "BUILD_SPHINX_PDF = $(BUILD_SPHINX_PDF)" >> $(BIN_DIST_MK) - echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK) - echo "override ghc-cabal_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" >> $(BIN_DIST_MK) - echo "UseSystemLibFFI = $(UseSystemLibFFI)" >> $(BIN_DIST_MK) -# See Note [Persist CrossCompiling in binary distributions] - echo "CrossCompiling = $(CrossCompiling)" >> $(BIN_DIST_MK) - cd $(BIN_DIST_PREP_DIR) && autoreconf - $(call removeFiles,$(BIN_DIST_PREP_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 - sort bindist-list | uniq > bindist-list.uniq - cd bindistprep && "$(TAR_CMD)" hcf - -T ../bindist-list.uniq | $(TAR_COMP_CMD) -c > ../$(BIN_DIST_PREP_TAR_COMP) - -windows-binary-dist-prep: - $(call removeTrees,bindistprep/) - $(MAKE) prefix=$(TOP)/$(BIN_DIST_PREP_DIR) install - cd bindistprep && "$(TAR_CMD)" cf - $(BIN_DIST_NAME) | $(TAR_COMP_CMD) -c > ../$(BIN_DIST_PREP_TAR_COMP) - -# tryTimes tries to run its third argument multiple times, until it -# succeeds. Don't call it directly; call try10Times instead. -# The first and second argument to tryTimes are lists of values. -# The length of the first argument is the number of times we have -# already tried. The length of the second argument is the number more -# times we will try. -tryTimes = $(if $2, \ - { echo 'Try $(words x $1): $3' ; $3 ; } || \ - $(call tryTimes,x $1,$(wordlist 2,$(words $2),$2),$3), \ - ) - -# Try to run the argument 10 times. If all 10 fail, fail. -try10Times = $(call tryTimes,,x x x x x x x x x x,$1) { echo Failed; false; } - -.PHONY: publish-binary-dist -publish-binary-dist: - $(call try10Times,$(PublishCp) $(BIN_DIST_TAR_COMP) $(PublishLocation)/dist) - -ifeq "$(mingw32_TARGET_OS)" "1" -DOCDIR_TO_PUBLISH = $(BIN_DIST_INST_DIR)/doc -else -DOCDIR_TO_PUBLISH = $(BIN_DIST_INST_DIR)/share/doc/ghc -endif - -.PHONY: publish-docs -publish-docs: - $(call try10Times,$(PublishCp) -r $(DOCDIR_TO_PUBLISH)/* $(PublishLocation)/docs) - -# ----------------------------------------------------------------------------- -# Source distributions - -# Do it like this: -# -# $ ./boot -# $ ./configure -# $ make sdist -# - -# A source dist is built from a (partial) build tree, because we -# require some extra files not contained in a git checkout: the -# output from Happy and Alex, for example. -# -# The steps performed by 'make sdist' are as follows: -# - build those extra files -# - create a complete link-tree of the current build tree in /tmp -# - run 'make distclean' on that tree -# - remove a bunch of other files that we know shouldn't be in the dist - -# -# Directory in which we're going to build the src dist -# -SRC_DIST_ROOT = sdistprep -SRC_DIST_BASE_NAME = ghc-$(ProjectVersion) - -SRC_DIST_GHC_NAME = ghc-$(ProjectVersion)-src -SRC_DIST_GHC_ROOT = $(SRC_DIST_ROOT)/ghc -SRC_DIST_GHC_DIR = $(SRC_DIST_GHC_ROOT)/$(SRC_DIST_BASE_NAME) -SRC_DIST_GHC_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_GHC_NAME).tar.$(TAR_COMP_EXT) - -SRC_DIST_WINDOWS_TARBALLS_NAME = ghc-$(ProjectVersion)-windows-extra-src -SRC_DIST_WINDOWS_TARBALLS_ROOT = $(SRC_DIST_ROOT)/windows-tarballs -SRC_DIST_WINDOWS_TARBALLS_DIR = $(SRC_DIST_WINDOWS_TARBALLS_ROOT)/$(SRC_DIST_BASE_NAME) -SRC_DIST_WINDOWS_TARBALLS_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_WINDOWS_TARBALLS_NAME).tar.$(TAR_COMP_EXT) - -SRC_DIST_TESTSUITE_NAME = ghc-$(ProjectVersion)-testsuite -SRC_DIST_TESTSUITE_ROOT = $(SRC_DIST_ROOT)/testsuite-ghc -SRC_DIST_TESTSUITE_DIR = $(SRC_DIST_TESTSUITE_ROOT)/$(SRC_DIST_BASE_NAME) -SRC_DIST_TESTSUITE_TARBALL = $(SRC_DIST_ROOT)/$(SRC_DIST_TESTSUITE_NAME).tar.$(TAR_COMP_EXT) - -# -# Files to include in source distributions -# -SRC_DIST_GHC_DIRS = bindisttest compiler distrib docs driver ghc hadrian \ - includes libffi libffi-tarballs libraries m4 mk rts rules utils -SRC_DIST_GHC_FILES += \ - GIT_COMMIT_ID HACKING.md INSTALL.md LICENSE MAKEHELP.md Makefile \ - README.md VERSION aclocal.m4 boot config.guess config.sub configure \ - configure.ac ghc.mk install-sh llvm-passes llvm-targets \ - m4/ax_compare_version.m4 packages - -.PHONY: VERSION -VERSION: - @if test -f $@ && test "`cat $@`" = "$(ProjectVersion)"; \ - then echo "$@ needs no update"; \ - else echo "update $@ ($(ProjectVersion))"; echo "$(ProjectVersion)" > $@; fi - -.PHONY: GIT_COMMIT_ID -GIT_COMMIT_ID: - @if test -d .git && test "`git rev-parse HEAD`" != "$(ProjectGitCommitId)"; then \ - echo "******************************************************************************"; \ - echo "Stale ProjectGitCommitId (=$(ProjectGitCommitId)) detected!"; \ - echo "'git rev-parse HEAD' says: `git rev-parse HEAD`"; \ - echo "Please re-run './configure' before creating source-distribution"; \ - echo "******************************************************************************"; \ - exit 1; \ - fi - @if test -f $@ && test "`cat $@`" = "$(ProjectGitCommitId)"; \ - then echo "$@ needs no update"; \ - else echo "update $@ ($(ProjectGitCommitId))"; echo -n "$(ProjectGitCommitId)" > $@; fi - -sdist-ghc-prep-tree : VERSION GIT_COMMIT_ID - -.PHONY: sdist-ghc-prep-tree -sdist-ghc-prep-tree : - $(call removeTrees,$(SRC_DIST_GHC_ROOT)) - $(call removeFiles,$(SRC_DIST_GHC_TARBALL)) - mkdir -p $(SRC_DIST_ROOT) - mkdir -p $(SRC_DIST_GHC_ROOT) - mkdir -p $(SRC_DIST_GHC_DIR) - cd $(SRC_DIST_GHC_DIR) && for i in $(SRC_DIST_GHC_DIRS); do mkdir -p $$i; ( cd $$i && lndir $(TOP)/$$i ); done - cd $(SRC_DIST_GHC_DIR) && for i in $(SRC_DIST_GHC_FILES); do $(LN_S) $(TOP)/$$i .; done - cd $(SRC_DIST_GHC_DIR) && $(MAKE) distclean - $(call removeTrees,$(SRC_DIST_GHC_DIR)/libraries/tarballs/) - $(call removeTrees,$(SRC_DIST_GHC_DIR)/libraries/stamp/) - $(call removeTrees,$(SRC_DIST_GHC_DIR)/hadrian/_build/) - $(call removeTrees,$(SRC_DIST_GHC_DIR)/hadrian/dist-newstyle/) - $(call removeTrees,$(SRC_DIST_GHC_DIR)/compiler/stage[123]) - $(call removeFiles,$(SRC_DIST_GHC_DIR)/mk/build.mk) - $(call removeFiles,$(SRC_DIST_GHC_DIR)/rts/rts.cabal) - cd $(SRC_DIST_GHC_DIR) && "$(FIND)" $(SRC_DIST_GHC_DIRS) \( -name .git -o -name "autom4te*" -o -name "*~" -o -name "\#*" -o -name ".\#*" -o -name "log" -o -name "*-SAVE" -o -name "*.orig" -o -name "*.rej" \) -print | "$(XARGS)" $(XARGS_OPTS) "$(RM)" $(RM_OPTS_REC) - -# Add files generated by alex and happy. -# These rules depend on sdist-ghc-prep-tree. -$(eval $(call sdist-ghc-file,compiler,stage2,.,GHC/Cmm/Lexer,x)) -$(eval $(call sdist-ghc-file,compiler,stage2,.,GHC/Cmm/Parser,y)) -$(eval $(call sdist-ghc-file,compiler,stage2,.,GHC/Parser/Lexer,x)) -$(eval $(call sdist-ghc-file,compiler,stage2,.,GHC/Parser/HaddockLex,x)) -$(eval $(call sdist-ghc-file,compiler,stage2,.,GHC/Parser,y)) -$(eval $(call sdist-ghc-file,utils/hpc,dist-install,,HpcParser,y)) -$(eval $(call sdist-ghc-file,utils/genprimopcode,dist,,Lexer,x)) -$(eval $(call sdist-ghc-file,utils/genprimopcode,dist,,Parser,y)) - -# Recent Cabal library versions have a pre-generated Lexer.hs in the source -# repo, and have moved Lexer.x out of the way, so trying to generate it from -# here no longer works, and is no longer necessary. -# According to https://github.com/haskell/cabal/issues/4633 however, this is -# only a temporary solution, so we will probably have to adjust to whatever -# the proper solution is going to be once there is one. -# -# $(eval $(call sdist-ghc-file2,libraries/Cabal/Cabal,dist-install,Distribution/Parsec,Lexer,x)) - -.PHONY: sdist-ghc-prep -sdist-ghc-prep : sdist-ghc-prep-tree - -.PHONY: sdist-windows-tarballs-prep -sdist-windows-tarballs-prep : - $(call removeTrees,$(SRC_DIST_WINDOWS_TARBALLS_ROOT)) - $(call removeFiles,$(SRC_DIST_WINDOWS_TARBALLS_TARBALL)) - mkdir -p $(SRC_DIST_ROOT) - mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_ROOT) - mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_DIR) - mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs - cd $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs && ln -s $(TOP)/ghc-tarballs/mingw-w64 . - $(call removeTrees,$(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs/.git) - -.PHONY: sdist-testsuite-prep -sdist-testsuite-prep : - $(call removeTrees,$(SRC_DIST_TESTSUITE_ROOT)) - $(call removeFiles,$(SRC_DIST_TESTSUITE_TARBALL)) - mkdir -p $(SRC_DIST_ROOT) - mkdir -p $(SRC_DIST_TESTSUITE_ROOT) - mkdir -p $(SRC_DIST_TESTSUITE_DIR) - mkdir -p $(SRC_DIST_TESTSUITE_DIR)/testsuite - cd $(SRC_DIST_TESTSUITE_DIR)/testsuite && lndir $(TOP)/testsuite - cd $(SRC_DIST_TESTSUITE_DIR)/testsuite && $(MAKE) distclean - -.PHONY: sdist-ghc -sdist-ghc: sdist-ghc-prep - cd $(SRC_DIST_GHC_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> src_ghc_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_GHC_TARBALL) - -.PHONY: sdist-windows-tarballs -sdist-windows-tarballs: sdist-windows-tarballs-prep - cd $(SRC_DIST_WINDOWS_TARBALLS_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> windows_extra_src_ghc_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_WINDOWS_TARBALLS_TARBALL) - -.PHONY: sdist-testsuite -sdist-testsuite: sdist-testsuite-prep - cd $(SRC_DIST_TESTSUITE_ROOT) && "$(TAR_CMD)" chf - $(SRC_DIST_BASE_NAME) 2> testsuite_log | $(TAR_COMP_CMD) -c > $(TOP)/$(SRC_DIST_TESTSUITE_TARBALL) - - -.PHONY: sdist -sdist : sdist-ghc sdist-windows-tarballs sdist-testsuite - -sdist-manifest : $(SRC_DIST_GHC_TARBALL) - tar tjf $(SRC_DIST_GHC_TARBALL) | sed "s|^ghc-$(ProjectVersion)/||" | sort >sdist-manifest - -# Upload the distribution(s) -# Retrying is to work around buggy firewalls that corrupt large file transfers -# over SSH. -ifneq "$(PublishLocation)" "" -publish-sdist : - $(call try10Times,$(PublishCp) $(SRC_DIST_GHC_TARBALL) $(PublishLocation)/dist) - $(call try10Times,$(PublishCp) $(SRC_DIST_TESTSUITE_TARBALL) $(PublishLocation)/dist) -endif - -# ----------------------------------------------------------------------------- -# sdisting libraries - -# Use manually, with e.g.: -# make sdist_directory - -sdist_%: - inplace/bin/ghc-cabal sdist libraries/$* dist-install - -# ----------------------------------------------------------------------------- -# Cleaning - -.PHONY: clean - -CLEAN_FILES += libraries/ghc-bignum/include/ghc-gmp.h -CLEAN_FILES += libraries/ghc-bignum/include/HsIntegerGmp.h -CLEAN_FILES += libraries/base/include/EventConfig.h -CLEAN_FILES += mk/config.mk.old -CLEAN_FILES += mk/project.mk.old -CLEAN_FILES += compiler/ghc.cabal.old - -$(foreach h,$(includes_dist-install_H_FILES_GENERATED), \ - $(eval CLEAN_FILES += $h)) -CLEAN_FILES += $(includes_SETTINGS) -CLEAN_FILES += utils/ghc-pkg/Version.hs -CLEAN_FILES += compiler/GHC/Builtin/primops.txt -CLEAN_FILES += $(wildcard compiler/primop*incl) - -clean : clean_files clean_libraries - -.PHONY: clean_files -clean_files : - $(call removeFiles,$(CLEAN_FILES)) -# this is here since CLEAN_FILES can't handle folders - $(call removeTrees,inplace/bin) - $(call removeTrees,inplace/lib) - $(call removeTrees,libraries/bootstrapping.conf) -# Clean the files that ./validate creates. - $(call removeFiles,mk/are-validating.mk) - -.PHONY: clean_libraries -clean_libraries: $(patsubst %,clean_libraries/%_dist-install,$(PACKAGES_STAGE1) $(PACKAGES_STAGE2)) -clean_libraries: $(patsubst %,clean_libraries/%_dist-boot,$(PACKAGES_STAGE0)) - -clean_libraries: - $(call removeTrees,$(patsubst %, libraries/%/dist, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))) - $(call removeFiles,$(wildcard $(patsubst %.in, %, $(wildcard $(patsubst %, libraries/%/*.buildinfo.in, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)))))) - $(call removeFiles,$(patsubst %, libraries/%/config.log, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))) - $(call removeFiles,$(patsubst %, libraries/%/config.status, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))) - $(call removeFiles,$(wildcard $(patsubst %, libraries/%/include/Hs*Config.h, $(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_STAGE1) $(PACKAGES_STAGE2),\ - $(eval $(call clean-target,libraries/$(lib),dist-install,libraries/$(lib)/dist-install))) -endif - -clean : clean_haddock_index -.PHONY: clean_haddock_index -clean_haddock_index: - $(call removeTrees,libraries/dist-haddock) - -clean : clean_bindistprep -.PHONY: clean_bindistprep -clean_bindistprep: - $(call removeTrees,bindistprep/) - -distclean : clean -# Clean the files that we ask ./configure to create. - $(call removeFiles,mk/config.mk) - $(call removeFiles,mk/install.mk) - $(call removeFiles,mk/project.mk) - $(call removeFiles,compiler/ghc.cabal) - $(call removeFiles,ghc/ghc-bin.cabal) - $(call removeFiles,libraries/ghci/ghci.cabal) - $(call removeFiles,utils/runghc/runghc.cabal) - $(call removeFiles,utils/gen-dll/gen-dll.cabal) - $(call removeFiles,settings) - $(call removeFiles,docs/users_guide/ug-book.xml) - $(call removeFiles,docs/users_guide/ug-ent.xml) - $(call removeFiles,docs/users_guide/ghc_config.py) - $(call removeFiles,libraries/prologue.txt) - $(call removeFiles,distrib/configure.ac) - $(call removeFiles,ch01.html ch02.html index.html) - -# ./configure also makes these. - $(call removeFiles,mk/config.h) - -# Internal files generated by ./configure for itself. - $(call removeFiles,config.cache config.status config.log) - -# The root Makefile makes .old versions of some files that configure -# generates, so we clean those too. - $(call removeFiles,mk/config.mk.old) - $(call removeFiles,mk/project.mk.old) - $(call removeFiles,compiler/ghc.cabal.old) - -# Clean the *Config.h files generated by library configure scripts - $(call removeFiles,libraries/base/include/HsBaseConfig.h) - $(call removeFiles,libraries/base/include/EventConfig.h) - $(call removeFiles,libraries/directory/include/HsDirectoryConfig.h) - $(call removeFiles,libraries/process/include/HsProcessConfig.h) - $(call removeFiles,libraries/unix/include/HsUnixConfig.h) - $(call removeFiles,libraries/time/lib/include/HsTimeConfig.h) - -# The library configure scripts also like creating autom4te.cache -# directories, so clean them all up. - $(call removeTrees,$(patsubst %, libraries/%/autom4te.cache, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))) - -# We make these when making or testing bindists - $(call removeFiles,bindist-list) - $(call removeFiles,bindist-list.uniq) - $(call removeTrees,bindisttest/a) - -# Also clean Windows-only inplace directories. -# Don't delete 'inplace' itself, it contains source files. - $(call removeTrees,inplace/mingw) - -# Remove the download tarballs. This is because updating -# the tarballs doesn't remove old ones. After a tarbal is updated -# you end up with both in your tree and get a franken build. -# The downside here is that a maintainer clean will trigger more -# bandwidth usage from haskell.org - $(call removeTrees,ghc-tarballs) - -# Remove the fs utilities. - $(call removeFiles,utils/lndir/fs.h) - $(call removeFiles,utils/lndir/fs.c) - $(call removeFiles,utils/unlit/fs.h) - $(call removeFiles,utils/unlit/fs.c) - $(call removeFiles,rts/fs.h) - $(call removeFiles,rts/fs.c) - $(call removeFiles,libraries/base/include/fs.h) - $(call removeFiles,libraries/base/cbits/fs.c) - -CLEAN_LIBRARY_GHC_MK_FILES += $(patsubst %, libraries/%/ghc.mk, $(PACKAGES_STAGE1) $(PACKAGES_STAGE2)) -# Don't clean `libraries/ghc-boot/ghc.mk`, since it's intended to be version-controlled (#16953) -CLEAN_LIBRARY_GHC_MK_FILES := $(filter-out libraries/ghc-boot/ghc.mk,$(CLEAN_LIBRARY_GHC_MK_FILES)) - -maintainer-clean : distclean - $(call removeFiles,configure mk/config.h.in) - $(call removeTrees,autom4te.cache $(wildcard libraries/*/autom4te.cache)) - $(call removeFiles,$(patsubst %, libraries/%/GNUmakefile, \ - $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))) - $(call removeFiles,$(CLEAN_LIBRARY_GHC_MK_FILES)) - $(call removeFiles,$(patsubst %, libraries/%/configure, \ - $(PACKAGES_STAGE1) $(PACKAGES_STAGE2))) - $(call removeFiles,libraries/base/include/HsBaseConfig.h.in) - $(call removeFiles,libraries/directory/include/HsDirectoryConfig.h.in) - $(call removeFiles,libraries/process/include/HsProcessConfig.h.in) - $(call removeFiles,libraries/unix/include/HsUnixConfig.h.in) - $(call removeFiles,libraries/time/lib/include/HsTimeConfig.h.in) - -.PHONY: all_libraries - -.PHONY: bootstrapping-files -# See https://gitlab.haskell.org/ghc/ghc/wikis/building/porting -bootstrapping-files: $(includes_DERIVEDCONSTANTS) -bootstrapping-files: $(libffi_HEADERS) - -.DELETE_ON_ERROR: - -# ----------------------------------------------------------------------------- - -ifeq "$(HADDOCK_DOCS)" "YES" -BINDIST_HADDOCK_FLAG = --with-haddock="$(BINDIST_PREFIX)/bin/haddock" -endif -ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES" -BINDIST_LIBRARY_FLAGS = --enable-shared --disable-library-vanilla -else -BINDIST_LIBRARY_FLAGS = --enable-library-vanilla --disable-shared -endif -BINDIST_LIBRARY_FLAGS += --disable-library-prof - -.PHONY: validate_build_xhtml -validate_build_xhtml: - cd libraries/xhtml && "$(BINDIST_PREFIX)/bin/ghc" --make Setup - cd libraries/xhtml && ./Setup configure --with-ghc="$(BINDIST_PREFIX)/bin/ghc" $(BINDIST_HADDOCK_FLAG) $(BINDIST_LIBRARY_FLAGS) --global --builddir=dist-bindist --prefix="$(BINDIST_PREFIX)" - cd libraries/xhtml && ./Setup build --builddir=dist-bindist -ifeq "$(HADDOCK_DOCS)" "YES" - cd libraries/xhtml && ./Setup haddock -v0 --ghc-options=-optP-P --builddir=dist-bindist -endif - cd libraries/xhtml && ./Setup install --builddir=dist-bindist - cd libraries/xhtml && ./Setup clean --builddir=dist-bindist - cd libraries/xhtml && rm -f Setup Setup.exe Setup.hi Setup.o - -# Note [No stage2 packages when CrossCompiling or Stage1Only] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# (first read Note [CrossCompiling vs Stage1Only] and -# Note [Stage1Only vs stage=1] in mk/config.mk.in) -# -# When either CrossCompiling=YES or Stage1Only=YES, we have to exclude the -# following packages from the build: -# * packages that we build with ghc-stage2 [1] -# * packages that depend on the ghc library [2] -# -# Here's why: -# - first of all, ghc-stage1 can't use stage0's ghc library (it's too old) -# - neither do we register the ghc library (compiler/stage1) that we build -# with stage0. TODO Why not? We do build it... -# - as a result, we need to a) use ghc-stage2 to build packages that depend on -# the ghc library and b) exclude those packages when ghc-stage2 is not -# available. -# - when Stage1Only=YES, it's clear that ghc-stage2 is not available (we just -# said we didn't want it), so we have to exclude the stage2 packages from -# the build. This includes the case where Stage1Only=YES is combined with -# CrossCompiling=YES (Building GHC as a cross-compiler [3]). -# - when CrossCompiling=YES, but Stage1Only=NO (Cross-compiling GHC itself -# [3]), we can not use ghc-stage2 either. The reason is that stage2 doesn't -# run on the host platform at all; it is built to run on $(TARGETPLATFORM)" -# [4]. Therefore in this case we also have to exclude the stage2 packages -# from the build. -# -# Because we omit certain packages from the build when CrossCompiling=YES, -# it is important that we remember the value of CrossCompiling in binary -# distributions that we produce. See Note [Persist CrossCompiling in binary -# distributions]. -# -# [1] find utils -name ghc.mk | xargs grep -l 'build-prog.*,2' -# -# [2] -# find utils -name package-data.mk | xargs grep -l 'DEP_NAMES =.* ghc\($\| \)' -# -# [3] https://gitlab.haskell.org/ghc/ghc/wikis/building/cross-compiling -# -# [4] * bc31dbe8ee22819054df60f5ef219fed393a1c54 -# "Disable any packages built with stage 2 when cross-compiling -# Since we can't run stage 2 on the host." -# -# * 72995160b0b190577b5c0cb8d7bd0426cc455b05 -# "We cannot use the stage 2 compiler, it runs on $(TARGETPLATFORM)" - -# ----------------------------------------------------------------------------- -# Numbered phase targets - -# In phase 1, we'll be building dependency files for most things -# built by the bootstrapping compiler while make is 'include'ing -# makefiles. But in order to build dependency files, we'll need to -# build any automatically generated .hs files, which means that -# we'll need to be able to build any tools that generate .hs files -# etc. But in order to do that, we need to already know the -# dependencies for those tools, so we build their dependency files -# here. -.PHONY: phase_0_builds -# hsc2hs is needed, e.g. to make the .hs files for hpc. -phase_0_builds: $(utils/hsc2hs_dist_depfile_haskell) -phase_0_builds: $(utils/hsc2hs_dist_depfile_c_asm) -# genprimopcode is needed to make the .hs-incl files that are in the -# ghc package. -phase_0_builds: $(utils/genprimopcode_dist_depfile_haskell) -phase_0_builds: $(utils/genprimopcode_dist_depfile_c_asm) -# deriveConstants is used to create header files included in the -# ghc-boot package. -phase_0_builds: $(utils/deriveConstants_dist_depfile_haskell) -phase_0_builds: $(utils/deriveConstants_dist_depfile_c_asm) - -.PHONY: phase_1_builds -phase_1_builds: $(PACKAGE_DATA_MKS) diff --git a/ghc/ghc.mk b/ghc/ghc.mk deleted file mode 100644 index db5efbec96..0000000000 --- a/ghc/ghc.mk +++ /dev/null @@ -1,179 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009-2012 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -ghc_USES_CABAL = YES -ghc_PACKAGE = ghc-bin -ghc_EXECUTABLE = ghc - -ghc_stage1_CONFIGURE_OPTS += --flags=stage1 -ghc_stage2_CONFIGURE_OPTS += --flags=stage2 -ghc_stage3_CONFIGURE_OPTS += --flags=stage3 - -ifeq "$(GhcWithInterpreter)" "YES" -ghc_stage2_CONFIGURE_OPTS += --flags=internal-interpreter -ghc_stage3_CONFIGURE_OPTS += --flags=internal-interpreter -endif - -ghc_stage1_MORE_HC_OPTS = $(GhcStage1HcOpts) -ghc_stage2_MORE_HC_OPTS = $(GhcStage2HcOpts) -ghc_stage3_MORE_HC_OPTS = $(GhcStage3HcOpts) - -# We need __GLASGOW_HASKELL__ in hschooks.c, so we have to build C -# sources with GHC: -ghc_stage1_UseGhcForCC = YES -ghc_stage2_UseGhcForCC = YES -ghc_stage3_UseGhcForCC = YES - -ifeq "$(GhcDebugged)" "YES" -ghc_stage1_MORE_HC_OPTS += -debug -ghc_stage2_MORE_HC_OPTS += -debug -ghc_stage3_MORE_HC_OPTS += -debug -endif - -ifneq "$(GhcDynamic)" "" -$(error GhcDynamic is no longer supported, use DYNAMIC_GHC_PROGRAMS instead) -endif - -ifeq "$(GhcThreaded)" "YES" -# Use threaded RTS with GHCi, so threads don't get blocked at the prompt. -ghc_stage2_MORE_HC_OPTS += -threaded -ghc_stage3_MORE_HC_OPTS += -threaded -else -# Opt out from threaded GHC. See ghc-bin.cabal.in -ghc_stage2_CONFIGURE_OPTS += -f-threaded -ghc_stage3_CONFIGURE_OPTS += -f-threaded -endif - -# If stage 0 supplies a threaded RTS, we can use it for stage 1. -# See Note [Linking ghc-bin against threaded stage0 RTS] in -# hadrian/src/Settings/Packages.hs for details. -ifeq "$(GhcThreadedRts)" "YES" -ghc_stage1_MORE_HC_OPTS += -threaded -else -ghc_stage1_CONFIGURE_OPTS += -f-threaded -endif - -ifeq "$(GhcProfiled)" "YES" -ghc_stage2_PROGRAM_WAY = p -endif - -ghc_stage1_PROGNAME = ghc-stage1 -ghc_stage2_PROGNAME = ghc-stage2 -ghc_stage3_PROGNAME = ghc-stage3 - -ghc_stage1_SHELL_WRAPPER = YES -ghc_stage2_SHELL_WRAPPER = YES -ghc_stage3_SHELL_WRAPPER = YES -ghc_stage1_SHELL_WRAPPER_NAME = ghc/ghc.wrapper -ghc_stage2_SHELL_WRAPPER_NAME = ghc/ghc.wrapper -ghc_stage3_SHELL_WRAPPER_NAME = ghc/ghc.wrapper -ghc_stage1_INSTALL_INPLACE = YES -ghc_stage2_INSTALL_INPLACE = YES -ghc_stage3_INSTALL_INPLACE = YES - -ghc_stage$(INSTALL_GHC_STAGE)_INSTALL = YES -ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME = ghc-$(ProjectVersion) - -# We override the program name to be ghc, rather than ghc-stage2. -# This means the right program name is used in error messages etc. -define ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_EXTRA -echo 'executablename="$$exedir/ghc"' >> "$(WRAPPER)" -endef - -# if stage is set to something other than "1" or "", disable stage 1 -# See Note [Stage1Only vs stage=1] in mk/config.mk.in. -ifneq "$(filter-out 1,$(stage))" "" -ghc_stage1_NOT_NEEDED = YES -endif -# if stage is set to something other than "2" or "", disable stage 2 -ifneq "$(filter-out 2,$(stage))" "" -ghc_stage2_NOT_NEEDED = YES -endif -# When cross-compiling, the stage 1 compiler is our release compiler, so omit stage 2 -# See Note [Stage1Only vs stage=1] in mk/config.mk.in. -ifeq "$(Stage1Only)" "YES" -ghc_stage2_NOT_NEEDED = YES -endif -# stage 3 has to be requested explicitly with stage=3 -ifneq "$(stage)" "3" -ghc_stage3_NOT_NEEDED = YES -endif -$(eval $(call build-prog,ghc,stage1,0)) -$(eval $(call build-prog,ghc,stage2,1)) -$(eval $(call build-prog,ghc,stage3,2)) - -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_STAGE1),$(libraries/$(lib)_dist-install_p_LIB)) -endif - -all_ghc_stage1 : $(GHC_STAGE1) -all_ghc_stage2 : $(GHC_STAGE2) -all_ghc_stage3 : $(GHC_STAGE3) - -$(INPLACE_LIB)/settings : $(includes_SETTINGS) - "$(CP)" $< $@ - -$(INPLACE_LIB)/llvm-targets : llvm-targets - "$(CP)" $< $@ - -$(INPLACE_LIB)/llvm-passes : llvm-passes - "$(CP)" $< $@ - -# The GHC programs need to depend on all the helper programs they might call, -# and the settings files they use - -GHC_DEPENDENCIES += $$(unlit_INPLACE) -GHC_DEPENDENCIES += $(INPLACE_LIB)/settings -GHC_DEPENDENCIES += $(INPLACE_LIB)/llvm-targets -GHC_DEPENDENCIES += $(INPLACE_LIB)/llvm-passes - -$(GHC_STAGE1) : | $(GHC_DEPENDENCIES) -$(GHC_STAGE2) : | $(GHC_DEPENDENCIES) -$(GHC_STAGE3) : | $(GHC_DEPENDENCIES) - -ifeq "$(Windows_Host)" "YES" -$(GHC_STAGE1) : | $$(touchy_INPLACE) -$(GHC_STAGE2) : | $$(touchy_INPLACE) -$(GHC_STAGE3) : | $$(touchy_INPLACE) -endif - -# Modules like vector:Data.Vector.Fusion.Stream.Monadic use annotations, -# which means they depend on GHC.Desugar. To ensure that This module is -# available by the time it is needed, we make the stage 2 compiler -# depend on it. -$(GHC_STAGE2) : $(foreach w,$(GhcLibWays),libraries/base/dist-install/build/GHC/Desugar.$($w_osuf)) - -endif - -INSTALL_LIBS += $(includes_SETTINGS) -INSTALL_LIBS += llvm-targets -INSTALL_LIBS += llvm-passes - -ifeq "$(Windows_Host)" "NO" -install: install_ghc_link -.PHONY: install_ghc_link -install_ghc_link: - $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc") - $(LN_S) $(CrossCompilePrefix)ghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc" -else -# On Windows we install the main binary as $(bindir)/ghc.exe -# To get ghc-.exe we have a little C program in driver/ghc -install: install_ghc_post -.PHONY: install_ghc_post -install_ghc_post: install_bins - $(call removeFiles,"$(DESTDIR)$(bindir)/ghc.exe") - "$(MV)" -f $(DESTDIR)$(bindir)/ghc-stage$(INSTALL_GHC_STAGE).exe $(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc.exe -endif diff --git a/libffi/ghc.mk b/libffi/ghc.mk deleted file mode 100644 index c82cb783e3..0000000000 --- a/libffi/ghc.mk +++ /dev/null @@ -1,132 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -libffi_STAMP_STATIC_CONFIGURE = libffi/stamp.ffi.static.configure -libffi_STAMP_STATIC_BUILD = libffi/stamp.ffi.static.build -libffi_STAMP_STATIC_INSTALL = libffi/stamp.ffi.static.install - -libffi_STAMP_STATIC_SHARED_CONFIGURE = libffi/stamp.ffi.static-shared.configure -libffi_STAMP_STATIC_SHARED_BUILD = libffi/stamp.ffi.static-shared.build -libffi_STAMP_STATIC_SHARED_INSTALL = libffi/stamp.ffi.static-shared.install - -ifeq "$(BuildSharedLibs)" "YES" -libffi_STAMP_CONFIGURE = $(libffi_STAMP_STATIC_SHARED_CONFIGURE) -libffi_STAMP_BUILD = $(libffi_STAMP_STATIC_SHARED_BUILD) -libffi_STAMP_INSTALL = $(libffi_STAMP_STATIC_SHARED_INSTALL) -libffi_EnableShared = yes -else -libffi_STAMP_CONFIGURE = $(libffi_STAMP_STATIC_CONFIGURE) -libffi_STAMP_BUILD = $(libffi_STAMP_STATIC_BUILD) -libffi_STAMP_INSTALL = $(libffi_STAMP_STATIC_INSTALL) -libffi_EnableShared = no -endif - -libffi_STATIC_LIB = libffi/build/inst/lib/libffi.a -libffi_HEADERS = rts/dist-install/build/include/ffi.h \ - rts/dist-install/build/include/ffitarget.h - -ifeq "$(HostOS_CPP)" "mingw32" -LIBFFI_NAME = ffi-6 -else -LIBFFI_NAME = ffi -endif -LIBFFI_DLL = lib$(LIBFFI_NAME).dll - -ifneq "$(BINDIST)" "YES" -$(libffi_STAMP_CONFIGURE): $(TOUCH_DEP) - $(call removeFiles,$(libffi_STAMP_STATIC_CONFIGURE)) - $(call removeFiles,$(libffi_STAMP_STATIC_BUILD)) - $(call removeFiles,$(libffi_STAMP_STATIC_INSTALL)) - $(call removeFiles,$(libffi_STAMP_STATIC_SHARED_CONFIGURE)) - $(call removeFiles,$(libffi_STAMP_STATIC_SHARED_BUILD)) - $(call removeFiles,$(libffi_STAMP_STATIC_SHARED_INSTALL)) - $(call removeTrees,$(LIBFFI_DIR) libffi/build) - cat libffi-tarballs/libffi*.tar.gz | $(GZIP_CMD) -d | { cd libffi && $(TAR_CMD) -xf - ; } - mv libffi/libffi-* libffi/build - -# update config.guess/config.sub - $(CP) "$(TOP)/config.guess" libffi/build/config.guess - $(CP) "$(TOP)/config.sub" libffi/build/config.sub - -# We have to fake a non-working ln for configure, so that the fallback -# option (cp -p) gets used instead. Otherwise the libffi build system -# will use cygwin symbolic links which cannot be read by mingw gcc. - chmod +x libffi/ln - - # We need to use -MMD rather than -MD, as otherwise we get paths - # like c:/... in the dependency files on Windows, and the extra - # colons break make - mv libffi/build/Makefile.in libffi/build/Makefile.in.orig - sed "s/-MD/-MMD/" < libffi/build/Makefile.in.orig > libffi/build/Makefile.in - - # We attempt to specify the installation directory below with --libdir, - # but libffi installs into 'toolexeclibdir' instead, which may differ - # on systems where gcc has multilib support. Force libffi to use libdir. - # (https://sourceware.org/ml/libffi-discuss/2014/msg00016.html) - mv libffi/build/Makefile.in libffi/build/Makefile.in.orig - sed 's:@toolexeclibdir@:$$(libdir):g' < libffi/build/Makefile.in.orig > libffi/build/Makefile.in - - # install-sh is used when /usr/bin/install is missing; ensure its - # path in libffi's Makefile is correct. See GHC #11109. - mv libffi/build/Makefile.in libffi/build/Makefile.in.orig - sed 's|@INSTALL@|$$(subst ../install-sh,$(TOP)/install-sh,@INSTALL@)|g' < libffi/build/Makefile.in.orig > libffi/build/Makefile.in - -# * Because -Werror may be in SRC_CC_OPTS/SRC_LD_OPTS, we need to turn -# warnings off or the compilation of libffi might fail due to warnings; -# hence the -w flags. -# * We specify --libdir, as we need to know the path to libffi.a, but on -# some platforms it defaults to .../lib64/ rather than .../lib/. - cd libffi && \ - cd build && \ - CC=$(CC_STAGE1) \ - CXX=$(CC_STAGE1) \ - LD=$(LD) \ - AR=$(AR_STAGE1) \ - NM=$(NM) \ - RANLIB=$(REAL_RANLIB_CMD) \ - CFLAGS="$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE1) -w" \ - LDFLAGS="$(SRC_LD_OPTS) -w" \ - "$(SHELL)" ./configure \ - --prefix=$(TOP)/libffi/build/inst \ - --libdir=$(TOP)/libffi/build/inst/lib \ - --disable-docs \ - --enable-static=yes \ - --enable-shared=$(libffi_EnableShared) \ - --host=$(TargetPlatformFull) - - # wc on OS X has spaces in its output, which libffi's Makefile - # doesn't expect, so we tweak it to sed them out - mv libffi/build/Makefile libffi/build/Makefile.orig - sed "s#wc -w#wc -w | sed 's/ //g'#" < libffi/build/Makefile.orig > libffi/build/Makefile - - "$(TOUCH_CMD)" $@ - -$(libffi_STAMP_BUILD): $(libffi_STAMP_CONFIGURE) $(TOUCH_DEP) - # Use 'sync' as a temporary solution for #11960 (parallelisation bug). - sync; $(MAKE) -C libffi/build MAKEFLAGS= - "$(TOUCH_CMD)" $@ - -$(libffi_STAMP_INSTALL): $(libffi_STAMP_BUILD) $(TOUCH_DEP) - $(MAKE) -C libffi/build MAKEFLAGS= install - "$(TOUCH_CMD)" $@ - -$(libffi_STATIC_LIB): $(libffi_STAMP_INSTALL) - @test -f $@ || { echo "$< exists, but $@ does not."; echo "Suggest removing $<."; exit 1; } - -$(libffi_HEADERS): $(libffi_STAMP_INSTALL) | $$(dir $$@)/. - cp -f libffi/build/inst/include/$(notdir $@) $@ - -$(eval $(call clean-target,libffi,, \ - libffi/build $(wildcard libffi/stamp.ffi.*) libffi/dist-install)) - -endif diff --git a/libraries/ghc-bignum/gmp/ghc.mk b/libraries/ghc-bignum/gmp/ghc.mk deleted file mode 100644 index 9a7ae88577..0000000000 --- a/libraries/ghc-bignum/gmp/ghc.mk +++ /dev/null @@ -1,141 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# We use a tarball like gmp-4.2.4-nodoc.tar.bz2, which is -# gmp-4.2.4.tar.bz2 repacked without the doc/ directory contents. -# That's because the doc/ directory contents are under the GFDL, -# which causes problems for Debian. - -ifneq "$(BINDIST)" "YES" -GMP_TARBALL := $(wildcard libraries/ghc-bignum/gmp/gmp-tarballs/gmp*.tar.bz2) -GMP_DIR := $(patsubst libraries/ghc-bignum/gmp/gmp-tarballs/%-nodoc.tar.bz2,%,$(GMP_TARBALL)) - -ifeq "$(GMP_TARBALL)" "" -$(error "GMP tarball is missing; you may need to run 'git submodule update --init'.") -endif -endif - -ifneq "$(NO_CLEAN_GMP)" "YES" -$(eval $(call clean-target,gmp,,\ - libraries/ghc-bignum/include/ghc-gmp.h \ - libraries/ghc-bignum/gmp/libgmp.a \ - libraries/ghc-bignum/gmp/gmp.h \ - libraries/ghc-bignum/gmp/gmpbuild \ - libraries/ghc-bignum/gmp/$(GMP_DIR))) - -clean : clean_gmp -.PHONY: clean_gmp -clean_gmp: - $(call removeTrees,libraries/ghc-bignum/gmp/objs) - $(call removeTrees,libraries/ghc-bignum/gmp/gmpbuild) -endif - -ifeq "$(GMP_PREFER_FRAMEWORK)" "YES" -libraries/ghc-bignum_CONFIGURE_OPTS += --with-gmp-framework-preferred -endif - -ifneq "$(CLEANING)" "YES" -# Hack. The file config.mk doesn't exist yet after running ./configure in -# the toplevel (ghc) directory. To let some toplevel make commands such as -# sdist go through, right after ./configure, don't consider this an error. --include libraries/ghc-bignum/dist-install/build/config.mk -endif - -gmp_CC_OPTS += $(addprefix -I,$(GMP_INCLUDE_DIRS)) -gmp_LD_OPTS += $(addprefix -L,$(GMP_LIB_DIRS)) - -# Compile GMP only if we don't have it already -# -# We use GMP's own configuration stuff, because it's all rather hairy -# and not worth re-implementing in our Makefile framework. - -ifeq "$(findstring dyn, $(GhcRTSWays))" "dyn" -BUILD_SHARED=yes -else -BUILD_SHARED=no -endif - -# In a bindist, we don't want to know whether /this/ machine has gmp, -# but whether the machine the bindist was built on had gmp. -ifeq "$(BINDIST)" "YES" -ifeq "$(wildcard libraries/ghc-bignum/gmp/libgmp.a)" "" -HaveLibGmp = YES -HaveFrameworkGMP = YES -else -HaveLibGmp = NO -HaveFrameworkGMP = NO -endif -endif - -UseIntreeGmp = NO -ifneq "$(HaveLibGmp)" "YES" -ifneq "$(HaveFrameworkGMP)" "YES" -UseIntreeGmp = YES -endif -endif - -# gmp_wrappers.c includes "ghc-gmp.h" -libraries/ghc-bignum/cbits/gmp_wrappers.c: libraries/ghc-bignum/include/ghc-gmp.h - -ifeq "$(UseIntreeGmp)" "YES" -# Copy header from in-tree build (gmp.h => ghc-gmp.h) -libraries/ghc-bignum/include/ghc-gmp.h: libraries/ghc-bignum/gmp/gmp.h - $(CP) $< $@ - -# Link in-tree GMP objects -libraries/ghc-bignum_dist-install_EXTRA_OBJS += libraries/ghc-bignum/gmp/objs/*.o - -else - -# Copy header from source tree -libraries/ghc-bignum/include/ghc-gmp.h: libraries/ghc-bignum/gmp/ghc-gmp.h - $(CP) $< $@ - -endif - -libraries/ghc-bignum_dist-install_EXTRA_CC_OPTS += $(gmp_CC_OPTS) - -ifneq "$(CLEANING)" "YES" -# When running `make clean` before `./configure`, CC_STAGE1 is undefined. -CLANG = $(findstring clang, $(shell $(CC_STAGE1) --version)) - -ifeq "$(CLANG)" "clang" -CCX = $(CLANG) -else -CCX = $(CC_STAGE1) -endif - -libraries/ghc-bignum/gmp/libgmp.a libraries/ghc-bignum/gmp/gmp.h: - $(RM) -rf libraries/ghc-bignum/gmp/$(GMP_DIR) libraries/ghc-bignum/gmp/gmpbuild libraries/ghc-bignum/gmp/objs - cat $(GMP_TARBALL) | $(BZIP2_CMD) -d | { cd libraries/ghc-bignum/gmp && $(TAR_CMD) -xf - ; } - mv libraries/ghc-bignum/gmp/$(GMP_DIR) libraries/ghc-bignum/gmp/gmpbuild - cd libraries/ghc-bignum/gmp && $(PATCH_CMD) -p0 < gmpsrc.patch - chmod +x libraries/ghc-bignum/gmp/ln - - # Note: We must pass `TARGETPLATFORM` to the `--host` argument of GMP's - # `./configure`, not `HOSTPLATFORM`: the 'host' on which GMP will - # run is the 'target' platform of the compiler we're building. - # Note2: we pass --with-readline=no, to prevent getting an indirect - # dependency on ncurses through gmp. readline is only relevant - # for gmp test programs. (See gmp's configure) - cd libraries/ghc-bignum/gmp/gmpbuild; \ - CC=$(CCX) CXX=$(CCX) NM=$(NM) AR=$(AR_STAGE1) ./configure \ - --enable-shared=no --with-pic=yes --with-readline=no \ - --host=$(TARGETPLATFORM) --build=$(BUILDPLATFORM) - $(MAKE) -C libraries/ghc-bignum/gmp/gmpbuild MAKEFLAGS= - $(CP) libraries/ghc-bignum/gmp/gmpbuild/gmp.h libraries/ghc-bignum/gmp/ - $(CP) libraries/ghc-bignum/gmp/gmpbuild/.libs/libgmp.a libraries/ghc-bignum/gmp/ - $(MKDIRHIER) libraries/ghc-bignum/gmp/objs - cd libraries/ghc-bignum/gmp/objs && $(AR_STAGE1) x ../libgmp.a - $(RANLIB_CMD) libraries/ghc-bignum/gmp/libgmp.a - -endif # CLEANING diff --git a/libraries/ghc-boot/ghc.mk b/libraries/ghc-boot/ghc.mk deleted file mode 100644 index daa3e3fc55..0000000000 --- a/libraries/ghc-boot/ghc.mk +++ /dev/null @@ -1,58 +0,0 @@ -libraries/ghc-boot_PACKAGE = ghc-boot -libraries/ghc-boot_dist-install_GROUP = libraries -$(if $(filter ghc-boot,$(PACKAGES_STAGE0)),$(eval $(call build-package,libraries/ghc-boot,dist-boot,0))) -$(if $(filter ghc-boot,$(PACKAGES_STAGE1)),$(eval $(call build-package,libraries/ghc-boot,dist-install,1))) -$(if $(filter ghc-boot,$(PACKAGES_STAGE2)),$(eval $(call build-package,libraries/ghc-boot,dist-install,2))) - -libraries/ghc-boot/dist-boot/build/GHC/Version.hs \ -libraries/ghc-boot/dist-install/build/GHC/Version.hs: mk/project.mk | $$(dir $$@)/. - $(call removeFiles,$@) - @echo "module GHC.Version where" >> $@ - @echo >> $@ - @echo 'import Prelude -- See Note [Why do we import Prelude here?]' >> $@ - @echo >> $@ - @echo 'cProjectGitCommitId :: String' >> $@ - @echo 'cProjectGitCommitId = "$(ProjectGitCommitId)"' >> $@ - @echo >> $@ - @echo 'cProjectVersion :: String' >> $@ - @echo 'cProjectVersion = "$(ProjectVersion)"' >> $@ - @echo >> $@ - @echo 'cProjectVersionInt :: String' >> $@ - @echo 'cProjectVersionInt = "$(ProjectVersionInt)"' >> $@ - @echo >> $@ - @echo 'cProjectPatchLevel :: String' >> $@ - @echo 'cProjectPatchLevel = "$(ProjectPatchLevel)"' >> $@ - @echo >> $@ - @echo 'cProjectPatchLevel1 :: String' >> $@ - @echo 'cProjectPatchLevel1 = "$(ProjectPatchLevel1)"' >> $@ - @echo >> $@ - @echo 'cProjectPatchLevel2 :: String' >> $@ - @echo 'cProjectPatchLevel2 = "$(ProjectPatchLevel2)"' >> $@ - @echo done. - -libraries/ghc-boot/dist-boot/package-data.mk: \ - libraries/ghc-boot/dist-boot/build/GHC/Version.hs -libraries/ghc-boot/dist-install/package-data.mk: \ - libraries/ghc-boot/dist-install/build/GHC/Version.hs - -libraries/ghc-boot/dist-boot/build/GHC/Platform/Host.hs \ -libraries/ghc-boot/dist-install/build/GHC/Platform/Host.hs: mk/project.mk | $$(dir $$@)/. - $(call removeFiles,$@) - @echo "module GHC.Platform.Host where" >> $@ - @echo >> $@ - @echo 'import GHC.Platform.ArchOS' >> $@ - @echo >> $@ - @echo 'hostPlatformArch :: Arch' >> $@ - @echo 'hostPlatformArch = $(HaskellHostArch)' >> $@ - @echo >> $@ - @echo 'hostPlatformOS :: OS' >> $@ - @echo 'hostPlatformOS = $(HaskellHostOs)' >> $@ - @echo >> $@ - @echo 'hostPlatformArchOS :: ArchOS' >> $@ - @echo 'hostPlatformArchOS = ArchOS hostPlatformArch hostPlatformOS' >> $@ - @echo done. - -libraries/ghc-boot/dist-boot/package-data.mk: \ - libraries/ghc-boot/dist-boot/build/GHC/Platform/Host.hs -libraries/ghc-boot/dist-install/package-data.mk: \ - libraries/ghc-boot/dist-install/build/GHC/Platform/Host.hs diff --git a/mk/compiler-ghc.mk b/mk/compiler-ghc.mk deleted file mode 100644 index 739f6157d5..0000000000 --- a/mk/compiler-ghc.mk +++ /dev/null @@ -1,58 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -TOP = .. -SPEC_TARGETS = 1 2 3 re1 re2 re3 -include $(TOP)/mk/sub-makefile.mk - -FAST_MAKE_OPTS += compiler_stage1_NO_BUILD_DEPS=YES \ - compiler_stage2_NO_BUILD_DEPS=YES \ - compiler_stage3_NO_BUILD_DEPS=YES \ - ghc_stage1_NO_BUILD_DEPS=YES \ - ghc_stage2_NO_BUILD_DEPS=YES \ - ghc_stage3_NO_BUILD_DEPS=YES - -.PHONY: 1 2 3 - -1: - +$(TOPMAKE) stage=1 all_ghc_stage1 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage1 ghc_stage1" - -2: - +$(TOPMAKE) stage=2 all_ghc_stage2 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage2 ghc_stage2" NO_STAGE2_DEPS=YES - -3: - +$(TOPMAKE) stage=3 all_ghc_stage3 $(FAST_MAKE_OPTS) ONLY_DEPS_FOR="compiler_stage3 ghc_stage3" NO_STAGE3_DEPS=YES - - -# 'make re2' rebuilds stage2, removing the old executable first. Useful for -# something like 'make re2 GhcDebugged=YES'. - -.PHONY: re1 re2 re3 -re1: - $(RM) $(TOP)/ghc/stage1/build/tmp/ghc-stage1 - $(MAKE) 1 -re2: - $(RM) $(TOP)/ghc/stage2/build/tmp/ghc-stage2 - $(MAKE) 2 -re3: - $(RM) $(TOP)/ghc/stage3/build/tmp/ghc-stage3 - $(MAKE) 3 - -.PHONY: extra-help -help : extra-help -extra-help : - @echo " make 1" - @echo " make 2" - @echo " make 3" - @echo - @echo " Build the stage 1, 2 or 3 GHC respectively, omitting dependencies" - @echo " and initial phases for speed." diff --git a/mk/custom-settings.mk b/mk/custom-settings.mk deleted file mode 100644 index 2b4b127102..0000000000 --- a/mk/custom-settings.mk +++ /dev/null @@ -1,14 +0,0 @@ - --include mk/are-validating.mk - -ifeq "$(Validating)" "YES" -include mk/flavours/validate.mk --include mk/validate.mk -else --include $(firstword $(wildcard mk/$(TargetPlatformFull)-build.mk) mk/build.mk) -endif - -ifeq "$(BINDIST)" "YES" --include bindist.mk -endif - diff --git a/mk/flavours/bench-cross-ncg.mk b/mk/flavours/bench-cross-ncg.mk deleted file mode 100644 index d52eb1ca80..0000000000 --- a/mk/flavours/bench-cross-ncg.mk +++ /dev/null @@ -1,15 +0,0 @@ -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O0 -GhcLibHcOpts = -O2 -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO -WITH_TERMINFO = NO - -BIGNUM_BACKEND = native -Stage1Only = YES -DYNAMIC_GHC_PROGRAMS = NO diff --git a/mk/flavours/bench-cross.mk b/mk/flavours/bench-cross.mk deleted file mode 100644 index 98f0531bc7..0000000000 --- a/mk/flavours/bench-cross.mk +++ /dev/null @@ -1,15 +0,0 @@ -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O -GhcStage2HcOpts = -O0 -fllvm -GhcLibHcOpts = -O2 -fllvm -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO -WITH_TERMINFO = NO - -BIGNUM_BACKEND = native -Stage1Only = YES -DYNAMIC_GHC_PROGRAMS = NO diff --git a/mk/flavours/bench-llvm.mk b/mk/flavours/bench-llvm.mk deleted file mode 100644 index 58fb92df21..0000000000 --- a/mk/flavours/bench-llvm.mk +++ /dev/null @@ -1,10 +0,0 @@ -SRC_HC_OPTS = -O -H64m -fllvm -GhcStage1HcOpts = -O -GhcStage2HcOpts = -O0 -GhcLibHcOpts = -O2 -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO diff --git a/mk/flavours/bench.mk b/mk/flavours/bench.mk deleted file mode 100644 index ecfc535178..0000000000 --- a/mk/flavours/bench.mk +++ /dev/null @@ -1,10 +0,0 @@ -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O0 -GhcLibHcOpts = -O2 -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO diff --git a/mk/flavours/devel-cross-ncg.mk b/mk/flavours/devel-cross-ncg.mk deleted file mode 100644 index 0d5325dd25..0000000000 --- a/mk/flavours/devel-cross-ncg.mk +++ /dev/null @@ -1,18 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -GhcStage1HcOpts = -O2 -DDEBUG -GhcStage2HcOpts = -O0 -GhcLibHcOpts = -O -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO -WITH_TERMINFO = NO - -BIGNUM_BACKEND = native -Stage1Only = YES -DYNAMIC_BY_DEFAULT = NO -DYNAMIC_GHC_PROGRAMS = NO - -libraries/Cabal_dist-install_HC_OPTS += -O0 diff --git a/mk/flavours/devel1.mk b/mk/flavours/devel1.mk deleted file mode 100644 index 1c03aff10b..0000000000 --- a/mk/flavours/devel1.mk +++ /dev/null @@ -1,16 +0,0 @@ -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O0 -DDEBUG -GhcStage2HcOpts = -O -GhcLibHcOpts = -O -dcore-lint -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO - -LAX_DEPENDENCIES = YES - -# Reduce optimisation when building Cabal; this makes a significant difference -# in overall build time. See #16817. -libraries/Cabal_dist-install_HC_OPTS += -O0 diff --git a/mk/flavours/devel2.mk b/mk/flavours/devel2.mk deleted file mode 100644 index 2d7d3b3884..0000000000 --- a/mk/flavours/devel2.mk +++ /dev/null @@ -1,16 +0,0 @@ -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O0 -DDEBUG -GhcLibHcOpts = -O -dcore-lint -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO - -LAX_DEPENDENCIES = YES - -# Reduce optimisation when building Cabal; this makes a significant difference -# in overall build time. See #16817. -libraries/Cabal_dist-install_HC_OPTS += -O0 diff --git a/mk/flavours/dwarf.mk b/mk/flavours/dwarf.mk deleted file mode 100644 index 15f16e2c37..0000000000 --- a/mk/flavours/dwarf.mk +++ /dev/null @@ -1,14 +0,0 @@ -# Build flavour which produces a compiler, RTS, and core libraries with DWARF -# debug information. For best results run ./configure with -# --enable-dwarf-unwind. - -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O2 -g3 -GhcRtsHcOpts = -O2 -g3 -GhcLibHcOpts = -O2 -g3 -BUILD_PROF_LIBS = YES -#SplitObjs -#HADDOCK_DOCS -#BUILD_SPHINX_HTML -#BUILD_SPHINX_PDF diff --git a/mk/flavours/perf-cross-ncg.mk b/mk/flavours/perf-cross-ncg.mk deleted file mode 100644 index 61db9b5d43..0000000000 --- a/mk/flavours/perf-cross-ncg.mk +++ /dev/null @@ -1,14 +0,0 @@ -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O2 -GhcLibHcOpts = -O2 -BUILD_PROF_LIBS = YES -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO -WITH_TERMINFO = NO - -BIGNUM_BACKEND = native -Stage1Only = YES -DYNAMIC_GHC_PROGRAMS = NO diff --git a/mk/flavours/perf-cross.mk b/mk/flavours/perf-cross.mk deleted file mode 100644 index 7b85cc6979..0000000000 --- a/mk/flavours/perf-cross.mk +++ /dev/null @@ -1,14 +0,0 @@ -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O2 -fllvm -GhcLibHcOpts = -O2 -fllvm -BUILD_PROF_LIBS = YES -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO -WITH_TERMINFO = NO - -BIGNUM_BACKEND = native -Stage1Only = YES -DYNAMIC_GHC_PROGRAMS = NO diff --git a/mk/flavours/perf-llvm.mk b/mk/flavours/perf-llvm.mk deleted file mode 100644 index 2598f4a40d..0000000000 --- a/mk/flavours/perf-llvm.mk +++ /dev/null @@ -1,8 +0,0 @@ -SRC_HC_OPTS = -O -H64m -fllvm -GhcStage1HcOpts = -O -GhcStage2HcOpts = -O2 -GhcLibHcOpts = -O2 -BUILD_PROF_LIBS = YES -#HADDOCK_DOCS -#BUILD_SPHINX_HTML -#BUILD_SPHINX_PDF diff --git a/mk/flavours/perf.mk b/mk/flavours/perf.mk deleted file mode 100644 index ee856626ad..0000000000 --- a/mk/flavours/perf.mk +++ /dev/null @@ -1,8 +0,0 @@ -SRC_HC_OPTS = -O -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O2 -GhcLibHcOpts = -O2 -BUILD_PROF_LIBS = YES -#HADDOCK_DOCS -#BUILD_SPHINX_HTML -#BUILD_SPHINX_PDF diff --git a/mk/flavours/prof-llvm.mk b/mk/flavours/prof-llvm.mk deleted file mode 100644 index 9c284432aa..0000000000 --- a/mk/flavours/prof-llvm.mk +++ /dev/null @@ -1,12 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -fllvm -GhcStage1HcOpts = -O -GhcStage2HcOpts = -O -GhcLibHcOpts = -O -BUILD_PROF_LIBS = YES -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO - -GhcProfiled = YES diff --git a/mk/flavours/prof.mk b/mk/flavours/prof.mk deleted file mode 100644 index 6c4a6baac3..0000000000 --- a/mk/flavours/prof.mk +++ /dev/null @@ -1,11 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O -GhcLibHcOpts = -O -BUILD_PROF_LIBS = YES -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO - -GhcProfiled = YES diff --git a/mk/flavours/quick-cross-ncg.mk b/mk/flavours/quick-cross-ncg.mk deleted file mode 100644 index 748720f01c..0000000000 --- a/mk/flavours/quick-cross-ncg.mk +++ /dev/null @@ -1,15 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O0 -GhcLibHcOpts = -O -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO -WITH_TERMINFO = NO - -BIGNUM_BACKEND = native -Stage1Only = YES -DYNAMIC_GHC_PROGRAMS = NO diff --git a/mk/flavours/quick-cross.mk b/mk/flavours/quick-cross.mk deleted file mode 100644 index 4e3f47fd67..0000000000 --- a/mk/flavours/quick-cross.mk +++ /dev/null @@ -1,15 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -GhcStage1HcOpts = -O -GhcStage2HcOpts = -O0 -fllvm -GhcLibHcOpts = -O -fllvm -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO -WITH_TERMINFO = NO - -BIGNUM_BACKEND = native -Stage1Only = YES -DYNAMIC_GHC_PROGRAMS = NO diff --git a/mk/flavours/quick-llvm.mk b/mk/flavours/quick-llvm.mk deleted file mode 100644 index 9869041012..0000000000 --- a/mk/flavours/quick-llvm.mk +++ /dev/null @@ -1,10 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -fllvm -GhcStage1HcOpts = -O -GhcStage2HcOpts = -O0 -GhcLibHcOpts = -O -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO diff --git a/mk/flavours/quick.mk b/mk/flavours/quick.mk deleted file mode 100644 index 286cb2ed23..0000000000 --- a/mk/flavours/quick.mk +++ /dev/null @@ -1,10 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O0 -GhcLibHcOpts = -O -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO diff --git a/mk/flavours/quickest.mk b/mk/flavours/quickest.mk deleted file mode 100644 index 5583748eb9..0000000000 --- a/mk/flavours/quickest.mk +++ /dev/null @@ -1,10 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -GhcStage1HcOpts = -O2 -GhcStage2HcOpts = -O0 -GhcLibHcOpts = -O0 -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -BUILD_MAN = NO diff --git a/mk/flavours/validate.mk b/mk/flavours/validate.mk deleted file mode 100644 index eddd22fb82..0000000000 --- a/mk/flavours/validate.mk +++ /dev/null @@ -1,56 +0,0 @@ -SRC_HC_OPTS = -O0 -H64m -SRC_HC_OPTS_STAGE1 = -fllvm-fill-undef-with-garbage # See #11487 -GhcStage1HcOpts = -O2 -DDEBUG -GhcStage2HcOpts = -O -dcore-lint -dno-debug-output -GhcLibHcOpts = -O -dcore-lint -dno-debug-output -BUILD_PROF_LIBS = NO -SplitSections = NO -HADDOCK_DOCS = YES -BUILD_SPHINX_HTML ?= YES -BUILD_SPHINX_PDF ?= NO - -ifeq "$(ValidateHpc)" "YES" -GhcStage2HcOpts += -fhpc -hpcdir $(TOP)/testsuite/hpc_output/ -endif - -ifeq "$(ValidateSpeed)" "SLOW" -GhcStage2HcOpts += -DDEBUG -endif - -ifeq "$(ValidateSpeed)" "SLOW" -BUILD_PROF_LIBS = YES -endif - -ifneq "$(ValidateSpeed)" "FAST" -BUILD_EXTRA_PKGS = YES -endif - -WERROR = -Werror - -# Reduce optimisation when building Cabal; this makes a significant difference -# in overall build time. See #16817. -libraries/Cabal_dist-install_HC_OPTS += -O0 - -# DO NOT EDIT THIS FILE! Instead, create a file mk/validate.mk, whose settings -# will override these. See also mk/custom-settings.mk. -# -# -# (Note: these comments are at the end of this file, to make it easier to diff -# this file with other build flavours.) -# -# -# Note [validate build settings] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Using GhcStage2HcOpts=-O (rather than -O0) here bringes my validate down from -# 22mins to 16 mins. Compiling stage2 takes longer, but we gain a faster -# haddock, faster running of the tests, and faster building of the utils to be -# installed -# -# dblatex with miktex under msys/mingw can't build the PS and PDF docs, -# and just building the HTML docs is sufficient to check that the -# markup is correct, so we turn off PS and PDF doc building when -# validating. -# -# We set BUILD_EXTRA_PKGS=YES to build the "extra" packages (see ./packages), -# so that we can test them. diff --git a/mk/sub-makefile.mk b/mk/sub-makefile.mk deleted file mode 100644 index 73d98c992c..0000000000 --- a/mk/sub-makefile.mk +++ /dev/null @@ -1,67 +0,0 @@ -# This file is included by all the "stub makefiles" in every directory -# in the tree except the root. Its job is to invoke $(MAKE) on the -# top-level Makefile, but modifying the target so that it applies to -# the current directory only. -# -# eg. -# make foo.o ==> make -C $(TOP) dir/foo.o -# make all ==> make -C $(TOP) all_dir -# make clean ==> make -C $(TOP) clean_dir -# - -# Eliminate use of the built-in implicit rules, and clear out the default list -# of suffixes for suffix rules. Speeds up make quite a bit. Both are needed -# for the shortest `make -d` output. -# Don't set --no-builtin-variables; some rules might stop working if you do -# (e.g. 'make clean' in testsuite/ currently relies on an implicit $RM). -MAKEFLAGS += --no-builtin-rules -.SUFFIXES: - -TOPMAKE = $(MAKE) -C $(TOP) - -default: all - -fast: all - -FAST_MAKE_OPTS =\ - $(dir)_dist_NO_BUILD_DEPS=YES \ - $(dir)_dist-boot_NO_BUILD_DEPS=YES \ - $(dir)_dist-install_NO_BUILD_DEPS=YES \ - NO_GENERATED_MAKEFILE_RULES=YES \ - OMIT_PHASE_0=YES OMIT_PHASE_1=YES - -ifneq "$(filter fast,$(MAKECMDGOALS))" "" -EXTRA_MAKE_OPTS += $(FAST_MAKE_OPTS) -else -ifeq "$(FAST)" "YES" -EXTRA_MAKE_OPTS += $(FAST_MAKE_OPTS) -endif -endif - -# We must not execute multiple recursive invocations of make in parallel. -.NOTPARALLEL: - -STD_TARGETS = all clean distclean maintainer_clean install html ps pdf -DIRECTORY_INDEPENDENT_TARGETS = show show! - -# The + tells make that we're recursively invoking make, otherwise 'make -j2' -# goes wrong. -$(STD_TARGETS): - +$(TOPMAKE) $@_$(dir) $(EXTRA_MAKE_OPTS) - -$(DIRECTORY_INDEPENDENT_TARGETS): - +$(TOPMAKE) $@ $(EXTRA_MAKE_OPTS) - -OTHERTARGETS=$(filter-out fast help $(DIRECTORY_INDEPENDENT_TARGETS) $(STD_TARGETS) $(SPEC_TARGETS),$(MAKECMDGOALS)) -.PHONY: $(OTHERTARGETS) -$(OTHERTARGETS): - +$(TOPMAKE) $(dir)/$@ $(EXTRA_MAKE_OPTS) - -.PHONY: help -help : sub-help - -.PHONY: sub-help -sub-help : - @echo "You are in subdirectory \"$(dir)\"." - @echo "Useful targets in this directory:" - @sed '1,/Using `make` in subdirectories/d' $(TOP)/MAKEHELP.md diff --git a/mk/tree.mk b/mk/tree.mk deleted file mode 100644 index a8925d60c3..0000000000 --- a/mk/tree.mk +++ /dev/null @@ -1,73 +0,0 @@ - -################################################################################ -# -# Layout of the source tree -# -################################################################################ - -# Here we provide defines for the various directories in the source tree, -# so we can move things around more easily. A define $(GHC_FOO_DIR) -# indicates a directory relative to the top of the source tree. - -GHC_UTILS_DIR = utils -GHC_RTS_DIR = rts -GHC_DRIVER_DIR = driver - -INPLACE = inplace -INPLACE_BIN = $(INPLACE)/bin -INPLACE_LIB = $(INPLACE)/lib -INPLACE_TOPDIR = $(INPLACE)/lib -INPLACE_MINGW = $(INPLACE)/mingw - -################################################################################ -# -# Bindist testing directory -# -################################################################################ - -# See Note [Spaces in TEST_HC]. -# Directory contains multiple spaces, to test that multiple spaces aren't -# getting collapsed into a single space. -BIN_DIST_INST_SUBDIR = "install dir" -BIN_DIST_INST_DIR = bindisttest/$(BIN_DIST_INST_SUBDIR) - -################################################################################ -# -# rm -# -################################################################################ - -# These are here, rather than in config.mk, as they need to exist in an -# unconfigured tree so that the various clean targets can be used -# without configuring: -ifeq "$(ONLY_SHOW_CLEANS)" "YES" -RM = utils/testremove/wouldrm -RM_OPTS = CLEAN_FILES -RM_OPTS_REC = CLEAN_REC -else -RM = rm -RM_OPTS = -f -RM_OPTS_REC = -rf -endif - -# If $1 is empty then we don't do anything (as "rm -rf" fails on -# Solaris; trac #4916). -# If $1 contains a * then we fail; globbing needs to be done at the call -# site using $(wildcard ...). This makes it a little safer, as it's -# harder to accidentally delete something you didn't mean to. -# Similarly, we fail if any argument contains ".." or starts with a "/". - -removeFiles = $(call removeHelper,removeFiles,"$(RM)",$(RM_OPTS),$1) -removeTrees = $(call removeHelper,removeTrees,"$(RM)",$(RM_OPTS_REC),$1) - -removeHelper = $(if $(strip $4),\ - $(if $(findstring *,$4),\ - $(error $1: Got a star: $4),\ - $(if $(findstring ..,$4),\ - $(error $1: Got dot-dot: $4),\ - $(if $(filter /%,$4),\ - $(error $1: Got leading slash: $4),\ - $2 $3 $4\ - )))\ - ) - diff --git a/mk/validate.mk.sample b/mk/validate.mk.sample deleted file mode 100644 index 83c2c40afd..0000000000 --- a/mk/validate.mk.sample +++ /dev/null @@ -1,4 +0,0 @@ -# These settings override mk/flavours/validate.mk (see -# mk/custom-settings.mk). -#HADDOCK_DOCS = NO -#BUILD_SPHINX_HTML = NO diff --git a/mk/warnings.mk b/mk/warnings.mk deleted file mode 100644 index bdbdc79213..0000000000 --- a/mk/warnings.mk +++ /dev/null @@ -1,155 +0,0 @@ -# See Note [Order of warning flags]. -SRC_CC_OPTS += -Wall $(WERROR) -SRC_HC_OPTS += -Wall -# Don't add -Werror to SRC_HC_OPTS_STAGE0 (or SRC_HC_OPTS), because otherwise -# validate may unnecessarily fail when booting with an older compiler. -# It would be better to only exclude certain warnings from becoming errors -# (e.g. '-Werror -Wno-error=unused-imports -Wno-error=...'), but -Wno-error -# isn't supported yet (https://gitlab.haskell.org/ghc/ghc/wikis/design/warnings). -# -# See Note [Stage number in build variables] in mk/config.mk.in. -SRC_HC_OPTS_STAGE1 += $(WERROR) -SRC_HC_OPTS_STAGE2 += $(WERROR) - -# Enable -Wcpp-undef for GHC components only, as we don't (currently) expect -# core libraries to build in this configuration (see #13636). -GhcRtsHcOpts += -Wcpp-undef -GhcStage1HcOpts += -Wcpp-undef -GhcStage2HcOpts += -Wcpp-undef -Wincomplete-uni-patterns -Wincomplete-record-updates - -ifneq "$(CcLlvmBackend)" "YES" - -# Debian doesn't turn -Werror=unused-but-set-variable on by default, so -# we turn it on explicitly for consistency with other users -# Never set the flag on Windows as the host gcc may be too old. -ifneq "$(HostOS_CPP)" "mingw32" -SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable -endif - -# Suppress the warning about __sync_fetch_and_nand (#9678). -libraries/ghc-prim/cbits/atomic_CC_OPTS += -Wno-sync-nand -# gcc 4.6 gives 3 warnings for giveCapabilityToTask not being inlined -# gcc 4.4 gives 2 warnings for lockClosure not being inlined -SRC_CC_WARNING_OPTS += -Wno-error=inline - -else - -# Don't warn about unknown GCC pragmas when using clang -SRC_CC_WARNING_OPTS += -Wno-unknown-pragmas - -endif - -SRC_HC_WARNING_OPTS_STAGE1 += -Wnoncanonical-monad-instances -SRC_HC_WARNING_OPTS_STAGE2 += -Wnoncanonical-monad-instances - - -###################################################################### -# Disable some warnings in packages we use - -# NB: The GHC version used for bootstrapping may not support the -# `-W`-aliases for `-f(no-)warn` flags introduced in GHC 8.0, so in -# some cases (watch out for make-variables with a name containing -# "boot") we need to pass the legacy `-f(no-)warn`-flags instead. - -# Libraries that have dubious RULES -libraries/bytestring_dist-install_EXTRA_HC_OPTS += -Wno-inline-rule-shadowing - -# Turn off import warnings for bad unused imports -utils/haddock_dist_EXTRA_HC_OPTS += -Wno-unused-imports -libraries/vector_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports -libraries/directory_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports - -# haddock's attoparsec uses deprecated `inlinePerformIO` -utils/haddock_dist_EXTRA_HC_OPTS += -Wno-deprecations -# binary too -libraries/binary_dist-install_EXTRA_HC_OPTS += -Wno-deprecations - -# On Windows, there are/were some unused import warnings -ifeq "$(HostOS_CPP)" "mingw32" -libraries/time_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports -Wno-identities -endif - -# On Windows, the pattern for CallConv is already exhaustive. Ignore the warning -ifeq "$(HostOS_CPP)" "mingw32" -libraries/ghci_dist-install_EXTRA_HC_OPTS += -Wno-overlapping-patterns -endif - -# haskeline has warnings about deprecated use of block/unblock -libraries/haskeline_dist-install_EXTRA_HC_OPTS += -Wno-deprecations -libraries/haskeline_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports -libraries/haskeline_dist-install_EXTRA_HC_OPTS += -Wno-redundant-constraints -libraries/haskeline_dist-install_EXTRA_HC_OPTS += -Wno-simplifiable-class-constraints - - -# temporarily turn off unused-imports warnings for pretty -libraries/pretty_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports - -# primitive has a warning about deprecated use of GHC.IOBase -libraries/primitive_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports -# primitive uses deprecated Control.Monad.Trans.Error -libraries/primitive_dist-install_EXTRA_HC_OPTS += -Wno-deprecations - -# See https://github.com/haskell/random/pull/20 -libraries/random_dist-install_EXTRA_HC_OPTS += -Wno-redundant-constraints - -# temporarily turn off unused-imports warnings for terminfo -libraries/terminfo_dist-boot_EXTRA_HC_OPTS += -fno-warn-unused-imports -libraries/terminfo_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports - -# vector has some unused match warnings -libraries/vector_dist-install_EXTRA_HC_OPTS += -Wwarn - -# temporarily turn off unused-imports warnings for xhtml -libraries/xhtml_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports -libraries/xhtml_dist-install_EXTRA_HC_OPTS += -Wno-tabs - -libraries/dph/dph-base_dist-install_EXTRA_HC_OPTS += -Wwarn -libraries/dph/dph-prim-interface_dist-install_EXTRA_HC_OPTS += -Wwarn -libraries/dph/dph-prim-seq_dist-install_EXTRA_HC_OPTS += -Wwarn -libraries/dph/dph-prim-par_dist-install_EXTRA_HC_OPTS += -Wwarn -libraries/dph/dph-lifted-common-install_EXTRA_HC_OPTS += -Wwarn - -# transformers has unused function parameters warnings -libraries/transformers_dist-boot_EXTRA_HC_OPTS += -fno-warn-unused-matches -fno-warn-unused-imports -libraries/transformers_dist-install_EXTRA_HC_OPTS += -Wno-unused-matches -Wno-unused-imports -libraries/transformers_dist-install_EXTRA_HC_OPTS += -Wno-redundant-constraints -libraries/transformers_dist-install_EXTRA_HC_OPTS += -Wno-orphans - -# parsec has various warnings -libraries/parsec_dist-install_EXTRA_HC_OPTS += -Wno-name-shadowing -Wno-unused-matches -libraries/parsec_dist-install_EXTRA_HC_OPTS += -Wno-unused-do-bind -Wno-missing-signatures -libraries/parsec_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports -Wno-type-defaults - -# text warns with integer-simple -libraries/text_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports - -# Turn of trustworthy-safe warning -libraries/base_dist-install_EXTRA_HC_OPTS += -Wno-trustworthy-safe -libraries/ghc-prim_dist-install_EXTRA_HC_OPTS += -Wno-trustworthy-safe -libraries/Win32_dist-install_EXTRA_HC_OPTS += -Wno-trustworthy-safe - -# We need -Wno-deprecated-flags to avoid failure with -Werror -GhcLibExtraHcOpts += -Wno-deprecated-flags -GhcBootLibExtraHcOpts += -fno-warn-deprecated-flags - -# Note [Order of warning flags] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# In distdir-way-opts, build flags are added in the following order (this -# list is not exhaustive): -# -# * SRC_HC_OPTS(_STAGE$4) -# * ghc-options from .cabal files ($1_$2_HC_OPTS) -# * SRC_HC_WARNING_OPTS(_STAGE$4) -# -# Considerations: -# -# * Most .cabal files specify -Wall. But not all, and not all building we -# do relies on .cabal files. So we have to add -Wall ourselves somewhere. -# -# * Some .cabal also specify warning suppression flags. Because -Wall -# overrides any warning suppression flags that come before it, we have to -# make sure -Wall comes before any warning suppression flags. So we add it -# to SRC_HC_OPTS. -# -# * Similarly, our own warning suppression should come after the -Wall from -# the .cabal files, so we do *not* add them to SRC_HC_OPTS. diff --git a/mk/ways.mk b/mk/ways.mk deleted file mode 100644 index 53f900f80e..0000000000 --- a/mk/ways.mk +++ /dev/null @@ -1,105 +0,0 @@ -# -# Options for compiling in different `ways'. -# -# To configure up your own way, have a look at some of the standard ways -# such as profiling, and create your own set of WAY_*_OPTS defs below. -# After having done that, add your way string to WAYS, and after having -# run the configure script, the different projects will add the new way -# to the list of ways they support. -# - -# -# Definitions of the different ways: -# -# * their name: -# - tag, e.g., p -# - description, e.g., profiling -# * what they mean to the driver: -# - WAY_p_HC_OPTS gives the list of command-line options -# to the driver. -# -# For consistency, the way name should be formed from the tags in the following -# order (the same ordering defined in DynFlags.Way), -# -# - thr: threaded -# - debug: debugging -# - p: profiled -# - dyn: dynamically-linked - -# -# The ways currently defined. -# -ALL_WAYS=v debug dyn thr p_dyn p debug_dyn thr_dyn thr_p_dyn thr_debug_dyn thr_debug debug_p thr_debug_p thr_p - -# -# The following ways currently are treated specially, -# as the driver script treats these guys specially and needs to carefully be told -# about the options for these. Hence, we hide the required command line options -# for these in the driver, as this is the only place they are needed. -# -# If you want to add to these default options, fill in the variables below: - -# Way 'v': -WAY_v_NAME=vanilla -WAY_v_HC_OPTS= -static - -# Way 'p': -WAY_p_NAME=profiling -WAY_p_HC_OPTS= -static -prof - -# -# These ways apply to the RTS only: -# - -# Way 'thr': -WAY_thr_NAME=threaded -WAY_thr_HC_OPTS= -static -optc-DTHREADED_RTS - -# Way 'thr_p': -WAY_thr_p_NAME=threaded profiling -WAY_thr_p_HC_OPTS= -static -prof -optc-DTHREADED_RTS - -# Way 'debug': -WAY_debug_NAME=debug -WAY_debug_HC_OPTS= -static -optc-DDEBUG -ticky -DTICKY_TICKY -optc-DTICKY_TICKY - -# Way 'debug_p': -WAY_debug_p_NAME=debug profiled -WAY_debug_p_HC_OPTS= -static -optc-DDEBUG -prof - -# Way 'p': -WAY_p_NAME=profiling -WAY_p_HC_OPTS= -static -prof - -# Way 'thr_debug': -WAY_thr_debug_NAME=threaded debug -WAY_thr_debug_HC_OPTS= -static -optc-DTHREADED_RTS -optc-DDEBUG - -# Way 'thr_debug_p': -WAY_thr_debug_p_NAME=threaded debug profiling -WAY_thr_debug_p_HC_OPTS= -static -optc-DTHREADED_RTS -optc-DDEBUG -prof - -# Way 'dyn': build dynamic shared libraries -WAY_dyn_NAME=dyn -WAY_dyn_HC_OPTS=-fPIC -dynamic - -# Way 'p_dyn': -WAY_p_dyn_NAME=p_dyn -WAY_p_dyn_HC_OPTS=-fPIC -dynamic -prof - -# Way 'thr_p_dyn': -WAY_thr_p_dyn_NAME=thr_p_dyn -WAY_thr_p_dyn_HC_OPTS=-fPIC -dynamic -prof -optc-DTHREADED_RTS - -# Way 'thr_dyn': -WAY_thr_dyn_NAME=thr_dyn -WAY_thr_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS - -# Way 'thr_debug_dyn': -WAY_thr_debug_dyn_NAME=thr_debug_dyn -WAY_thr_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS -optc-DDEBUG - -# Way 'debug_dyn': -WAY_debug_dyn_NAME=debug_dyn -WAY_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DDEBUG -ticky -DTICKY_TICKY -optc-DTICKY_TICKY - diff --git a/rts/ghc.mk b/rts/ghc.mk deleted file mode 100644 index 099e6531cd..0000000000 --- a/rts/ghc.mk +++ /dev/null @@ -1,684 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# ----------------------------------------------------------------------------- -# Building the RTS - -# We build the RTS with stage 1 -rts_dist-install_HC = $(GHC_STAGE1) - -rts_INSTALL_INFO = rts -rts_VERSION = 1.0.2 - -# Minimum supported Windows version. -# These numbers can be found at: -# https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx -# If we're compiling on windows, enforce that we only support Windows 7+ -# Adding this here means it doesn't have to be done in individual .c files -# and also centralizes the versioning. -rts_WINVER = 0x06010000 - -# merge GhcLibWays and GhcRTSWays but strip out duplicates -rts_WAYS = $(GhcLibWays) $(filter-out $(GhcLibWays),$(GhcRTSWays)) -rts_dist-install_WAYS = $(rts_WAYS) - -ALL_RTS_LIBS = $(foreach way,$(rts_WAYS),rts/dist-install/build/libHSrts$($(way)_libsuf)) -$(eval $(call all-target,rts,$(ALL_RTS_LIBS))) - -# ----------------------------------------------------------------------------- -# Defining the sources - -ALL_DIRS = hooks sm eventlog linker linker/macho - -ifeq "$(TargetOS_CPP)" "mingw32" -ALL_DIRS += win32 -else -ALL_DIRS += posix -endif - -tmp_rts_C_SRCS := $(wildcard rts/*.c $(foreach dir,$(ALL_DIRS),rts/$(dir)/*.c)) -# We shouldn't include this file in the binary, it's a common function so -# it will likely clash with something later. See #19948 -rts_C_SRCS = $(filter-out rts/xxhash.c, $(tmp_rts_C_SRCS)) -rts_C_HOOK_SRCS := $(wildcard rts/hooks/*.c) -rts_CMM_SRCS := $(wildcard rts/*.cmm) - -# Don't compile .S files when bootstrapping a new arch -ifneq "$(PORTING_HOST)" "YES" - -# unregisterised builds use the mini interpreter -ifneq "$(GhcUnregisterised)" "YES" -# use StgCRunAsm.S on ppc, ppc64, s390x, and riscv64 -ifneq "$(findstring $(TargetArch_CPP), ppc) $(findstring $(TargetArch_CPP), ppc64) $(findstring $(TargetArch_CPP), s390x) $(findstring $(TargetArch_CPP), riscv64)" "" -rts_S_SRCS += rts/StgCRunAsm.S -endif -endif - -# select adjustor implementation. This much match the logic in rts.cabal.in. -ifneq "$(CLEANING)" "YES" -# N.B. we don't source config.mk when CLEANING=YES so none of the below -# variables will be set. See #20166. -rts_C_SRCS += rts/adjustor/AdjustorPool.c -ifeq "$(UseLibffiForAdjustors)" "YES" -rts_C_SRCS += rts/adjustor/LibffiAdjustor.c -else -ifneq "$(findstring $(TargetArch_CPP), i386)" "" -rts_S_SRCS += rts/adjustor/Nativei386Asm.S -rts_C_SRCS += rts/adjustor/Nativei386.c -else -ifneq "$(findstring $(TargetArch_CPP), x86_64)" "" -ifneq "$(findstring $(TargetOS_CPP), mingw32)" "" -rts_S_SRCS += rts/adjustor/NativeAmd64MingwAsm.S -rts_C_SRCS += rts/adjustor/NativeAmd64Mingw.c -else -rts_S_SRCS += rts/adjustor/NativeAmd64Asm.S -rts_C_SRCS += rts/adjustor/NativeAmd64.c -endif -else -ifneq "$(findstring $(TargetArch_CPP), powerpc64le powerpc)" "" -rts_S_SRCS += rts/AdjustorAsm.S -rts_C_SRCS += rts/adjustor/NativePowerPC.c -else -$(error Target architecture has no native adjustor implementation) -endif -endif -endif -endif -endif -endif - -ifeq "$(GhcUnregisterised)" "YES" -GENAPPLY_OPTS = -u -endif - -rts_AUTO_APPLY_CMM = rts/dist-install/build/AutoApply.cmm - -$(rts_AUTO_APPLY_CMM): $$(genapply_INPLACE) - "$(genapply_INPLACE)" >$@ - - -rts_H_FILES := $(wildcard rts/*.h rts/*/*.h) - -ifeq "$(USE_DTRACE)" "YES" -DTRACEPROBES_H = rts/dist-install/build/include/RtsProbes.h -rts_H_FILES += $(DTRACEPROBES_H) -endif - -# collect the -l and -L flags that we need to link the rts dyn lib. -# Note that, as sed on OS X doesn't handle \+, we use [^ ][^ ]* rather -# than [^ ]\+ -rts/dist-install/libs.depend : $$(ghc-pkg_INPLACE) | $$(dir $$@)/. - "$(ghc-pkg_INPLACE)" --simple-output field rts extra-libraries \ - | sed -e 's/\([^ ][^ ]*\)/-l\1/g' > $@ - "$(ghc-pkg_INPLACE)" --simple-output field rts library-dirs \ - | sed -e 's/\([^ ][^ ]*\)/-L\1/g' >> $@ - - -# ---------------------------------------------------------------------------- -# On Windows, as the RTS and base libraries have recursive imports, -# we have to break the loop with "import libraries". -# These are made from rts/win32/libHS*.def which contain lists of -# all the symbols in those libraries used by the RTS. -# -ifeq "$(TargetOS_CPP)" "mingw32" - -ALL_RTS_DEF_LIBNAMES = base ghc-prim -ALL_RTS_DEF_LIBS = \ - rts/dist-install/build/win32/libHSbase.dll.a \ - rts/dist-install/build/win32/libHSghc-prim.dll.a - -# -- import libs for the regular Haskell libraries -define make-importlib-def # args $1 = lib name -rts/dist-install/build/win32/libHS$1.def : rts/win32/libHS$1.def - cat rts/win32/libHS$1.def \ - | sed "s/@LibVersion@/$$(libraries/$1_dist-install_VERSION)/" \ - | sed "s/@ProjectVersion@/$$(ProjectVersion)/" \ - > rts/dist-install/build/win32/libHS$1.def - -rts/dist-install/build/win32/libHS$1.dll.a : rts/dist-install/build/win32/libHS$1.def - "$$(DLLTOOL)" -d rts/dist-install/build/win32/libHS$1.def \ - -l rts/dist-install/build/win32/libHS$1.dll.a -endef -$(foreach lib,$(ALL_RTS_DEF_LIBNAMES),$(eval $(call make-importlib-def,$(lib)))) -endif - -ifneq "$(BINDIST)" "YES" -ifneq "$(UseSystemLibFFI)" "YES" -ifeq "$(TargetOS_CPP)" "mingw32" -rts/dist-install/build/$(LIBFFI_DLL): libffi/build/inst/bin/$(LIBFFI_DLL) - cp $< $@ -else -# This is a little hacky. We don't know the SO version, so we only -# depend on libffi.so, but copy libffi.so* -rts/dist-install/build/lib$(LIBFFI_NAME)$(soext): libffi/build/inst/lib/lib$(LIBFFI_NAME)$(soext) - cp libffi/build/inst/lib/lib$(LIBFFI_NAME)$(soext)* rts/dist-install/build -ifeq "$(TargetOS_CPP)" "darwin" - install_name_tool -id @rpath/lib$(LIBFFI_NAME)$(soext) rts/dist-install/build/lib$(LIBFFI_NAME)$(soext) -endif -endif -endif -endif - - -ifeq "$(USE_DTRACE)" "YES" -ifneq "$(findstring $(TargetOS_CPP), linux solaris2 freebsd)" "" -NEED_DTRACE_PROBES_OBJ = YES -endif -endif - -#----------------------------------------------------------------------------- -# Building one way -define build-rts-way # args: $1 = way - -ifneq "$$(BINDIST)" "YES" - -rts_dist-install_$1_HC_OPTS := $$(GhcRtsHcOpts) -rts_dist-install_$1_CC_OPTS := $$(GhcRtsCcOpts) - -# The per-way CC_OPTS -ifneq "$$(findstring debug, $1)" "" -rts_dist-install_$1_HC_OPTS += -O0 -rts_dist-install_$1_CC_OPTS += -fno-omit-frame-pointer -O0 -g3 -# Useful to ensure that inline functions can be called within GDB but not -# supported by clang -#rts_dist-install_$1_CC_OPTS += -fkeep-inline-functions -endif - -ifneq "$$(findstring dyn, $1)" "" -ifeq "$$(TargetOS_CPP)" "mingw32" -rts_dist-install_$1_CC_OPTS += -DCOMPILING_WINDOWS_DLL -endif -rts_dist-install_$1_CC_OPTS += -DDYNAMIC -endif - - -$(call distdir-way-opts,rts,dist-install,$1,1) # 1 because the rts is built with stage1 -$(call c-suffix-rules,rts,dist-install,$1,YES) -$(call cmm-suffix-rules,rts,dist-install,$1) - -rts_$1_LIB_FILE = libHSrts$$($1_libsuf) -rts_$1_LIB = rts/dist-install/build/$$(rts_$1_LIB_FILE) - -rts_$1_C_OBJS = $$(patsubst rts/%.c,rts/dist-install/build/%.$$($1_osuf),$$(rts_C_SRCS)) $$(patsubst %.c,%.$$($1_osuf),$$(rts_$1_EXTRA_C_SRCS)) -rts_$1_CXX_OBJS = $$(patsubst rts/%.c,rts/dist-install/build/%.$$($1_osuf),$$(rts_CXX_SRCS)) -rts_$1_C_HOOK_OBJS = $$(patsubst rts/hooks/%.c,rts/dist-install/build/hooks/%.$$($1_osuf),$$(rts_C_HOOK_SRCS)) -rts_$1_S_OBJS = $$(patsubst rts/%.S,rts/dist-install/build/%.$$($1_osuf),$$(rts_S_SRCS)) -rts_$1_CMM_OBJS = $$(patsubst rts/%.cmm,rts/dist-install/build/%.$$($1_osuf),$$(rts_CMM_SRCS)) $$(patsubst %.cmm,%.$$($1_osuf),$$(rts_AUTO_APPLY_CMM)) - -rts_$1_OBJS = $$(rts_$1_C_OBJS) $$(rts_$1_CXX_OBJS) $$(rts_$1_S_OBJS) $$(rts_$1_CMM_OBJS) - -ifeq "$(USE_DTRACE)" "YES" -ifeq "$(NEED_DTRACE_PROBES_OBJ)" "YES" -# On Darwin we don't need to generate binary containing probes defined -# in DTrace script, but DTrace on Solaris expects generation of binary -# from the DTrace probes definitions -rts_$1_DTRACE_OBJS = rts/dist-install/build/RtsProbes.$$($1_osuf) - -$$(rts_$1_DTRACE_OBJS) : $$(rts_$1_OBJS) - $(DTRACE) -G -C \ - $$(addprefix -Irts/,$$(rts_dist-install_DIST_INCLUDE_DIRS)) \ - -DDTRACE -s rts/RtsProbes.d \ - -o $$@ \ - $$(rts_$1_OBJS) -endif -endif - -rts_dist-install_$1_CC_OPTS += -DRtsWay=\"rts_$1\" - -# If we're compiling on windows, enforce that we only support XP+ -# Adding this here means it doesn't have to be done in individual .c files -# and also centralizes the versioning. -ifeq "$$(TargetOS_CPP)" "mingw32" -rts_dist-install_$1_CC_OPTS += -D_WIN32_WINNT=$(rts_WINVER) -endif - -ifneq "$$(UseSystemLibFFI)" "YES" -rts_dist-install_FFI_SO = rts/dist-install/build/lib$$(LIBFFI_NAME)$$(soext) -else -rts_dist-install_FFI_SO = -endif - -# Making a shared library for the RTS. -ifneq "$$(findstring dyn, $1)" "" -ifeq "$$(TargetOS_CPP)" "mingw32" -$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/dist-install/libs.depend rts/dist-install/build/$$(LIBFFI_DLL) - "$$(RM)" $$(RM_OPTS) $$@ - # Call out to the shell script to decide how to build the dll. - # Making a shared library for the RTS. - # $$1 = dir - # $$2 = distdir - # $$3 = way - # $$4 = extra flags - # $$5 = extra libraries to link - # $$6 = object files to link - # $$7 = output filename - # $$8 = link command - # $$9 = create delay load import lib - # $$10 = SxS Name - # $$11 = SxS Version - $$(gen-dll_INPLACE) link "rts/dist-install/build" "rts/dist-install/build" "" "" "$$(ALL_RTS_DEF_LIBS)" "$$(rts_$1_OBJS)" "$$@" "$$(rts_dist-install_HC) -this-unit-id rts -no-hs-main -shared -dynamic -dynload deploy \ - -no-auto-link-packages -Lrts/dist-install/build -l$$(LIBFFI_NAME) \ - `cat rts/dist-install/libs.depend | tr '\n' ' '` \ - $$(rts_dist-install_$1_GHC_LD_OPTS)" "NO" \ - "$(rts_INSTALL_INFO)-$(subst dyn,,$(subst _dyn,,$(subst v,,$1)))" "$(ProjectVersion)" - -else -ifneq "$$(UseSystemLibFFI)" "YES" -LIBFFI_LIBS = -Lrts/dist-install/build -l$$(LIBFFI_NAME) -ifeq "$$(TargetElf)" "YES" -LIBFFI_LIBS += -optl-Wl,-rpath -optl-Wl,'$$$$ORIGIN' -optl-Wl,-zorigin -endif -ifeq "$(TargetOS_CPP)" "darwin" -LIBFFI_LIBS += -optl-Wl,-rpath -optl-Wl,@loader_path -endif - -else -# flags will be taken care of in rts/dist-install/libs.depend -LIBFFI_LIBS = -endif -$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/dist-install/libs.depend $$(rts_dist-install_FFI_SO) - "$$(RM)" $$(RM_OPTS) $$@ - "$$(rts_dist-install_HC)" -this-unit-id rts -shared -dynamic -dynload deploy \ - -no-auto-link-packages $$(LIBFFI_LIBS) `cat rts/dist-install/libs.depend` $$(rts_$1_OBJS) \ - $$(rts_dist-install_$1_GHC_LD_OPTS) \ - $$(rts_$1_DTRACE_OBJS) -o $$@ -endif -else - -ifeq "$(USE_DTRACE)" "YES" -ifeq "$(NEED_DTRACE_PROBES_OBJ)" "YES" -# A list of objects that do not get included in the RTS object that is created -# during the linking step. To prevent future linking errors, especially when -# using the compiler as a bootstrap compiler, we need to exclude the hook -# objects from being re-linked into the single LINKED_OBJS object file. When the -# hooks are being linked into the RTS object this will result in duplicated -# symbols causing the linker to fail (e.g. `StackOverflowHook` in RTS.o and -# hschooks.o). The excluded objects do not get relinked into the RTS object but -# get included separately so prevent linker errors. -# (see issue #15040) -rts_$1_EXCLUDED_OBJS = $$(rts_$1_C_HOOK_OBJS) -# The RTS object that gets generated to package up all of the runtime system -# with the dtrace probe code. -rts_$1_LINKED_OBJS = rts/dist-install/build/RTS.$$($1_osuf) - -$$(rts_$1_LINKED_OBJS) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) $$(rts_$1_C_HOOK_OBJS) - "$$(RM)" $$(RM_OPTS) $$@ - - # When linking an archive the linker will only include the object files that - # are actually needed during linking. It therefore does not include the dtrace - # specific code for initializing the probes. By creating a single object that - # also includes the probe object code we force the linker to include the - # probes when linking the static runtime. - # - # The reason why we are re-linking all the objects into a single object file - # is stated in this thread: - # https://thr3ads.net/dtrace-discuss/2005/08/384778-Problem-with-probes-defined-in-static-libraries - $(LD) -r -o $$(rts_$1_LINKED_OBJS) $$(rts_$1_DTRACE_OBJS) $$(filter-out $$(rts_$1_EXCLUDED_OBJS), $$(rts_$1_OBJS)) -else -rts_$1_EXCLUDED_OBJS = -rts_$1_LINKED_OBJS = $$(rts_$1_OBJS) -endif -else -rts_$1_EXCLUDED_OBJS = -rts_$1_LINKED_OBJS = $$(rts_$1_OBJS) -endif - - -$$(rts_$1_LIB) : $$(rts_$1_LINKED_OBJS) - "$$(RM)" $$(RM_OPTS) $$@ - - echo $$(rts_$1_LINKED_OBJS) $$(rts_$1_EXCLUDED_OBJS) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR_STAGE1)" \ - $$(AR_OPTS_STAGE1) $$(EXTRA_AR_ARGS_STAGE1) $$@ - -ifneq "$$(UseSystemLibFFI)" "YES" -$$(rts_$1_LIB) : rts/dist-install/build/libC$$(LIBFFI_NAME)$$($1_libsuf) -rts/dist-install/build/libC$$(LIBFFI_NAME)$$($1_libsuf): libffi/build/inst/lib/libffi.a - cp $$< $$@ -endif - -endif - -endif - -endef - -# And expand the above for each way: -$(foreach way,$(rts_WAYS),$(eval $(call build-rts-way,$(way)))) - -$(eval $(call distdir-opts,rts,dist-install,1)) - -#----------------------------------------------------------------------------- -# Flags for compiling every file - -# We like plenty of warnings. -WARNING_OPTS += -Wall -WARNING_OPTS += -Wextra -WARNING_OPTS += -Wstrict-prototypes -WARNING_OPTS += -Wmissing-prototypes -WARNING_OPTS += -Wmissing-declarations -WARNING_OPTS += -Winline -WARNING_OPTS += -Wpointer-arith -WARNING_OPTS += -Wmissing-noreturn -WARNING_OPTS += -Wnested-externs -WARNING_OPTS += -Wredundant-decls -# Some gccs annoyingly enable this archaic specimen by default -WARNING_OPTS += -Wno-aggregate-return -WARNING_OPTS += -Wno-unused-label - -# These ones are hard to avoid: -#WARNING_OPTS += -Wconversion -#WARNING_OPTS += -Wbad-function-cast -#WARNING_OPTS += -Wshadow -#WARNING_OPTS += -Wcast-qual - -# This one seems buggy on GCC 4.1.2, which is the only GCC version we -# have that can bootstrap the SPARC build. We end up with lots of spurious -# warnings of the form "cast increases required alignment of target type". -# Some legitimate warnings can be fixed by adding an intermediate cast to -# (void*), but we get others in rts/sm/GCUtils.c concerning the gct var -# that look innocuous to me. We could enable this again once we deprecate -# support for registerised builds on this arch. -- BL 2010/02/03 -# WARNING_OPTS += -Wcast-align - -rts_INCLUDE_DIRS = \ - $(addprefix include/,$(includes_INCLUDE_DIRS)) \ - . - -rts_dist-install_INCLUDE_DIRS = \ - $(addprefix include/,$(includes_dist-install_INCLUDE_DIRS)) - -# COMPILING_RTS is only used when building Win32 DLL support. -rts_CPP_OPTS += -DCOMPILING_RTS -DFS_NAMESPACE=rts - -# HC_OPTS is included in both .c and .cmm compilations, whereas CC_OPTS is -# only included in .c compilations. HC_OPTS included the WAY_* opts, which -# must be included in both types of compilations. - -rts_CC_OPTS += $(WARNING_OPTS) - -rts_HC_OPTS += -this-unit-id rts - -ifneq "$(GhcWithSMP)" "YES" -rts_CC_OPTS += -DNOSMP -rts_HC_OPTS += -optc-DNOSMP -endif - -# We *want* type-checking of hand-written cmm. -rts_HC_OPTS += -dcmm-lint - -# -fno-strict-aliasing is required for the runtime, because we often -# use a variety of types to represent closure pointers (StgPtr, -# StgClosure, StgMVar, etc.), and without -fno-strict-aliasing gcc is -# allowed to assume that these pointers do not alias. eg. without -# this flag we get problems in sm/Evac.c:copy() with gcc 3.4.3, the -# upd_evacuee() assignments get moved before the object copy. -rts_CC_OPTS += -fno-strict-aliasing - -rts_CC_OPTS += -fno-common - -ifeq "$(BeConservative)" "YES" -rts_CC_OPTS += -DBE_CONSERVATIVE -endif - -# Set Windows version -ifeq "$$(TargetOS_CPP)" "mingw32" -rts_CC_OPTS += -DWINVER=$(rts_WINVER) -endif - -#----------------------------------------------------------------------------- -# Flags for compiling specific files -rts/RtsMessages_CC_OPTS += -DProjectVersion=\"$(ProjectVersion)\" -rts/RtsUtils_CC_OPTS += -DProjectVersion=\"$(ProjectVersion)\" -rts/Trace_CC_OPTS += -DProjectVersion=\"$(ProjectVersion)\" -# -rts/RtsUtils_CC_OPTS += -DHostPlatform=\"$(HOSTPLATFORM)\" -rts/RtsUtils_CC_OPTS += -DHostArch=\"$(HostArch_CPP)\" -rts/RtsUtils_CC_OPTS += -DHostOS=\"$(HostOS_CPP)\" -rts/RtsUtils_CC_OPTS += -DHostVendor=\"$(HostVendor_CPP)\" -# -rts/RtsUtils_CC_OPTS += -DBuildPlatform=\"$(BUILDPLATFORM)\" -rts/RtsUtils_CC_OPTS += -DBuildArch=\"$(BuildArch_CPP)\" -rts/RtsUtils_CC_OPTS += -DBuildOS=\"$(BuildOS_CPP)\" -rts/RtsUtils_CC_OPTS += -DBuildVendor=\"$(BuildVendor_CPP)\" -# -rts/RtsUtils_CC_OPTS += -DTargetPlatform=\"$(TARGETPLATFORM)\" -rts/RtsUtils_CC_OPTS += -DTargetArch=\"$(TargetArch_CPP)\" -rts/RtsUtils_CC_OPTS += -DTargetOS=\"$(TargetOS_CPP)\" -rts/RtsUtils_CC_OPTS += -DTargetVendor=\"$(TargetVendor_CPP)\" -# -rts/RtsUtils_CC_OPTS += -DGhcUnregisterised=\"$(GhcUnregisterised)\" -rts/RtsUtils_CC_OPTS += -DTablesNextToCode=\"$(TablesNextToCode)\" -# -rts/Hash_CC_OPTS += -O3 - -# Compile various performance-critical pieces *without* -fPIC -dynamic -# even when building a shared library. If we don't do this, then the -# GC runs about 50% slower on x86 due to the overheads of PIC. The -# cost of doing this is a little runtime linking and less sharing, but -# not much. -# -# On x86_64 this doesn't work, because all objects in a shared library -# must be compiled with -fPIC (since the 32-bit relocations generated -# by the default small memory can't be resolved at runtime). So we -# only do this on i386. -# -# This apparently doesn't work on OS X (Darwin) nor on Solaris. -# On Darwin we get errors of the form -# -# ld: absolute addressing (perhaps -mdynamic-no-pic) used in _stg_ap_0_fast from rts/dist-install/build/Apply.dyn_o not allowed in slidable image -# -# and lots of these warnings: -# -# ld: warning codegen in _stg_ap_pppv_fast (offset 0x0000005E) prevents image from loading in dyld shared cache -# -# On Solaris we get errors like: -# -# Text relocation remains referenced -# against symbol offset in file -# .rodata (section) 0x11 rts/dist-install/build/Apply.dyn_o -# ... -# ld: fatal: relocations remain against allocatable but non-writable sections -# collect2: ld returned 1 exit status - -ifeq "$(TargetArch_CPP)" "i386" -i386_SPEED_HACK := "YES" -ifeq "$(TargetOS_CPP)" "darwin" -i386_SPEED_HACK := "NO" -endif -ifeq "$(TargetOS_CPP)" "solaris2" -i386_SPEED_HACK := "NO" -endif -endif - -ifeq "$(TargetArch_CPP)" "i386" -ifeq "$(i386_SPEED_HACK)" "YES" -rts/sm/Evac_HC_OPTS += -fno-PIC -rts/sm/Evac_thr_HC_OPTS += -fno-PIC -rts/sm/Scav_HC_OPTS += -fno-PIC -rts/sm/Scav_thr_HC_OPTS += -fno-PIC -rts/sm/Compact_HC_OPTS += -fno-PIC -rts/sm/GC_HC_OPTS += -fno-PIC - -# -static is also necessary for these bits, otherwise the NCG -# -generates dynamic references: -rts/Updates_HC_OPTS += -fno-PIC -static -rts/StgMiscClosures_HC_OPTS += -fno-PIC -static -rts/PrimOps_HC_OPTS += -fno-PIC -static -rts/Apply_HC_OPTS += -fno-PIC -static -rts/dist-install/build/AutoApply_HC_OPTS += -fno-PIC -static -endif -endif - -# add CFLAGS for libffi -ifeq "$(UseSystemLibFFI)" "YES" -LIBFFI_CFLAGS = $(addprefix -I,$(FFIIncludeDir)) -rts/Interpreter_CC_OPTS += $(LIBFFI_CFLAGS) -rts/Adjustor_CC_OPTS += $(LIBFFI_CFLAGS) -rts/sm/Storage_CC_OPTS += $(LIBFFI_CFLAGS) -endif - -# inlining warnings happen in Compact -rts/sm/Compact_CC_OPTS += -Wno-inline - -# emits warnings about call-clobbered registers on x86_64 -rts/StgCRun_CC_OPTS += -w - -# On Windows: -rts/win32/ConsoleHandler_CC_OPTS += -w -rts/win32/ThrIOManager_CC_OPTS += -w -# The above warning suppression flags are a temporary kludge. -# While working on this module you are encouraged to remove it and fix -# any warnings in the module. See -# https://gitlab.haskell.org/ghc/ghc/wikis/working-conventions#Warnings -# for details - -# Without this, thread_obj will not be inlined (at least on x86 with GCC 4.1.0) -ifneq "$(CcLlvmBackend)" "YES" -rts/sm/Compact_CC_OPTS += -finline-limit=2500 -endif - -# -O3 helps unroll some loops (especially in copy() with a constant argument). -rts/sm/Evac_CC_OPTS += -funroll-loops -rts/sm/Evac_thr_HC_OPTS += -optc-funroll-loops - - -#----------------------------------------------------------------------------- -# Use system provided libffi - -ifeq "$(UseSystemLibFFI)" "YES" - -rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR=$(FFIIncludeDir) -rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR=$(FFILibDir) -rts_PACKAGE_CPP_OPTS += '-DFFI_LIB=' - -else # UseSystemLibFFI==YES - -rts_PACKAGE_CPP_OPTS += -DFFI_INCLUDE_DIR= -rts_PACKAGE_CPP_OPTS += -DFFI_LIB_DIR= -rts_PACKAGE_CPP_OPTS += '-DFFI_LIB="C$(LIBFFI_NAME)"' - -endif - -ifeq "$(UseLibdw)" "YES" -rts_PACKAGE_CPP_OPTS += -DLIBDW_INCLUDE_DIR=$(LibdwIncludeDir) -rts_PACKAGE_CPP_OPTS += -DLIBDW_LIB_DIR=$(LibdwLibDir) -else -rts_PACKAGE_CPP_OPTS += -DLIBDW_INCLUDE_DIR= -rts_PACKAGE_CPP_OPTS += -DLIBDW_LIB_DIR= -endif - -# ----------------------------------------------------------------------------- -# dependencies - -rts_WAYS_DASHED = $(subst $(space),,$(patsubst %,-%,$(strip $(rts_WAYS)))) -rts_dist-install_depfile_base = rts/dist-install/build/.depend$(rts_WAYS_DASHED) - -rts_dist-install_C_SRCS = $(rts_C_SRCS) $(rts_thr_EXTRA_C_SRCS) -rts_dist-install_S_SRCS = $(rts_S_SRCS) -rts_dist-install_CMM_SRCS = $(rts_CMM_SRCS) -rts_dist-install_C_FILES = $(rts_dist-install_C_SRCS) -rts_dist-install_CXX_FILES = $(rts_dist-install_CXX_SRCS) -rts_dist-install_S_FILES = $(rts_dist-install_S_SRCS) -rts_dist-install_CMM_FILES = $(rts_dist-install_CMM_SRCS) - -# Hack: we define every way-related option here, so that we get (hopefully) -# a superset of the dependencies. To do this properly, we should generate -# a different set of dependencies for each way. Further hack: PROFILING an - -# TICKY_TICKY can't be used together, so we omit TICKY_TICKY for now. -rts_dist-install_MKDEPENDC_OPTS += -DPROFILING -DTHREADED_RTS -DDEBUG - -ifeq "$(USE_DTRACE)" "YES" - -rts_dist-install_MKDEPENDC_OPTS += -Irts/dist-install/build - -endif - -$(eval $(call dependencies,rts,dist-install,1)) - -$(rts_dist-install_depfile_c_asm) : $(includes_dist-install_H_FILES) - -$(rts_dist-install_depfile_c_asm) : $(DTRACEPROBES_H) -ifneq "$(UseSystemLibFFI)" "YES" -$(rts_dist-install_depfile_c_asm) : $(libffi_HEADERS) -endif - -# ----------------------------------------------------------------------------- -# compile dtrace probes if dtrace is supported - -ifeq "$(USE_DTRACE)" "YES" - -rts_CC_OPTS += -DDTRACE -rts_HC_OPTS += -DDTRACE - -# Apple's dtrace (the only one supported by ghc at the moment) uses -# gcc as its preprocessor. If gcc isn't at /usr/bin/gcc, or we need -# to force it to use a different gcc, we need to give the path in -# the option cpppath. - -ifeq "$(TargetOS_CPP)" "darwin" -# Darwin has a flag to tell dtrace which cpp to use. -# Unfortunately, this isn't supported on Solaris (See Solaris Dynamic Tracing -# Guide, Chapter 16, for the configuration variables available on Solaris) -DTRACE_FLAGS = -x cpppath=$(CC) -endif - -DTRACEPROBES_SRC = rts/RtsProbes.d -$(DTRACEPROBES_H): $(DTRACEPROBES_SRC) $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) | $$(dir $$@)/. - "$(DTRACE)" $(filter -I%,$(rts_dist-install_DIST_CC_OPTS)) -C $(DTRACE_FLAGS) -h -o $@ -s $< -endif - -# ----------------------------------------------------------------------------- -# The RTS package config - -# If -DDEBUG is in effect, adjust package conf accordingly.. -ifneq "$(strip $(filter -optc-DDEBUG,$(GhcRtsHcOpts)))" "" -rts_PACKAGE_CPP_OPTS += -DDEBUG -endif - -ifeq "$(HaveLibMingwEx)" "YES" -rts_PACKAGE_CPP_OPTS += -DHAVE_LIBMINGWEX -endif - -rts_dist-install_PACKAGE_CPP_OPTS = \ - $(rts_PACKAGE_CPP_OPTS) \ - $(addprefix -Irts/,$(rts_dist-install_DIST_INCLUDE_DIRS)) - -$(eval $(call manual-package-config,rts,dist-install)) - -rts/dist-install/package.conf.inplace : $(includes_dist-install_H_FILES) -rts/dist-install/package.conf.install : $(includes_dist-install_H_FILES) - -# ----------------------------------------------------------------------------- -# installing - -RTS_INSTALL_LIBS += $(ALL_RTS_LIBS) -ifneq "$(UseSystemLibFFI)" "YES" -RTS_INSTALL_LIBS += $(wildcard rts/dist-install/build/lib$(LIBFFI_NAME)*$(soext)*) -RTS_INSTALL_LIBS += $(foreach w,$(filter-out %dyn,$(rts_WAYS)),rts/dist-install/build/libC$(LIBFFI_NAME)$($w_libsuf)) -endif - -ifneq "$(UseSystemLibFFI)" "YES" -install: install_libffi_headers -endif - -.PHONY: install_libffi_headers -install_libffi_headers : - $(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)" - $(INSTALL_HEADER) $(INSTALL_OPTS) $(libffi_HEADERS) "$(DESTDIR)$(ghcheaderdir)/" - -# ----------------------------------------------------------------------------- -# cleaning - -$(eval $(call clean-target,rts,dist-install,rts/dist-install)) - -BINDIST_EXTRAS += rts/package.conf.in diff --git a/rts/include/ghc.mk b/rts/include/ghc.mk deleted file mode 100644 index d4a765ab8d..0000000000 --- a/rts/include/ghc.mk +++ /dev/null @@ -1,303 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# -# Header files built from the configure script's findings -# -includes_1_H_CONFIG = rts/dist-install/build/include/ghcautoconf.h -includes_2_H_CONFIG = $(includes_1_H_CONFIG) - -includes_1_H_PLATFORM = rts/dist-install/build/include/ghcplatform.h -includes_2_H_PLATFORM = $(includes_1_H_PLATFORM) - -includes_INCLUDE_DIRS = . -# "includes" isn't really a separate component, but just part of the RTS that -# is in a separate ghc.mk for historical reasons. The ../dist-install puts the -# build products with the rest of the RTS's. -includes_dist-install_INCLUDE_DIRS = ../dist-install/build/include - -includes_dist-install_DIST_INCLUDE_DIRS = \ - $(includes_INCLUDE_DIRS) \ - $(includes_dist-install_INCLUDE_DIRS) - -# -# All header files are in rts/include/{one of these subdirectories} -# -includes_H_SUBDIRS += . -includes_H_SUBDIRS += rts -includes_H_SUBDIRS += rts/prof -includes_H_SUBDIRS += rts/storage -includes_H_SUBDIRS += stg - -includes_H_FILES := $(wildcard $(patsubst %,rts/include/%/*.h,$(includes_H_SUBDIRS))) -# This isn't necessary, but it makes the paths look a little prettier -includes_H_FILES := $(subst /./,/,$(includes_H_FILES)) - -includes_H_FILES_GENERATED = \ - ghcautoconf.h \ - ghcplatform.h - -# Unlike above, include generated files. We still need the previous list -# without the generated files separately and not just as part of this due to -# lingering issues like the derived constants generation snooping the RTS -# headers. -includes_dist_H_FILES = \ - $(includes_H_FILES) -includes_dist-install_H_FILES = \ - $(includes_H_FILES) \ - $(includes_dist-install_H_FILES_GENERATED) -includes_dist-install_H_FILES_GENERATED = \ - $(patsubst %,rts/dist-install/build/include/%,$(includes_H_FILES_GENERATED)) - -# -# Options -# - -includes_CC_OPTS += $(SRC_CC_OPTS) -includes_CC_OPTS += $(SRC_CC_WARNING_OPTS) -includes_CC_OPTS += $(CONF_CC_OPTS_STAGE1) - -ifeq "$(GhcUnregisterised)" "YES" -includes_CC_OPTS += -DUSE_MINIINTERPRETER -endif - -includes_CC_OPTS += $(addprefix -Irts/,$(rts_dist-install_DIST_INCLUDE_DIRS)) - -ifneq "$(GhcWithSMP)" "YES" -includes_CC_OPTS += -DNOSMP -endif - -ifneq "$(BINDIST)" "YES" - -define includesHeaderConfig -# $1 = stage -$$(includes_$1_H_CONFIG) : mk/config.h mk/config.mk rts/include/ghc.mk | $$$$(dir $$$$@)/. - $$(call removeFiles,$$@) - @echo "Creating $$@..." - @echo "#if !defined(__GHCAUTOCONF_H__)" > $$@ - @echo "#define __GHCAUTOCONF_H__" >> $$@ -# -# Copy the contents of mk/config.h, turning '#define PACKAGE_FOO -# "blah"' into '/* #undef PACKAGE_FOO */' to avoid clashes. -# - @sed \ - -e 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$$$$,\1/* #undef \2 */,' \ - -e '/__GLASGOW_HASKELL/d' \ - -e '/REMOVE ME/d' \ - mk/config.h \ - >> $$@ -# - @echo "#endif /* __GHCAUTOCONF_H__ */" >> $$@ - @echo "Done." - -endef - -$(eval $(call includesHeaderConfig,0)) -$(eval $(call includesHeaderConfig,1)) - -BuildPlatform_0_CPP = $(BuildPlatform_CPP) -BuildPlatform_1_CPP = $(HostPlatform_CPP) -BuildPlatform_2_CPP = $(TargetPlatform_CPP) - -HostPlatform_0_CPP = $(HostPlatform_CPP) -HostPlatform_1_CPP = $(TargetPlatform_CPP) -HostPlatform_2_CPP = $(TargetPlatform_CPP) - -BuildArch_0_CPP = $(BuildArch_CPP) -BuildArch_1_CPP = $(HostArch_CPP) -BuildArch_2_CPP = $(TargetArch_CPP) - -HostArch_0_CPP = $(HostArch_CPP) -HostArch_1_CPP = $(TargetArch_CPP) -HostArch_2_CPP = $(TargetArch_CPP) - -BuildOS_0_CPP = $(BuildOS_CPP) -BuildOS_1_CPP = $(HostOS_CPP) -BuildOS_2_CPP = $(TargetOS_CPP) - -HostOS_0_CPP = $(HostOS_CPP) -HostOS_1_CPP = $(TargetOS_CPP) -HostOS_2_CPP = $(TargetOS_CPP) - -BuildVendor_0_CPP = $(BuildVendor_CPP) -BuildVendor_1_CPP = $(HostVendor_CPP) -BuildVendor_2_CPP = $(TargetVendor_CPP) - -HostVendor_0_CPP = $(HostVendor_CPP) -HostVendor_1_CPP = $(TargetVendor_CPP) -HostVendor_2_CPP = $(TargetVendor_CPP) - -define includesHeaderPlatform -# $1 = stage -$$(includes_$1_H_PLATFORM) : rts/include/ghc.mk rts/include/Makefile | $$$$(dir $$$$@)/. - $$(call removeFiles,$$@) - @echo "Creating $$@..." - @echo "#if !defined(__GHCPLATFORM_H__)" > $$@ - @echo "#define __GHCPLATFORM_H__" >> $$@ - @echo >> $$@ - @echo "#define BuildPlatform_TYPE $(BuildPlatform_$1_CPP)" >> $$@ - @echo "#define HostPlatform_TYPE $(HostPlatform_$1_CPP)" >> $$@ - @echo >> $$@ - @echo "#define $(BuildPlatform_$1_CPP)_BUILD 1" >> $$@ - @echo "#define $(HostPlatform_$1_CPP)_HOST 1" >> $$@ - @echo >> $$@ - @echo "#define $(BuildArch_$1_CPP)_BUILD_ARCH 1" >> $$@ - @echo "#define $(HostArch_$1_CPP)_HOST_ARCH 1" >> $$@ - @echo "#define BUILD_ARCH \"$(BuildArch_$1_CPP)\"" >> $$@ - @echo "#define HOST_ARCH \"$(HostArch_$1_CPP)\"" >> $$@ - @echo >> $$@ - @echo "#define $(BuildOS_$1_CPP)_BUILD_OS 1" >> $$@ - @echo "#define $(HostOS_$1_CPP)_HOST_OS 1" >> $$@ - @echo "#define BUILD_OS \"$(BuildOS_$1_CPP)\"" >> $$@ - @echo "#define HOST_OS \"$(HostOS_$1_CPP)\"" >> $$@ - @echo >> $$@ - @echo "#define $(BuildVendor_$1_CPP)_BUILD_VENDOR 1" >> $$@ - @echo "#define $(HostVendor_$1_CPP)_HOST_VENDOR 1" >> $$@ - @echo "#define BUILD_VENDOR \"$(BuildVendor_$1_CPP)\"" >> $$@ - @echo "#define HOST_VENDOR \"$(HostVendor_$1_CPP)\"" >> $$@ - @echo >> $$@ -ifeq "$$(GhcUnregisterised)" "YES" - @echo "#define UnregisterisedCompiler 1" >> $$@ -endif - @echo >> $$@ - @echo "#endif /* __GHCPLATFORM_H__ */" >> $$@ - @echo "Done." -endef - -endif - -$(eval $(call includesHeaderPlatform,0)) -$(eval $(call includesHeaderPlatform,1)) - -# ----------------------------------------------------------------------------- -# Settings - -# These settings are read by GHC at runtime, so as to not cause spurious -# rebuilds. -# See Note [tooldir: How GHC finds mingw on Windows] - -includes_SETTINGS = rts/dist-install/build/include/settings - -# N.B. this is duplicated in hadrian/bindist/Makefile. -$(includes_SETTINGS) : rts/include/Makefile | $$(dir $$@)/. - $(call removeFiles,$@) - @echo '[("GCC extra via C opts", "$(GccExtraViaCOpts)")' >> $@ - @echo ',("C compiler command", "$(SettingsCCompilerCommand)")' >> $@ - @echo ',("C compiler flags", "$(SettingsCCompilerFlags)")' >> $@ - @echo ',("C++ compiler command", "$(SettingsCxxCompilerCommand)")' >> $@ - @echo ',("C++ compiler flags", "$(SettingsCxxCompilerFlags)")' >> $@ - @echo ',("C compiler link flags", "$(SettingsCCompilerLinkFlags)")' >> $@ - @echo ',("C compiler supports -no-pie", "$(SettingsCCompilerSupportsNoPie)")' >> $@ - @echo ',("Haskell CPP command", "$(SettingsHaskellCPPCommand)")' >> $@ - @echo ',("Haskell CPP flags", "$(SettingsHaskellCPPFlags)")' >> $@ - @echo ',("ld command", "$(SettingsLdCommand)")' >> $@ - @echo ',("ld flags", "$(SettingsLdFlags)")' >> $@ - @echo ',("ld supports compact unwind", "$(LdHasNoCompactUnwind)")' >> $@ - @echo ',("ld supports filelist", "$(LdHasFilelist)")' >> $@ - @echo ',("ld is GNU ld", "$(LdIsGNULd)")' >> $@ - @echo ',("Merge objects command", "$(SettingsMergeObjectsCommand)")' >> $@ - @echo ',("Merge objects flags", "$(SettingsMergeObjectsFlags)")' >> $@ - @echo ',("ar command", "$(SettingsArCommand)")' >> $@ - @echo ',("ar flags", "$(ArArgs)")' >> $@ - @echo ',("ar supports at file", "$(ArSupportsAtFile)")' >> $@ - @echo ',("ar supports -L", "$(ArSupportsDashL)")' >> $@ - @echo ',("ranlib command", "$(SettingsRanlibCommand)")' >> $@ - @echo ',("otool command", "$(SettingsOtoolCommand)")' >> $@ - @echo ',("install_name_tool command", "$(SettingsInstallNameToolCommand)")' >> $@ - @echo ',("touch command", "$(SettingsTouchCommand)")' >> $@ - @echo ',("dllwrap command", "$(SettingsDllWrapCommand)")' >> $@ - @echo ',("windres command", "$(SettingsWindresCommand)")' >> $@ - @echo ',("unlit command", "$$topdir/bin/$(utils/unlit_dist_PROG)")' >> $@ - @echo ',("cross compiling", "$(CrossCompiling)")' >> $@ - @echo ',("target platform string", "$(TARGETPLATFORM)")' >> $@ - @echo ',("target os", "$(HaskellTargetOs)")' >> $@ - @echo ',("target arch", "$(HaskellTargetArch)")' >> $@ - @echo ',("target word size", "$(TargetWordSize)")' >> $@ - @echo ',("target word big endian", "$(TargetWordBigEndian)")' >> $@ - @echo ',("target has GNU nonexec stack", "$(TargetHasGnuNonexecStack)")' >> $@ - @echo ',("target has .ident directive", "$(TargetHasIdentDirective)")' >> $@ - @echo ',("target has subsections via symbols", "$(TargetHasSubsectionsViaSymbols)")' >> $@ - @echo ',("target has RTS linker", "$(TargetHasRTSLinker)")' >> $@ - @echo ',("target has libm", "$(TargetHasLibm)")' >> $@ - @echo ',("Unregisterised", "$(GhcUnregisterised)")' >> $@ - @echo ',("LLVM target", "$(LLVMTarget_CPP)")' >> $@ - @echo ',("LLVM llc command", "$(SettingsLlcCommand)")' >> $@ - @echo ',("LLVM opt command", "$(SettingsOptCommand)")' >> $@ - @echo ',("LLVM clang command", "$(SettingsClangCommand)")' >> $@ - @echo ',("Use inplace MinGW toolchain", "$(SettingsUseDistroMINGW)")' >> $@ - @echo - @echo ',("Use interpreter", "$(GhcWithInterpreter)")' >> $@ - @echo ',("Support SMP", "$(GhcWithSMP)")' >> $@ - @echo ',("RTS ways", "$(GhcRTSWays)")' >> $@ - @echo ',("Tables next to code", "$(TablesNextToCode)")' >> $@ - @echo ',("Leading underscore", "$(LeadingUnderscore)")' >> $@ - @echo ',("Use LibFFI", "$(UseLibffiForAdjustors)")' >> $@ - @echo ',("RTS expects libdw", "$(GhcRtsWithLibdw)")' >> $@ - @echo "]" >> $@ - - -# --------------------------------------------------------------------------- -# Make DerivedConstants.h for the compiler - -includes_DERIVEDCONSTANTS = rts/dist-install/build/include/DerivedConstants.h -includes_EVENTLOG_CONSTANTS = rts/dist-install/build/include/rts/EventLogConstants.h -includes_EVENT_TYPES = rts/dist-install/build/include/rts/EventTypes.h - -DERIVE_CONSTANTS_FLAGS_FOR_HEADER += --gcc-program "$(CC)" -DERIVE_CONSTANTS_FLAGS_FOR_HEADER += $(addprefix --gcc-flag$(space),$(includes_CC_OPTS) -fcommon) -DERIVE_CONSTANTS_FLAGS_FOR_HEADER += --nm-program "$(NM)" -ifneq "$(OBJDUMP)" "" -DERIVE_CONSTANTS_FLAGS_FOR_HEADER += --objdump-program "$(OBJDUMP)" -endif -DERIVE_CONSTANTS_FLAGS_FOR_HEADER += --target-os "$(TargetOS_CPP)" - -ifneq "$(BINDIST)" "YES" -$(includes_DERIVEDCONSTANTS): $$(includes_H_FILES) $$(rts_H_FILES) - -$(includes_DERIVEDCONSTANTS): $(deriveConstants_INPLACE) $(includes_1_H_CONFIG) $(includes_1_H_PLATFORM) | $$(dir $$@)/. - $< --gen-header -o $@ --tmpdir $(dir $@) $(DERIVE_CONSTANTS_FLAGS_FOR_HEADER) - -$(includes_EVENTLOG_CONSTANTS): rts/gen_event_types.py - mkdir -p $(dir $@) - ${PYTHON} $< --event-types-defines=$@ - -$(includes_EVENT_TYPES): rts/gen_event_types.py - mkdir -p $(dir $@) - ${PYTHON} $< --event-types-array=$@ - -includes/EventLog.h : $(includes_EVENTLOG_CONSTANTS) $(includes_EVENT_TYPES) -endif - -includes_dist-install_H_FILES_GENERATED += $(includes_DERIVEDCONSTANTS) -includes_dist-install_H_FILES_GENERATED += $(includes_EVENTLOG_CONSTANTS) -includes_dist-install_H_FILES_GENERATED += $(includes_EVENT_TYPES) - -# --------------------------------------------------------------------------- -# Install all header files - -$(eval $(call clean-target,includes,,$(includes_dist-install_H_FILES_GENERATED))) - -$(eval $(call all-target,includes,$(includes_dist-install_H_FILES_GENERATED))) - -install: install_includes - -.PHONY: install_includes -install_includes : $(includes_dist-install_H_FILES_GENERATED) - $(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)" - $(foreach d,$(includes_H_SUBDIRS), \ - $(INSTALL_DIR) "$(DESTDIR)$(ghcheaderdir)/$d" && \ - $(INSTALL_HEADER) $(INSTALL_OPTS) rts/include/$d/*.h "$(DESTDIR)$(ghcheaderdir)/$d/" && \ - ) true - $(INSTALL_HEADER) $(INSTALL_OPTS) \ - $(includes_dist-install_H_FILES_GENERATED) \ - "$(DESTDIR)$(ghcheaderdir)/" - diff --git a/rules/add-dependency.mk b/rules/add-dependency.mk deleted file mode 100644 index 1b5a666e86..0000000000 --- a/rules/add-dependency.mk +++ /dev/null @@ -1,15 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2010 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define add-dependency -$1: $2 -endef diff --git a/rules/all-target.mk b/rules/all-target.mk deleted file mode 100644 index 52fbc02b1e..0000000000 --- a/rules/all-target.mk +++ /dev/null @@ -1,18 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define all-target # args: $1 = dir, $2 = deps -all : all_$1 -.PHONY: all_$1 -all_$1 : $2 -endef - diff --git a/rules/bindist.mk b/rules/bindist.mk deleted file mode 100644 index af3b144222..0000000000 --- a/rules/bindist.mk +++ /dev/null @@ -1,32 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -# Add files to the bindist-list. Invoke like this: -# -# $(eval $(call bindist-list,utils/genapply,ghc.mk)) - -define bindist-list -# $1 = name -# $2 = files - -.PHONY: bindist-list_$1 -bindist-list: bindist-list_$1 - -bindist-list_$1: - $(foreach i,$2,\ - $(call make-command,\ - for f in $i; do echo $(BIN_DIST_NAME)/$$$$f >> bindist-list; done \ - ) \ - ) -endef - diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk deleted file mode 100644 index cc438c80eb..0000000000 --- a/rules/build-dependencies.mk +++ /dev/null @@ -1,161 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define build-dependencies -$(call trace, build-dependencies($1,$2,$3)) -$(call profStart, build-dependencies($1,$2,$3)) -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -$1_$2_depfile_haskell = $$($1_$2_depfile_base).haskell -$1_$2_depfile_c_asm = $$($1_$2_depfile_base).c_asm - -$1_$2_C_FILES_DEPS = $$(filter-out $$($1_$2_C_FILES_NODEPS),$$($1_$2_C_FILES)) -$1_$2_CXX_FILES_DEPS = $$(filter-out $$($1_$2_CXX_FILES_NODEPS),$$($1_$2_CXX_FILES)) - -$1_$2_MKDEPENDHS_FLAGS = -dep-makefile $$($1_$2_depfile_haskell).tmp $$(foreach way,$$($1_$2_WAYS),-dep-suffix "$$(patsubst %o,%,$$($$(way)_osuf))") -$1_$2_MKDEPENDHS_FLAGS += -include-pkg-deps -$1_$2_MKDEPENDHS_FLAGS += $(addprefix -I,$($1_INCLUDE_DIRS)) - -ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES" - -# Some of the Haskell files (e.g. utils/hsc2hs/Main.hs) (directly or -# indirectly) include the generated includes files. -$$($1_$2_depfile_haskell) : $$(includes_$3_H_CONFIG) $$(includes_$3_H_PLATFORM) - -$$($1_$2_depfile_haskell) : $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS) $$$$($1_$2_HC_MK_DEPEND_DEP) | $$$$(dir $$$$@)/. - $$(call removeFiles,$$@.tmp) -ifneq "$$($1_$2_HS_SRCS)" "" - "$$($1_$2_HC_MK_DEPEND)" -M \ - $$($1_$2_$$(firstword $$($1_$2_WAYS))_MOST_DIR_HC_OPTS) \ - $$($1_$2_MKDEPENDHS_FLAGS) \ - $$($1_$2_HS_SRCS) -endif - echo "$1_$2_depfile_haskell_EXISTS = YES" >> $$@.tmp -ifneq "$$($1_$2_SLASH_MODS)" "" - for dir in $$(sort $$(foreach mod,$$($1_$2_SLASH_MODS),$1/$2/build/$$(dir $$(mod)))); do \ - if test ! -d $$$$dir; then mkdir -p $$$$dir; fi \ - done -endif -# Some packages are from the bootstrapping compiler, so are not -# within the build tree. On Windows this causes a problem as they look -# like bad rules, due to the two colons, so we filter them out. - grep -v ' : [a-zA-Z]:/' $$@.tmp > $$@.tmp2 -# Insert the calls to hi-rule. Basically, we look for the -# Foo.dyn_o Foo.o : Foo.hs -# lines, and create corresponding hi-rule lines -# (eval (call hi-rule,Foo.dyn_hi Foo.hi : %hi: %o Foo.hs)) - sed -e '/hs$$$$/ p' -e '/hs$$$$/ s/o /hi /g' \ - -e '/hs$$$$/ s/:/ : %hi: %o /' \ - -e '/hs$$$$/ s/^/$$$$(eval $$$$(call hi-rule,/' \ - -e '/hs$$$$/ s/$$$$/))/' \ - -e '/hs-boot$$$$/ p' -e '/hs-boot$$$$/ s/o-boot /hi-boot /g' \ - -e '/hs-boot$$$$/ s/:/ : %hi-boot: %o-boot /' \ - -e '/hs-boot$$$$/ s/^/$$$$(eval $$$$(call hi-rule,/' \ - -e '/hs-boot$$$$/ s/$$$$/))/' \ - $$@.tmp2 > $$@ -# Some of the C files (directly or indirectly) include the generated -# includes files. -$$($1_$2_depfile_c_asm) : $$(includes_$3_H_CONFIG) $$(includes_$3_H_PLATFORM) - -$$($1_$2_depfile_c_asm) : $$($1_$2_C_FILES_DEPS) $$($1_$2_CXX_FILES_DEPS) $$($1_$2_S_FILES) $$($1_$2_CMM_FILES) | $$$$(dir $$$$@)/. - $$(call removeFiles,$$@.tmp) -ifneq "$$(strip $$($1_$2_C_FILES_DEPS) $$($1_$2_CXX_FILES_DEPS) $$($1_$2_S_FILES)) $$($1_$2_CMM_FILES))" "" -# We ought to actually do this for each way in $$($1_$2_WAYS), but then -# it takes a long time to make the C deps for the RTS (30 seconds rather -# than 3), so instead we just pass the list of ways in and let addCFileDeps -# copy the deps for each way on the assumption that they are the same - $$(foreach f,$$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES) $$($1_$2_CMM_FILES), \ - $$(call addCFileDeps,$1,$2,$$($1_$2_depfile_c_asm),$$f,$$($1_$2_WAYS),"c")) - $$(foreach f,$$($1_$2_CXX_FILES_DEPS), \ - $$(call addCFileDeps,$1,$2,$$($1_$2_depfile_c_asm),$$f,$$($1_$2_WAYS),"c++")) - $$(call removeFiles,$$@.bit) -endif - echo "$1_$2_depfile_c_asm_EXISTS = YES" >> $$@.tmp - mv $$@.tmp $$@ - -endif # NO_GENERATED_MAKEFILE_RULES - -# Note sed magic above: mkdependC can't do -odir stuff, so we have to -# munge the dependencies it generates to refer to the correct targets. - -$(call profEnd, build-dependencies($1,$2,$3)) -endef - -# This comment is outside the "define addCFileDeps" as that definition -# is a list of command lines, and if it is inside it then we pass this -# comment to the shell every time we call the definition. -# $1 = dir -# $2 = distdir -# $3 = depfile -# $4 = file -# $5 = ways -# $6 = lang (c or c++) -# -# The formatting of this definition (e.g. the blank line above) is -# important, in order to get make to generate the right makefile code. -# -# 's|\\|/|g' -# We first normalise all slashes to be forward slashes. Note that -# $(TOP) also uses forward slashes. -# 's| /$$| \\|' -# But now we need to fix the line continuation characters that we -# just broke. -# "1s|\.o|\.$($w_osuf)|" -# We will have dependencies for .o files, so we need to fix them up -# for the right object suffix for the way we're doing -# "1s|^|$(dir $4)|" -# We always get deps for just foo.o when the file we're making is -# a/b/c/foo.o, so we need to prepend the directory of the source file -# "1s|$1/|$1/$2/build/|" -# Well, almost. We actually need to insert e.g. "dist/build" in the -# middle of that directory -# "1s|$2/build/$2/build|$2/build|g" -# But some source files, e.g. sm/Evac_thr.c, are also inside the -# "dist/build" directory, so now we've just made -# "dist/build/dist/build", so we need to remove the duplication -# again -# "s|$(TOP)/||g$(CASE_INSENSITIVE_SED)" -# Finally, when making deps for packages like ghc stage2, we have -# some include paths for packages registered in the in-tree package -# database. These include paths are full (i.e. not relative) paths, -# which means that the "cpp -MM" output uses full paths in some cases. -# This causes 2 problems: -# * they don't match up with the rules to rebuild the files, where -# appropriate. -# * on Windows, make interprets the colon in c:/foo/bar.h as make -# syntax. -# So we sed off $(TOP). Unfortunately, on Windows, the case for the -# drive letter is sometimes different in what $(TOP) starts with, and -# what the path in the package database starts with. We therefore -# need to do the substitution case-insensitively on Windows. But -# the s///i modifier isn't portable, so we set CASE_INSENSITIVE_SED -# to "i" on Windows and "" on any other platform. - -# We use this not only for .c files, but also for .S and .cmm files. -# As gcc doesn't know what a .cmm file is, it treats it as a linker -# input and ignores it. We therefore tell gcc that all files are C -# files with "-x c" so that it actually processes them all. - -define addCFileDeps - - $(CPP) $($1_$2_MKDEPENDC_OPTS) $($1_$2_$(firstword $($1_$2_WAYS))_ALL_CC_OPTS) $($(basename $4)_CC_OPTS) -MM -x $6 $4 -MF $3.bit - $(foreach w,$5,sed -e 's|\\|/|g' -e 's| /$$| \\|' -e "1s|\.o|\.$($w_osuf)|" -e "1s|^|$(dir $4)|" -e "1s|$1/|$1/$2/build/|" -e "1s|$2/build/$2/build|$2/build|g" -e "s|^$(TOP)/||g$(CASE_INSENSITIVE_SED)" $3.bit >> $3.tmp &&) true -endef - -ifeq "$(Windows_Host)" "YES" -CASE_INSENSITIVE_SED = i -else -CASE_INSENSITIVE_SED = -endif - diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk deleted file mode 100644 index a8c9c12823..0000000000 --- a/rules/build-package-data.mk +++ /dev/null @@ -1,145 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define build-package-data -$(call trace, build-package-data($1,$2,$3)) -$(call profStart, build-package-data($1,$2,$3)) -# args: -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -ifeq "$(V)" "0" -$1_$2_CONFIGURE_OPTS += -v0 --configure-option=--quiet - -# Cabal always passes --with-compiler and --with-gcc to library configure -# scripts, resulting in the following useless (for us) warning in the logs: -# "configure: WARNING: unrecognized options: --with-compiler, --with-gcc" -$1_$2_CONFIGURE_OPTS += --configure-option=--disable-option-checking - -$1_$2_GHC_PKG_OPTS += -v0 -endif - -$1_$2_CONFIGURE_OPTS += --disable-library-for-ghci -ifeq "$$(filter v,$$($1_$2_WAYS))" "v" -$1_$2_CONFIGURE_OPTS += --enable-library-vanilla -# Build the GHCi lib even if GHCi is dynamic (and therefore won't use -# these by default), because they will be used by -# (a) ghci -fexternal-interpreter -# (b) statically-linked binaries that use the GHC package -ifeq "$$(GhcWithInterpreter)" "YES" -$1_$2_CONFIGURE_OPTS += --enable-library-for-ghci -endif -else -$1_$2_CONFIGURE_OPTS += --disable-library-vanilla -endif - -ifeq "$$(filter p,$$($1_$2_WAYS))" "p" -$1_$2_CONFIGURE_OPTS += --enable-library-profiling -else -$1_$2_CONFIGURE_OPTS += --disable-library-profiling -endif - -ifeq "$$(filter dyn,$$($1_$2_WAYS))" "dyn" -$1_$2_CONFIGURE_OPTS += --enable-shared -else -$1_$2_CONFIGURE_OPTS += --disable-shared -endif - -ifeq "$$(HSCOLOUR_SRCS)" "YES" -$1_$2_CONFIGURE_OPTS += --with-hscolour="$$(HSCOLOUR_CMD)" -endif - -# We filter out -Werror from SRC_CC_OPTS, because when configure tests -# for a feature it may not generate warning-free C code, and thus may -# think that the feature doesn't exist if -Werror is on. -# -# Do `-iquote $(TOP)/$1` so package configure scripts can access their own source. -$1_$2_CONFIGURE_CFLAGS = $$(filter-out -Werror,$$(SRC_CC_OPTS)) $$(CONF_CC_OPTS_STAGE$3) $$($1_CC_OPTS) $$($1_$2_CC_OPTS) $$(SRC_CC_WARNING_OPTS) -iquote $(TOP)/$1 -$1_$2_CONFIGURE_LDFLAGS = $$(SRC_LD_OPTS) $$($1_LD_OPTS) $$($1_$2_LD_OPTS) -$1_$2_CONFIGURE_CPPFLAGS = $$(SRC_CPP_OPTS) $$(CONF_CPP_OPTS_STAGE$3) $$($1_CPP_OPTS) $$($1_$2_CPP_OPTS) - -$1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$($1_$2_CONFIGURE_CFLAGS)" -$1_$2_CONFIGURE_OPTS += --configure-option=LDFLAGS="$$($1_$2_CONFIGURE_LDFLAGS)" -$1_$2_CONFIGURE_OPTS += --configure-option=CPPFLAGS="$$($1_$2_CONFIGURE_CPPFLAGS)" - -# Also pass these as gcc-options, because Cabal uses them to check for -# the existence of foreign libraries. -$1_$2_CONFIGURE_OPTS += --gcc-options="$$($1_$2_CONFIGURE_CFLAGS) $$($1_$2_CONFIGURE_LDFLAGS)" - -ifneq "$$(ICONV_INCLUDE_DIRS)" "" -$1_$2_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="$$(ICONV_INCLUDE_DIRS)" -endif - -ifneq "$$(ICONV_LIB_DIRS)" "" -$1_$2_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="$$(ICONV_LIB_DIRS)" -endif - -ifneq "$$(GMP_INCLUDE_DIRS)" "" -$1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="$$(GMP_INCLUDE_DIRS)" -endif - -ifneq "$$(GMP_LIB_DIRS)" "" -$1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="$$(GMP_LIB_DIRS)" -endif - -ifeq "$$(GMP_PREFER_FRAMEWORK)" "YES" -$1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp-framework-preferred -endif - -ifeq "$$(GMP_FORCE_INTREE)" "YES" -$1_$2_CONFIGURE_OPTS += --configure-option=--with-intree-gmp -endif - -ifeq "$$(GMP_ENABLED)" "YES" -$1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp -endif - - -ifneq "$$(CURSES_LIB_DIRS)" "" -$1_$2_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="$$(CURSES_LIB_DIRS)" -endif - -$1_$2_CONFIGURE_OPTS += --configure-option=--host=$(TargetPlatformFull) - -ifeq "$3" "0" -$1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS) -endif - -$1_$2_CONFIGURE_OPTS += --with-gcc="$$(CC_STAGE$3)" -$1_$2_CONFIGURE_OPTS += --with-ld="$$(LD_STAGE$3)" -$1_$2_CONFIGURE_OPTS += --with-ar="$$(AR_STAGE$3)" -$1_$2_CONFIGURE_OPTS += $$(if $$(ALEX),--with-alex="$$(ALEX)") -$1_$2_CONFIGURE_OPTS += $$(if $$(HAPPY),--with-happy="$$(HAPPY)") - -$1_$2_PKGDATA = $1/$2/package-data.mk - -ifneq "$$(BINDIST)" "YES" -ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES" -$1/$2/inplace-pkg-config : $$($1_$2_PKGDATA) -$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/cabal_macros.h : $$($1_$2_PKGDATA) - -# This rule configures the package, generates the package-data.mk file -# for our build system, and registers the package for use in-place in -# the build tree. -$$($1_$2_PKGDATA) : $$$$(ghc-cabal_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_CONFIG_DEP) - "$$(ghc-cabal_INPLACE)" configure $1 $2 --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -ifeq "$$($1_$2_PROG)" "" - $$(call cmd,$1_$2_GHC_PKG) update -v0 --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config -endif -endif # NO_GENERATED_MAKEFILE_RULES -endif # BINDIST - -PACKAGE_DATA_MKS += $$($1_$2_PKGDATA) - -$(call profEnd, build-package-data($1,$2,$3)) -endef diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk deleted file mode 100644 index 2f7af28ecb..0000000000 --- a/rules/build-package-way.mk +++ /dev/null @@ -1,151 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define build-package-way # $1 = dir, $2 = distdir, $3 = way, $4 = stage -$(call trace, build-package-way($1,$2,$3)) -$(call profStart, build-package-way($1,$2,$3)) - -$(call distdir-way-opts,$1,$2,$3,$4) -$(call hs-suffix-way-rules,$1,$2,$3) - -$(call hs-objs,$1,$2,$3) - -# The .a/.so library file, indexed by two different sets of vars: -# the first is indexed by the dir, distdir and way -# the second is indexed by the package id, distdir and way -$1_$2_$3_LIB_FILE = libHS$$($1_$2_COMPONENT_ID)$(subst .,%,$$($3_libsuf)) -$1_$2_$3_LIB = $1/$2/build/$$($1_$2_$3_LIB_FILE) -$$($1_$2_COMPONENT_ID)_$2_$3_LIB = $$($1_$2_$3_LIB) - -# Note [inconsistent distdirs] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# hack: the DEPS_LIBS mechanism assumes that the distdirs for packages -# that depend on each other are the same, but that is not the case for -# ghc where we use stage1/stage2 rather than dist/dist-install. -# Really we should use a consistent scheme for distdirs, but in the -# meantime we work around it by defining ghc-_dist-install_way_LIB: -# -# A similar hack is applied to the PROGRAM_DEP_LIB mechanism in -# rules/build-package.mk. -ifeq "$$($1_PACKAGE) $2" "ghc stage2" -$$($1_$2_COMPONENT_ID)_dist-install_$3_LIB = $$($1_$2_$3_LIB) -endif - -# All the .a/.so library file dependencies for this library. -# -# The $(subst stage2,dist-install,..) is needed due to Note -# [inconsistent distdirs]. -# -# NB: Use DEP_COMPONENT_IDS for the /directory/ parameter. -$1_$2_$3_DEPS_LIBS=$$(foreach dep,$$($1_$2_DEP_COMPONENT_IDS),$$($$(dep)_$(subst stage2,dist-install,$2)_$3_LIB)) - -$1_$2_$3_NON_HS_OBJS = $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_CXX_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS) -$1_$2_$3_ALL_OBJS = $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS) - -ifeq "$3" "dyn" - -# Link a dynamic library -# On windows we have to supply the extra libs this one links to when building it. -ifeq "$$(TargetOS_CPP)" "mingw32" -$$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS) - $$(call build-dll,$1,$2,$3,-L$1/$2/build,,$$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS),"$$@","NO","$$($1_PACKAGE)","$$($1_$2_VERSION)") - -else # ifneq "$$(TargetOS_CPP)" "mingw32" -$$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) $$($1_$2_$3_GHC_LD_OPTS) $$($1_$2_$3_ALL_OBJS) \ - -shared -dynamic -dynload deploy \ - $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) $$(addprefix -L,$$($1_$2_EXTRA_LIBDIRS)) \ - -no-auto-link-packages \ - -o $$@ -endif # "$$(TargetOS_CPP)" "mingw32" - -else # ifneq "$3" "dyn" - -# Build the ordinary .a library -$$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) - $$(call removeFiles,$$@ $$@.contents) - echo $$($1_$2_$3_ALL_OBJS) >> $$@.contents -ifeq "$$($1_$2_ArSupportsAtFile)" "YES" - $$(call cmd,$1_$2_AR) $$($1_$2_AR_OPTS) $$($1_$2_EXTRA_AR_ARGS) $$@ @$$@.contents -else - "$$(XARGS)" $$(XARGS_OPTS) "$$($1_$2_AR)" $$($1_$2_AR_OPTS) $$($1_$2_EXTRA_AR_ARGS) $$@ < $$@.contents -endif - $$(call removeFiles,$$@.contents) - -endif # "$3" "dyn" - -$(call all-target,$1_$2,all_$1_$2_$3) -$(call all-target,$1_$2_$3,$$($1_$2_$3_LIB)) - -# Don't put bootstrapping packages in the bindist -ifneq "$4" "0" -BINDIST_HI += $$($1_$2_$3_HI) -BINDIST_LIBS += $$($1_$2_$3_LIB) -# Need to put the split libs and import libraries here -endif - -ifeq "$$($1_$2_SplitSections)" "YES" -ifeq "$(LdIsGNULd)" "YES" -ifeq "$$(HostOS_CPP)" "mingw32" -$1_$2_LD_SCRIPT_CMD = -$1_$2_LD_SCRIPT = driver/utils/merge_sections_pe.ld -else -$1_$2_LD_SCRIPT_CMD = -T -$1_$2_LD_SCRIPT = driver/utils/merge_sections.ld -endif -endif -endif - -# Build the GHCi library -# See Note [Merging object files for GHCi] in GHC.Driver.Pipeline. -ifneq "$(filter $3, v p)" "" -$1_$2_$3_GHCI_LIB = $1/$2/build/HS$$($1_$2_COMPONENT_ID).$$($3_osuf) -ifeq "$$($1_$2_BUILD_GHCI_LIB)" "YES" -# Don't put bootstrapping packages in the bindist -ifneq "$4" "0" -BINDIST_LIBS += $$($1_$2_$3_GHCI_LIB) -endif -endif -$$($1_$2_$3_GHCI_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_CXX_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS) $$($1_$2_LD_SCRIPT) - $$(call cmd,MERGE_OBJS_STAGE$4) $(MERGE_OBJS_STAGE$4_FLAGS) $$(if $$($1_$2_LD_SCRIPT),$$($1_$2_LD_SCRIPT_CMD) $$($1_$2_LD_SCRIPT)) -o $$@ $$(EXTRA_LD_LINKER_OPTS) $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_CXX_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS) -ifeq "$$($1_$2_BUILD_GHCI_LIB)" "YES" -# Don't bother making ghci libs for bootstrapping packages -ifneq "$4" "0" -$(call all-target,$1_$2,$$($1_$2_$3_GHCI_LIB)) -endif -endif # "$$($1_$2_BUILD_GHCI_LIB)" "YES" -endif # "$(filter $3, v p)" "" - -$(call profEnd, build-package-way($1,$2,$3)) -endef # build-package-way - -define build-dll -# Call out to the shell script to decide how to build the util dll. -# 1 = dir -# 2 = distdir -# 3 = way -# 4 = extra flags -# 5 = extra libraries to link -# 6 = object files to link -# 7 = output filename -# 8 = link command -# 9 = create delay load import lib -# 10 = SxS Name -# 11 = SxS Version -$(gen-dll_INPLACE) link "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$(call cmd,$1_$2_HC) $(subst -no-hs-main,,$($1_$2_$3_ALL_HC_OPTS) $($1_$2_$3_GHC_LD_OPTS)) \ - -shared -dynamic -dynload deploy \ - $(addprefix -l,$($1_$2_EXTRA_LIBRARIES)) \ - -no-auto-link-packages" "$8" \ - "$9" "${10}" -endef - diff --git a/rules/build-package.mk b/rules/build-package.mk deleted file mode 100644 index 12381d8892..0000000000 --- a/rules/build-package.mk +++ /dev/null @@ -1,171 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -# Build a package with the stage-1 compiler, multiple ways. A typical -# libraries/foo/ghc.mk will look like this: -# -# $(eval $(call build-package,libraries/base,dist-install)) -# -# The package metadata is generated from the .cabal file and placed in -# package-data.mk. It will look something like this: -# -# libraries/base_dist_MODULES = GHC.Base Data.Tuple ... -# libraries/base_dist_PACKAGE = base -# libraries/base_dist_VERSION = 4.0.0.0 -# libraries/base_dist_HC_OPTS = -package ghc-prim-0.1.0.0 -XRank2Types ... -# libraries/base_dist_C_SRCS = cbits/PrelIOUtils.c ... -# libraries/base_dist_S_SRCS = cbits/foo.S ... -# libraries/base_dist_CC_OPTS = -Iinclude ... -# libraries/base_dist_LD_OPTS = -package ghc-prim-0.1.0.0 - -define build-package -$(call trace, build-package($1,$2,$3)) -$(call profStart, build-package($1,$2,$3)) -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -ifeq "$$(findstring $3,0 1 2)" "" -$$(error $1/$2: stage argument to build-package should be 0, 1, or 2) -endif - -$(call clean-target,$1,$2,$1/$2) - -distclean : clean_$1_$2_config - -.PHONY: clean_$1_$2_config -clean_$1_$2_config: - $$(call removeFiles,$1/config.log $1/config.status $(wildcard $1/include/Hs*Config.h)) - $$(call removeTrees,$1/autom4te.cache) - -ifneq "$$($1_$2_NOT_NEEDED)" "YES" -$$(eval $$(call build-package-helper,$1,$2,$3)) -endif -$(call profEnd, build-package($1,$2,$3)) -endef - - -define build-package-helper -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -# --- CONFIGURATION - -$(call package-config,$1,$2,$3) - -ifeq "$3" "1" -$$($1_PACKAGE)_INSTALL_INFO = $1_$2 -endif - -# Bootstrapping libs are only built one way -ifeq "$3" "0" -$1_$2_WAYS = v -else -$1_$2_WAYS = $$(filter-out $$($1_$2_EXCLUDED_WAYS),$$(GhcLibWays)) -endif - -$1_$2_DYNAMIC_TOO = NO -ifneq "$$(DYNAMIC_TOO)" "NO" -ifneq "$$(filter v,$$($1_$2_WAYS))" "" -ifneq "$$(filter dyn,$$($1_$2_WAYS))" "" -$1_$2_DYNAMIC_TOO = YES -endif -endif -endif - -# We must use a different dependency file if $(GhcLibWays) changes, so -# encode the ways into the name of the file. -$1_$2_WAYS_DASHED = $$(subst $$(space),,$$(patsubst %,-%,$$(strip $$($1_$2_WAYS)))) -$1_$2_depfile_base = $1/$2/build/.depend$$($1_$2_WAYS_DASHED) - -$(call build-package-data,$1,$2,$3) -ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" -ifeq "$3" "0" -include $1/$2/package-data.mk -else ifeq "$(phase)" "final" -include $1/$2/package-data.mk -endif -# Each Haskell compilation in this package will depend on the -# package-data.mk file because e.g. if the version of the package -# changes we need to recompile everything in it. -$1_$2_PKGDATA_DEP = $$($1_$2_PKGDATA) -endif - -$(call hs-sources,$1,$2) -$(call c-sources,$1,$2) -$(call includes-sources,$1,$2) -$(call distdir-opts,$1,$2,$3) - -$(call dependencies,$1,$2,$3) - -# Now generate all the build rules for each way in this directory: -$$(foreach way,$$($1_$2_WAYS),$$(eval \ - $$(call c-objs,$1,$2,$$(way)) \ - $$(call c-suffix-rules,$1,$2,$$(way),YES) \ - $$(call cxx-suffix-rules,$1,$2,$$(way),YES) \ - $$(call cmm-objs,$1,$2,$$(way)) \ - $$(call cmm-suffix-rules,$1,$2,$$(way)) \ - $$(call build-package-way,$1,$2,$$(way),$3) \ - )) - -# Programs will need to depend on either the vanilla lib (if -static -# is the default) or the dyn lib (if -dynamic is the default). We -# conservatively make them depend on both, to keep things simple. -# If dyn libs are not being built then $$($1_$2_dyn_LIB) will just -# expand to the empty string, and be ignored. -$1_$2_PROGRAM_DEP_LIB = $$($1_$2_v_LIB) $$($1_$2_dyn_LIB) -$$($1_$2_COMPONENT_ID)_$2_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB) - -# See Note [inconsistent distdirs] in rules/build-package-way.mk. -ifeq "$$($1_PACKAGE) $2" "ghc stage1" -$$($1_$2_COMPONENT_ID)_dist-boot_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB) -endif -ifeq "$$($1_PACKAGE) $2" "ghc stage2" -$$($1_$2_COMPONENT_ID)_dist-install_PROGRAM_DEP_LIB = $$($1_$2_PROGRAM_DEP_LIB) -endif - -# C and S files are possibly built the "dyn" way. -ifeq "$$(BuildSharedLibs)" "YES" -$(call c-objs,$1,$2,dyn) -$(call c-suffix-rules,$1,$2,dyn,YES) -$(call cxx-suffix-rules,$1,$2,dyn,YES) -$(call cmm-objs,$1,$2,dyn) -$(call cmm-suffix-rules,$1,$2,dyn,YES) -endif -$$(foreach dir,$$($1_$2_HS_SRC_DIRS),\ - $$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$$(dir)))) - -$(call all-target,$1,all_$1_$2) -# 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 "$3" "0" -$(call haddock,$1,$2) -endif - -# Don't put bootstrapping packages in the bindist -# -# See Note [inconsistent distdirs] in rules/build-package-way.mk for why -# we hard-code dist-install; GHC will use stage2/stage3 here so we -# cannot use the distdir parameter. -ifneq "$3" "0" -BINDIST_EXTRAS += $1/*.cabal $$(wildcard $1/*.buildinfo) $$(wildcard $1/dist-install/build/*.buildinfo) $1/$2/setup-config $1/LICENSE -BINDIST_EXTRAS += $$($1_$2_INSTALL_INCLUDES_SRCS) -endif - -endef - diff --git a/rules/build-prog.mk b/rules/build-prog.mk deleted file mode 100644 index 8d2bcd25c5..0000000000 --- a/rules/build-prog.mk +++ /dev/null @@ -1,336 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -# Build a program. -# -# $(eval $(call build-prog,utils/genapply,dist-install,1)) - -define build-prog -$(call trace, build-prog($1,$2,$3)) -$(call profStart, build-prog($1,$2,$3)) -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -ifeq "$$($1_$2_PROGNAME)" "" -$$(error $1_$2_PROGNAME is not set) -endif -ifneq "$$($1_$2_PROG)" "" -$$(error $1_$2_PROG is set) -endif -$1_$2_PROG = $$($1_$2_PROGNAME)$$(exeext$3) - -ifeq "$$(findstring $3,0 1 2)" "" -$$(error $1/$2: stage argument to build-prog should be 0, 1, or 2) -endif - -$(call clean-target,$1,$2,$1/$2) - -$$(eval $$(call build-prog-vars,$1,$2,$3)) - -ifneq "$$($1_$2_NOT_NEEDED)" "YES" -$$(eval $$(call build-prog-helper,$1,$2,$3)) -endif -$(call profEnd, build-prog($1,$2,$3)) -endef - - - - - -define build-prog-vars -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -ifeq "$$($1_USES_CABAL)" "YES" -$1_$2_USES_CABAL = YES -endif - -ifeq "$$(Windows_Host)" "YES" -$1_$2_WANT_INPLACE_WRAPPER = NO -else ifneq "$$($1_$2_INSTALL_INPLACE)" "YES" -$1_$2_WANT_INPLACE_WRAPPER = NO -else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" -$1_$2_WANT_INPLACE_WRAPPER = YES -else ifeq "$$(DYNAMIC_GHC_PROGRAMS)" "YES" -$1_$2_WANT_INPLACE_WRAPPER = YES -else -$1_$2_WANT_INPLACE_WRAPPER = NO -endif - -ifeq "$$(Windows_Host)" "YES" -$1_$2_WANT_INSTALLED_WRAPPER = NO -else ifneq "$$($1_$2_INSTALL)" "YES" -$1_$2_WANT_INSTALLED_WRAPPER = NO -else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" -$1_$2_WANT_INSTALLED_WRAPPER = YES -else -$1_$2_WANT_INSTALLED_WRAPPER = NO -endif - -$1_$2_depfile_base = $1/$2/build/.depend - -ifeq "$$($1_$2_INSTALL_INPLACE)" "NO" -ifneq "$$(CLEANING)" "YES" -$1_$2_INPLACE = $$(error $1_$2 should not be installed inplace, but INPLACE var evaluated) -else -$1_$2_INPLACE = -endif -else -ifneq "$$($$($1_$2_PROGNAME)_INPLACE)" "" -$$(error $$($1_$2_PROGNAME)_INPLACE defined twice) -endif -# -# Where do we install the wrapper and the binary? -# $$($1_$2_PROGNAME)_INPLACE The thing we run (script or binary) -# $1_$2_INPLACE The binary -# -ifeq "$$($1_$2_TOPDIR)" "YES" -$$($1_$2_PROGNAME)_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG) -ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" -$1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG).bin -else -$1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG) -endif -else -$$($1_$2_PROGNAME)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG) -ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" -$1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG) -else -$1_$2_INPLACE = $$($$($1_$2_PROGNAME)_INPLACE) -endif -endif -endif - -endef - - - - - -define build-prog-helper -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -$(call package-config,$1,$2,$3) - -ifeq "$$($1_$2_USES_CABAL)" "YES" -$(call build-package-data,$1,$2,$3) -ifneq "$$(NO_INCLUDE_PKGDATA)" "YES" -ifeq "$3" "0" -include $1/$2/package-data.mk -else ifeq "$(phase)" "final" -include $1/$2/package-data.mk -endif -endif -endif - -$(call all-target,$1,all_$1_$2) -$(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG)) - -$(call shell-wrapper,$1,$2) - -ifeq "$$($1_$2_PROGRAM_WAY)" "" -ifeq "$3" "0" -$1_$2_PROGRAM_WAY = v -else ifeq "$$(DYNAMIC_GHC_PROGRAMS)" "YES" -$1_$2_PROGRAM_WAY = dyn -else -$1_$2_PROGRAM_WAY = v -endif -endif - -$1_$2_WAYS = $$($1_$2_PROGRAM_WAY) - -$1_$2_DYNAMIC_TOO = NO - -$(call hs-sources,$1,$2) -$(call c-sources,$1,$2) - -# --- IMPLICIT RULES - -$(call distdir-opts,$1,$2,$3) -$(call distdir-way-opts,$1,$2,$$($1_$2_PROGRAM_WAY),$3) - -ifeq "$3" "0" -# For stage 0, we use GHC to compile C sources so that we don't have to -# worry about where the RTS header files are -$(call c-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY),YES) -else -ifeq "$$($1_$2_UseGhcForCC)" "YES" -$(call c-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY),YES) -else -$(call c-suffix-rules,$1,$2,$$($1_$2_PROGRAM_WAY),NO) -endif -endif - -$$(foreach dir,$$($1_$2_HS_SRC_DIRS),\ - $$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$$(dir)))) -$(call hs-suffix-way-rules,$1,$2,$$($1_$2_PROGRAM_WAY)) - -$(call c-objs,$1,$2,$$($1_$2_PROGRAM_WAY)) -$(call hs-objs,$1,$2,$$($1_$2_PROGRAM_WAY)) - -$1_$2_LINK_WITH_GCC = NO - -ifeq "$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS)" "" -# We don't want to link the GHC RTS into C-only programs. There's no -# point, and it confuses the test that all GHC-compiled programs -# were compiled with the right GHC. -$1_$2_$$($1_$2_PROGRAM_WAY)_GHC_LD_OPTS += -no-auto-link-packages -no-hs-main -endif - -ifneq "$$(BINDIST)" "YES" - -# The quadrupled $'s here are because the __LIB variables aren't -# necessarily set when this part of the makefile is read -# -# See Note [inconsistent distdirs] in rules/build-package-way.mk for why -# we are computing the dist-dir from the GHC stage and not just using -# the distdir parameter. -$1/$2/build/tmp/$$($1_$2_PROG) $1/$2/build/tmp/$$($1_$2_PROG).dll : \ - $$(foreach dep,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),\ - $$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)) -# Workaround: We use TRANSITIVE_DEP_COMPONENT_IDS here as a workaround for -# #12078. - -$1_$2_PROG_NEEDS_C_WRAPPER = NO -$1_$2_PROG_INPLACE = $$($1_$2_PROG) -ifeq "$$(Windows_Host) $$($1_$2_PROGRAM_WAY)" "YES dyn" -ifneq "$$($1_$2_HS_SRCS)" "" -$1_$2_PROG_NEEDS_C_WRAPPER = YES -$1_$2_PROG_INPLACE = inplace-$$($1_$2_PROG) -endif -endif - -ifeq "$$($1_$2_PROG_NEEDS_C_WRAPPER)" "YES" - -$1_$2_RTS_OPTS_FLAG = $$(lastword $$(filter -rtsopts -rtsopts=all -rtsopts=some -rtsopts=none -no-rtsopts,$$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_HC_OPTS))) -ifeq "$$($1_$2_RTS_OPTS_FLAG)" "-rtsopts" -$1_$2_RTS_OPTS = RtsOptsAll -else ifeq "$$($1_$2_RTS_OPTS_FLAG)" "-rtsopts=all" -$1_$2_RTS_OPTS = RtsOptsAll -else ifeq "$$($1_$2_RTS_OPTS_FLAG)" "-rtsopts=some" -$1_$2_RTS_OPTS = RtsOptsSafeOnly -else ifeq "$$($1_$2_RTS_OPTS_FLAG)" "-rtsopts=none" -$1_$2_RTS_OPTS = RtsOptsNone -else ifeq "$$($1_$2_RTS_OPTS_FLAG)" "-no-rtsopts" -$1_$2_RTS_OPTS = RtsOptsNone -else -$1_$2_RTS_OPTS = RtsOptsSafeOnly -endif - -$1/$2/build/tmp/$$($1_$2_PROG)-inplace-wrapper.c: driver/utils/dynwrapper.c | $$$$(dir $$$$@)/. - $$(call removeFiles,$$@) - echo '#include ' >> $$@ - echo '#include "Rts.h"' >> $$@ - echo 'LPTSTR path_dirs[] = {' >> $$@ - $$(foreach d,$$($1_$2_DEP_LIB_REL_DIRS),$$(call make-command,echo ' TEXT("/../../$$d")$$(comma)' >> $$@)) - echo ' TEXT("/../../$1/$2/build/tmp/"),' >> $$@ - echo ' NULL};' >> $$@ - echo 'LPTSTR progDll = TEXT("../../$1/$2/build/tmp/$$($1_$2_PROG).dll");' >> $$@ - echo 'LPTSTR rtsDll = TEXT("$$($$(WINDOWS_DYN_PROG_RTS))");' >> $$@ - echo 'int rtsOpts = $$($1_$2_RTS_OPTS);' >> $$@ - cat driver/utils/dynwrapper.c >> $$@ - -$1/$2/build/tmp/$$($1_$2_PROG)-wrapper.c: driver/utils/dynwrapper.c | $$$$(dir $$$$@)/. - $$(call removeFiles,$$@) - echo '#include ' >> $$@ - echo '#include "Rts.h"' >> $$@ - echo 'LPTSTR path_dirs[] = {' >> $$@ - $$(foreach p,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),$$(call make-command,echo ' TEXT("/../lib/$$p")$$(comma)' >> $$@)) - echo ' TEXT("/../lib/"),' >> $$@ - echo ' NULL};' >> $$@ - echo 'LPTSTR progDll = TEXT("../lib/$$($1_$2_PROG).dll");' >> $$@ - echo 'LPTSTR rtsDll = TEXT("$$($$(WINDOWS_DYN_PROG_RTS))");' >> $$@ - echo 'int rtsOpts = $$($1_$2_RTS_OPTS);' >> $$@ - cat driver/utils/dynwrapper.c >> $$@ - -$1/$2/build/tmp/$$($1_$2_PROG_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG)-inplace-wrapper.c $1/$2/build/tmp/$$($1_$2_PROG).dll | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) -no-hs-main -no-auto-link-packages -optc-g -optc-O0 $$< -o $$@ - -$1/$2/build/tmp/$$($1_$2_PROG) : $1/$2/build/tmp/$$($1_$2_PROG)-wrapper.c $1/$2/build/tmp/$$($1_$2_PROG).dll | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) -no-hs-main -no-auto-link-packages -optc-g -optc-O0 $$< -o $$@ - -$1/$2/build/tmp/$$($1_$2_PROG).dll : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. - $$(call build-dll,$1,$2,$$($1_$2_PROGRAM_WAY),,$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS),$$@) -else # $1_$2_PROG_NEEDS_C_WRAPPER=NO -ifeq "$$($1_$2_LINK_WITH_GCC)" "NO" -$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_HC_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_GHC_LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) - -else -$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_CC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_CC_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_EXTRA_CC_OPTS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) -endif -endif # $1_$2_PROG_NEEDS_C_WRAPPER - -# Note [lib-depends] -# ~~~~~~~~~~~~~~~~~~ -# If this program is built with stage1 or greater, we -# need to depend on the libraries too. NB. since $(ALL_STAGE1_LIBS) and -# $(ALL_RTS_LIBS) are not defined until after libraries/*/ghc.mk have -# been included, this introduces an ordering dependency. -ifneq "$$(CLEANING)" "YES" -ifneq "$3" "0" -ifneq "$$($1_$2_HS_SRCS)" "" -ifeq "$$(strip $$(ALL_STAGE1_$$($1_$2_PROGRAM_WAY)_LIBS))" "" -$$(error ordering failure in $1 ($2): ALL_STAGE1_$$($1_$2_PROGRAM_WAY)_LIBS is empty) -endif -$1/$2/build/tmp/$$($1_$2_PROG) : $$(ALL_STAGE1_$$($1_$2_PROGRAM_WAY)_LIBS) $$(ALL_RTS_LIBS) -endif -endif -endif - -ifeq "$$($1_$2_INSTALL_INPLACE)" "YES" -$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG_INPLACE) | $$$$(dir $$$$@)/. - $$(INSTALL) -m 755 $$< $$@ -endif - -endif # BINDIST - -ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" -$(call all-target,$1_$2,$$($1_$2_INPLACE)) -endif -$(call clean-target,$1,$2_inplace,$$($1_$2_INPLACE)) - -ifeq "$$($1_$2_INSTALL)" "YES" -ifeq "$$($1_$2_PROG_NEEDS_C_WRAPPER)" "YES" -INSTALL_LIBS += $1/$2/build/tmp/$$($1_$2_PROG).dll -endif -ifeq "$$($1_$2_WANT_INSTALLED_WRAPPER)" "YES" -INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG) -else ifeq "$$($1_$2_TOPDIR)" "YES" -INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG) -else -INSTALL_BINS += $1/$2/build/tmp/$$($1_$2_PROG) -endif -endif - -$(call dependencies,$1,$2,$3) - -# The Main module of a program implicitly depends on GHC.TopHandler -# so we need to add a dependency for that. As we don't know which -# module contains Main, we just make all modules in the program -# depend on it. -# -# See Note [inconsistent distdirs] in rules/build-package-way.mk for why -# we hard-code dist-install; GHC will use stage2/stage3 here so we -# cannot use the distdir parameter. -ifneq "$3" "0" -$$(foreach o,$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS),$$(eval $$(call add-dependency,$$o,libraries/base/dist-install/build/GHC/TopHandler.$$($$($1_$2_PROGRAM_WAY)_osuf)))) -endif - -endef diff --git a/rules/c-objs.mk b/rules/c-objs.mk deleted file mode 100644 index 6b43fb54cd..0000000000 --- a/rules/c-objs.mk +++ /dev/null @@ -1,18 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define c-objs # args: $1 = dir, $2 = distdir, $3 = way -# C, C++, and S files are usually only built for way "v", but sometimes "dyn" too -$1_$2_$3_C_OBJS = $$(patsubst %.c,$1/$2/build/%.$$($3_osuf),$$($1_$2_C_SRCS)) -$1_$2_$3_CXX_OBJS = $$(patsubst %.cpp,$1/$2/build/%.$$($3_osuf),$$($1_$2_CXX_SRCS)) -$1_$2_$3_S_OBJS = $$(patsubst %.S,$1/$2/build/%.$$($3_osuf),$$($1_$2_S_SRCS)) -endef diff --git a/rules/c-sources.mk b/rules/c-sources.mk deleted file mode 100644 index edc0cdbf04..0000000000 --- a/rules/c-sources.mk +++ /dev/null @@ -1,18 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define c-sources # args: $1 = dir, $2 = distdir -$1_$2_C_FILES = $$(patsubst %,$1/%,$$($1_$2_C_SRCS)) -$1_$2_CXX_FILES = $$(patsubst %,$1/%,$$($1_$2_CXX_SRCS)) -$1_$2_S_FILES = $$(patsubst %,$1/%,$$($1_$2_S_SRCS)) -$1_$2_CMM_FILES = $$(patsubst %,$1/%,$$($1_$2_CMM_SRCS)) -endef diff --git a/rules/c-suffix-rules.mk b/rules/c-suffix-rules.mk deleted file mode 100644 index d405d155c0..0000000000 --- a/rules/c-suffix-rules.mk +++ /dev/null @@ -1,64 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define c-suffix-rules -# $1 = dir -# $2 = distdir -# $3 = way -# $4 = use GHC (YES/NO) - -ifneq "$$(BINDIST)" "YES" - -ifeq "$4" "YES" - -$1/$2/build/%.$$($3_osuf) : $1/%.c $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.c $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_ssuf) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/%.S $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_ssuf) : $1/$2/build/%.c $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -S $$< -o $$@ - -$1/$2/build/%.$$($3_ssuf) : $1/%.c $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -S $$< -o $$@ - -else - -$1/$2/build/%.$$($3_osuf) : $1/%.c | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.c - $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_ssuf) - $$(call cmd,$1_$2_AS) $$($1_$2_$3_ALL_AS_OPTS) -o $$@ $$< - -$1/$2/build/%.$$($3_osuf) : $1/%.S | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_ssuf) : $1/$2/build/%.c - $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -S $$< -o $$@ - -endif - -endif - -endef - diff --git a/rules/clean-target.mk b/rules/clean-target.mk deleted file mode 100644 index 8b37624af7..0000000000 --- a/rules/clean-target.mk +++ /dev/null @@ -1,21 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define clean-target # args: $1 = dir, $2 = key, $3 = files/dirs to clean -clean : clean_$1 -.PHONY: clean_$1 -clean_$1 : clean_$1_$2 -.PHONY: clean_$1_$2 -clean_$1_$2: - $$(call removeTrees,$3) -endef diff --git a/rules/cmm-objs.mk b/rules/cmm-objs.mk deleted file mode 100644 index dc517cbf34..0000000000 --- a/rules/cmm-objs.mk +++ /dev/null @@ -1,16 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define cmm-objs # args: $1 = dir, $2 = distdir, $3 = way - -$1_$2_$3_CMM_OBJS = $$(patsubst %.cmm,$1/$2/build/%.$$($3_osuf),$$($1_$2_CMM_SRCS)) -endef diff --git a/rules/cmm-suffix-rules.mk b/rules/cmm-suffix-rules.mk deleted file mode 100644 index bb7acce06f..0000000000 --- a/rules/cmm-suffix-rules.mk +++ /dev/null @@ -1,52 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define cmm-suffix-rules -# $1 = dir -# $2 = distdir -# $3 = way - -# .cmm files depend on all the .h files, to a first approximation. - -ifneq "$$(CLEANING)" "YES" - -$1/$2/build/%.$$($3_osuf) : $1/%.cmm $$(rts_H_FILES) $$(includes_$2_H_FILES) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) $$($1_$2_$3_MOST_HC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.cmm $$(rts_H_FILES) $$(includes_$2_H_FILES) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) $$($1_$2_$3_MOST_HC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_hcsuf) : $1/%.cmm $$(rts_H_FILES) $$(includes_$2_H_FILES) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) $$($1_$2_$3_MOST_HC_OPTS) -C $$< -o $$@ - -$1/$2/build/%.$$($3_hcsuf) : $1/$2/build/%.cmm $$(rts_H_FILES) $$(includes_$2_H_FILES) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) $$($1_$2_$3_MOST_HC_OPTS) -C $$< -o $$@ - -# XXX -# When we started using "| $$$$(dir $$$$@)/." for directory deps, these -# rules started getting used when object splitting is enabled for some -# reason. But they fail with -# **splitmangle**: openBinaryFile: does not exist (No such file or directory) -# so for now they're commented out. They aren't needed, as we can always -# go directly to .o files. -# -# $1/$2/build/%.$$($3_ssuf) : $1/%.cmm $$(rts_H_FILES) $$(includes_$2_H_FILES) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. -# $$(call cmd,$1_$2_HC) $$($1_$2_$3_MOST_HC_OPTS) -S $$< -o $$@ -# -# $1/$2/build/%.$$($3_ssuf) : $1/$2/build/%.cmm $$(rts_H_FILES) $$(includes_$2_H_FILES) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. -# $$(call cmd,$1_$2_HC) $$($1_$2_$3_MOST_HC_OPTS) -S $$< -o $$@ - -endif - -endef - diff --git a/rules/cxx-suffix-rules.mk b/rules/cxx-suffix-rules.mk deleted file mode 100644 index 25b3d5212c..0000000000 --- a/rules/cxx-suffix-rules.mk +++ /dev/null @@ -1,44 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define cxx-suffix-rules -# $1 = dir -# $2 = distdir -# $3 = way -# $4 = use GHC (YES/NO) - -ifneq "$$(BINDIST)" "YES" - -ifeq "$4" "YES" - -$1/$2/build/%.$$($3_osuf) : $1/%.cpp $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.cpp $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@ - - -else - -$1/$2/build/%.$$($3_osuf) : $1/%.cpp | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.cpp - $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@ - -endif - -endif - -endef - diff --git a/rules/dependencies.mk b/rules/dependencies.mk deleted file mode 100644 index 4aae78e4e3..0000000000 --- a/rules/dependencies.mk +++ /dev/null @@ -1,38 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define dependencies -$(call trace, dependencies($1,$2,$3)) -$(call profStart, dependencies($1,$2,$3)) -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -# We always have the dependency rules available, as we need to know -# how to build hsc2hs's dependency file in phase 0 -$(call build-dependencies,$1,$2,$3) - -ifneq "$(phase)" "0" -# From phase 1 we actually include the dependency files for the -# bootstrapping stuff -ifeq "$3" "0" -$(call include-dependencies,$1,$2,$3) -else ifeq "$(phase)" "final" -# In the final phase, we also include the dependency files for -# everything else -$(call include-dependencies,$1,$2,$3) -endif -endif - -$(call profEnd, dependencies($1,$2,$3)) -endef - diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk deleted file mode 100644 index ebe56c1fd5..0000000000 --- a/rules/distdir-opts.mk +++ /dev/null @@ -1,111 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -# Set compilation flags that do not depend on a particular way - -define distdir-opts # args: $1 = dir, $2 = distdir, $3 = stage - -ifeq "$3" "" -$$(error Stage not given for distdir-opts $1 $2) -endif - -ifneq ($$(strip $$($1_$2_DEP_INCLUDE_DIRS_SINGLE_QUOTED)),) -$1_$2_CC_INC_FLAGS := $$(subst $$(space)',$$(space)-I',$$(space)$$($1_$2_DEP_INCLUDE_DIRS_SINGLE_QUOTED)) -endif - -# The CONF_CC_OPTS_STAGE$3 options are what we use to get gcc to -# behave correctly, but they are specific to the gcc that we are using. -# If GHC is compiling C code then it will take care of that for us, -# and in the case of the stage 0 compiler it may be using a different -# gcc, so we don't want to use our gcc-specific options. -$1_$2_DIST_GCC_CC_OPTS = \ - $$(CONF_CC_OPTS_STAGE$3) \ - $$($1_$2_DIST_CC_OPTS) - -$1_$2_DIST_INCLUDE_DIRS = \ - $$($1_$2_INCLUDE_DIRS) \ - $$($1_INCLUDE_DIRS) - -$1_$2_DIST_CPP_OPTS = \ - $$(foreach dir,$$(filter-out /%,$$($1_$2_DIST_INCLUDE_DIRS)),-I$1/$$(dir)) \ - $$(foreach dir,$$(filter /%,$$($1_$2_DIST_INCLUDE_DIRS)),-I$$(dir)) \ - $$($1_$2_CPP_OPTS) \ - $$($1_CPP_OPTS) - -$1_$2_DIST_CC_OPTS = \ - $$(SRC_CC_OPTS) \ - $$($1_CC_OPTS) \ - -I$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen \ - $$($1_$2_DIST_CPP_OPTS) \ - $$($1_$2_CC_OPTS) \ - $$($1_$2_CC_INC_FLAGS) \ - $$($1_$2_DEP_CC_OPTS) \ - $$(SRC_CC_WARNING_OPTS) - -$1_$2_DIST_LD_OPTS = \ - $$(SRC_LD_OPTS) \ - $$($1_LD_OPTS) \ - $$($1_$2_LD_OPTS) \ - $$($1_$2_DIST_LD_LIB_DIRS) \ - $$($1_$2_DEP_LD_OPTS) - -# c.f. Cabal's Distribution.Simple.PreProcess.ppHsc2hs -# We use '' around cflags and lflags to handle paths with backslashes in -# on Windows -ifneq ($$(strip $$($1_$2_DIST_GCC_CC_OPTS)),) -$1_$2_HSC2HS_CC_OPTS:=$$(shell for i in $$($1_$2_DIST_GCC_CC_OPTS); do echo \'--cflag=$$$$i\'; done) -endif -ifneq ($$(strip $$($1_$2_DIST_LD_OPTS)),) -$1_$2_HSC2HS_LD_OPTS:=$$(shell for i in $$($1_$2_DIST_LD_OPTS); do echo \'--lflag=$$$$i\'; done) -endif - -$1_$2_ALL_HSC2HS_OPTS = \ - '--cc=$$(CC_STAGE$3)' \ - '--ld=$$(CC_STAGE$3)' \ - $$(CONF_HSC2HS_OPTS) \ - $$(SRC_HSC2HS_OPTS) \ - $$(SRC_HSC2HS_OPTS_STAGE$3) \ - --cflag=-D__GLASGOW_HASKELL__=$$(if $$(filter 0,$3),$$(GhcCanonVersion),$$(ProjectVersionInt)) \ - $$($1_$2_HSC2HS_CC_OPTS) \ - $$($1_$2_HSC2HS_LD_OPTS) \ - --cflag=-I$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen \ - $$(if $$($1_PACKAGE),--cflag=-include --cflag=$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/cabal_macros.h) \ - $$($$(basename $$<)_HSC2HS_OPTS) \ - $$(EXTRA_HSC2HS_OPTS) - -$1_$2_ALL_ALEX_OPTS = \ - $$(CONF_ALEX_OPTS) \ - $$(SRC_ALEX_OPTS) \ - $$($1_ALEX_OPTS) \ - $$($1_$2_ALEX_OPTS) \ - $$(EXTRA_ALEX_OPTS) - -$1_$2_ALL_HAPPY_OPTS = \ - $$(CONF_HAPPY_OPTS) \ - $$(SRC_HAPPY_OPTS) \ - $$($1_HAPPY_OPTS) \ - $$($1_$2_HAPPY_OPTS) \ - $$(EXTRA_HAPPY_OPTS) - -# Disable split sections when building with stage0, it won't be supported yet -# and it's probably not very relevant anyway (smaller stage1 ghc?). -ifeq "$$($1_$2_SplitSections)" "" -ifeq "$3" "1" -$1_$2_SplitSections = $(SplitSections) -else -$1_$2_SplitSections = NO -endif -endif - -endef - diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk deleted file mode 100644 index 098af4f8da..0000000000 --- a/rules/distdir-way-opts.mk +++ /dev/null @@ -1,220 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -# Set compilation flags that additionally depend on a particular way - -define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage - -# Here is how the command line for a Haskell compilation is constructed. -# $1 is the directory we're building in -# $2 is the distdir (e.g. "dist", "dist-install" etc.) -# $3 is the way (e.g. "v", "p", etc.) -# $4 is the stage ("0", "1", "2") that the options are passed to -# See Note [Stage number in build variables] -# in mk/config.mk.in. -# -# ----------------------------- -# The variables affecting Haskell compilations are as follows, including -# the places in the build system that may define them. -# -# Variable Purpose Defined by -# -------------- ------------------------------ -------------- -# $1_PACKAGE Package name for this dir, $1/$2/ghc.mk -# if it is a package -# -# CONF_HC_OPTS GHC options from ./configure mk/config.mk.in -# -# CONF_CPP_OPTS_STAGE$4 CPP options from ./configure mk/config.mk.in -# -# CONF_CC_OPTS_STAGE$4 C compiler options from mk/config.mk.in -# ./configure -# -# CONF_HC_OPTS_STAGE$4 GHC options from ./configure mk/config.mk.in -# specific to stage $4 -# -# CONF_LD_LINKER_OPTS_STAGE$4 -# GHC options from ./configure mk/config.mk.in -# specific to stage $4 -# -# WAY_$3_HC_OPTS GHC options specific to way $3 mk/ways.mk -# -# SRC_HC_OPTS source-tree-wide GHC options mk/config.mk.in -# mk/build.mk -# mk/validate.mk -# mk/warnings.mk -# -# SRC_HC_OPTS_STAGE$4 source-tree-wide GHC options, mk/config.mk.in -# supplied to the stage $4 mk/build.mk -# compiler only mk/validate.mk -# mk/warnings.mk -# -# SRC_HC_WARNING_OPTS source-tree-wide GHC warning mk/config.mk.in -# options mk/build.mk -# mk/validate.mk -# mk/warnings.mk -# -# SRC_HC_WARNING_OPTS_STAGE$4 mk/config.mk.in -# source-tree-wide GHC warning mk/build.mk -# options, supplied to the mk/validate.mk -# stage $4 compiler only mk/warnings.mk -# -# EXTRA_HC_OPTS for supplying extra options on make EXTRA_HC_OPTS=... -# the command line -# -# $1_HC_OPTS GHC options specific to this $1/$2/package-data.mk -# dir -# -# $1_$2_HC_OPTS GHC options specific to this $1/$2/package-data.mk -# dir and distdir -# -# $1_$2_$3_HC_OPTS GHC options specific to this $1/$2/package-data.mk -# dir, distdir and way -# -# $1_$2_MORE_HC_OPTS GHC options for this dir/distdir ??? -# -# $1_$2_EXTRA_HC_OPTS GHC options for this dir/distdir mk/build.mk -# mk/warnings.mk -# -# $1_$2_HC_PKGCONF -package-db flag if necessary rules/package-config.mk -# -# $1_$2_HS_SRC_DIRS dirs relative to $1 containing $1/$2/package-data.mk -# source files -# -# $1_$2_CPP_OPTS CPP options $1/$2/package-data.mk -# -# _HC_OPTS GHC options for this source $1/$2/ghc.mk -# file (without the extension) - -# ----------------------------- - -# The actual options passed to a Haskell compilation are defined -# below. Note that in general, more specific sets of options come -# after the less specific, so that we can override global options -# on a per-directory or per-way basis, for example. - -# $1_$2_$3_MOST_HC_OPTS is also passed to C compilations when we use -# GHC as the C compiler. - -$1_$2_$4_DEP_OPTS = \ - $$(foreach pkg,$$($1_$2_DEP_IPIDS),-package-id $$(pkg)) - -$4_THIS_UNIT_ID = -this-unit-id - -$1_$2_$3_MOST_HC_OPTS = \ - $$(WAY_$3_HC_OPTS) \ - $$(CONF_HC_OPTS) \ - $$(SRC_HC_OPTS) \ - $$(SRC_HC_OPTS_STAGE$4) \ - $$($1_HC_OPTS) \ - $$($1_$2_HC_PKGCONF) \ - $$(if $$($1_$2_PROG),, \ - $$(if $$($1_PACKAGE),$$($4_THIS_UNIT_ID) $$($1_$2_COMPONENT_ID))) \ - $$(if $$($1_PACKAGE),-hide-all-packages) \ - -package-env - \ - -i $$(if $$($1_$2_HS_SRC_DIRS),$$(foreach dir,$$($1_$2_HS_SRC_DIRS),-i$1/$$(dir)),-i$1) \ - -i$1/$2/build \ - -I$1/$2/build \ - -i$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen \ - -I$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen \ - $$(foreach dir,$$(filter -I%,$$($1_$2_DIST_CPP_OPTS)),$$(dir)) \ - $$(foreach opt,$$(filter-out -I%,$$($1_$2_DIST_CPP_OPTS)),-optP$$(opt)) \ - $$(if $$($1_PACKAGE),-optP-include \ - -optP$1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/cabal_macros.h) \ - $$($1_$2_$4_DEP_OPTS) \ - $$($1_$2_HC_OPTS) \ - $$(CONF_HC_OPTS_STAGE$4) \ - $$($1_$2_MORE_HC_OPTS) \ - $$($1_EXTRA_HC_OPTS) \ - $$($1_$2_EXTRA_HC_OPTS) \ - $$($1_$2_$3_HC_OPTS) \ - $$($$(basename $$(subst ./,,$$<))_HC_OPTS) \ - $$(SRC_HC_WARNING_OPTS) \ - $$(SRC_HC_WARNING_OPTS_STAGE$4) \ - $$(EXTRA_HC_OPTS) - -# What is going on with $1_EXECUTABLE? Recent version of Cabal -# place the cabal_macros.h for executables in build/exename/autogen -# rather than the traditional build/autogen. This is Right(TM) -# thing to do, but we have to accommodate it. Usually, it suffices -# to look in the PROGNAME, but for ghc the PROGNAME is ghc-stage1 -# while Cabal puts it in 'ghc', so we $1_EXECUTABLE is for that -# case. - -$1_$2_$3_MOST_DIR_HC_OPTS = \ - $$($1_$2_$3_MOST_HC_OPTS) \ - -outputdir $1/$2/build - -# NB. CONF_HC_OPTS_STAGE$4 has to be late enough to override $1_$2_HC_OPTS, so -# that -O0 is effective (see #5484) - -# $1_$2_$3_ALL_HC_OPTS: this is all the options we will pass to GHC -# for a given ($1,$2,$3). -$1_$2_$3_ALL_HC_OPTS = \ - -hisuf $$($3_hisuf) -osuf $$($3_osuf) -hcsuf $$($3_hcsuf) \ - $$($1_$2_$3_MOST_DIR_HC_OPTS) \ - $$(if $$(findstring YES,$$($1_$2_SplitSections)),$$(if $$(findstring dyn,$3),,-split-sections),) \ - $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),$$(if $$(findstring v,$3),-dynamic-too)) - -$1_$2_$3_ALL_CC_OPTS = \ - $$(WAY_$3_CC_OPTS) \ - $$($1_$2_DIST_GCC_CC_OPTS) \ - $$($1_$2_$3_CC_OPTS) \ - $$($$(basename $$<)_CC_OPTS) \ - $$($1_$2_EXTRA_CC_OPTS) \ - $$(EXTRA_CC_OPTS) \ - $$(if $$(findstring YES,$$($1_$2_SplitSections)),-ffunction-sections -fdata-sections) - -$1_$2_$3_GHC_CC_OPTS = \ - $$(addprefix -optc, $$($1_$2_$3_ALL_CC_OPTS)) \ - $$($1_$2_$3_MOST_HC_OPTS) - -# Options for passing to gcc for linking -$1_$2_$3_ALL_LD_OPTS = \ - $$(WAY_$3_LD_OPTS) \ - $$($1_$2_DIST_LD_OPTS) \ - $$($1_$2_$3_LD_OPTS) \ - $$($1_$2_EXTRA_LD_OPTS) \ - $$(EXTRA_LD_OPTS) \ - $$(foreach o,$$(EXTRA_LD_LINKER_OPTS),-Wl$$(comma)$$o) \ - $$(foreach o,$$(CONF_LD_LINKER_OPTS_STAGE$4),-Wl$$(comma)$$o) - -# Options for passing to GHC when we use it for linking -$1_$2_$3_GHC_LD_OPTS = \ - $$(addprefix -optl, $$($1_$2_$3_ALL_LD_OPTS)) \ - $$($1_$2_$3_MOST_HC_OPTS) - -$1_$2_$3_ALL_AS_OPTS = \ - $$(CONF_AS_OPTS) \ - $$(SRC_AS_OPTS) \ - $$(WAY_$3_AS_OPTS) \ - $$($1_AS_OPTS) \ - $$($1_$2_AS_OPTS) \ - $$($1_$2_$3_AS_OPTS) \ - $$(EXTRA_AS_OPTS) - -ifeq "$3" "dyn" -ifneq "$4" "0" -ifeq "$$(TargetElf)" "YES" -$1_$2_$3_GHC_LD_OPTS += \ - -fno-use-rpaths \ - $$(foreach d,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'$$$$ORIGIN/../$$d') -optl-Wl,-zorigin -else ifeq "$$(TargetOS_CPP)" "darwin" -$1_$2_$3_GHC_LD_OPTS += \ - -fno-use-rpaths \ - $$(foreach d,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),-optl-Wl$$(comma)-rpath -optl-Wl$$(comma)'@loader_path/../$$d') -endif -endif -endif - -endef - diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk deleted file mode 100644 index 60dd0d3a82..0000000000 --- a/rules/foreachLibrary.mk +++ /dev/null @@ -1,59 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2010 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# For each line in $(TOP)/packages: -# libraries/foo tag ... -# this calls -# $(call $1,foo,tag) -# -# Except! If there's a libraries/foo/ghc-packages then it calls -# $(call $1,foo/bar,tag) -# for each word 'bar' in libraries/foo/ghc-packages. -# - -# We use an FEL_ prefix for the variable names, to avoid trampling on -# other variables, as make has no concept of local variables. - -# We need to handle the following packages specially, as those don't -# have an entry in the packages file, since they don't live in -# repositories of their own: -# -# - base -# - ghc-boot -# - ghc-boot-th -# - ghc-prim -# - integer-gmp -# - ghc-bignum -# - template-haskell - -define foreachLibrary -# $1 = function to call for each library -# We will give it the package path and the tag as arguments -$$(foreach hashline,libraries/ghc-boot-th#-#no-remote-repo#no-vcs \ - libraries/ghc-boot#-#no-remote-repo#no-vcs \ - libraries/ghci#-#no-remote-repo#no-vcs \ - libraries/base#-#no-remote-repo#no-vcs \ - libraries/ghc-prim#-#no-remote-repo#no-vcs \ - libraries/integer-gmp#-#no-remote-repo#no-vcs \ - libraries/ghc-bignum#-#no-remote-repo#no-vcs \ - libraries/template-haskell#-#no-remote-repo#no-vcs \ - $$(shell grep '^libraries/' packages | sed 's/ */#/g'),\ - $$(eval FEL_line := $$(subst #,$$(space),$$(hashline))) \ - $$(eval FEL_libdir := $$(word 1,$$(FEL_line))) \ - $$(eval FEL_tag := $$(word 2,$$(FEL_line))) \ - $$(eval FEL_libroot := $$(patsubst libraries/%,%,$$(FEL_libdir))) \ - $$(if $$(wildcard $$(FEL_libdir)/ghc-packages), \ - $$(foreach lib,$$(shell cat $$(FEL_libdir)/ghc-packages), \ - $$(eval $$(call $1,$$(FEL_libroot)/$$(lib),$$(FEL_tag)))), \ - $$(if $$(wildcard $$(FEL_libdir)/), \ - $$(eval $$(call $1,$$(FEL_libroot),$$(FEL_tag)))))) -endef diff --git a/rules/haddock.mk b/rules/haddock.mk deleted file mode 100644 index b6d8e97051..0000000000 --- a/rules/haddock.mk +++ /dev/null @@ -1,93 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -ifneq "$(BINDIST)" "YES" -HADDOCK_VER := $(shell grep "^version:" utils/haddock/haddock.cabal | sed "s/version: *//") -HADDOCK_MAJOR_VER := $(shell echo $(HADDOCK_VER) | sed 's/\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)/\1/') -HADDOCK_MINOR_VER := $(shell echo $(HADDOCK_VER) | sed 's/\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)/\2/') -HADDOCK_PATCH_VER := $(shell echo $(HADDOCK_VER) | sed 's/\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)/\3/') -HADDOCK_VERSION_STRING := $(shell echo $$(($(HADDOCK_MAJOR_VER) * 1000 + $(HADDOCK_MINOR_VER) * 10 + $(HADDOCK_PATCH_VER)))) -endif - -define haddock # args: $1 = dir, $2 = distdir -$(call trace, haddock($1,$2)) -$(call profStart, haddock($1,$2)) - -ifeq "$$($1_$2_DO_HADDOCK)" "YES" - -ifeq "$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE)" "" -$$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE = $1/$2/doc/html/$$($1_PACKAGE)/$$($1_PACKAGE).haddock -ALL_HADDOCK_FILES += $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) -else -$$(error Already got a haddock file for $$($1_PACKAGE)) -endif - -haddock: html_$1 - -ifeq "$$(HADDOCK_DOCS)" "YES" -$(call all-target,$1_$2_haddock,html_$1) -endif - -.PHONY: html_$1 -html_$1 : $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) - -# See Note [inconsistent distdirs] in rules/build-package-way.mk for why -# we hard-code dist-install; GHC will use stage2/stage3 here so we -# cannot use the distdir parameter. -$$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS = $$(foreach n,$$($1_$2_DEPS),$$($$n_HADDOCK_FILE) $$($$n_dist-install_$$(HADDOCK_WAY)_LIB)) - -# We don't pass -dcore-lint to haddock because it caused a performance regression in #13789 -$1_$2_HADDOCK_GHC_OPTS = $$(foreach opt, $$(filter-out -dcore-lint,$$($1_$2_$$(HADDOCK_WAY)_ALL_HC_OPTS)),--optghc=$$(opt)) - -ifeq "$$(HSCOLOUR_SRCS)" "YES" -$1_$2_HADDOCK_FLAGS += --source-module=src/%{MODULE/./-}.html --source-entity=src/%{MODULE/./-}.html\#%{NAME} -endif - -ifneq "$$(BINDIST)" "YES" - -# We need the quadruple dollars for the dependencies, as it isn't -# guaranteed that we are processing the packages in dependency order, -# so we don't want to expand it yet. -$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$$$(haddock_INPLACE) $$$$(ghc-cabal_INPLACE) $$($1_$2_HS_SRCS) $$$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS) | $$$$(dir $$$$@)/. -ifeq "$$(HSCOLOUR_SRCS)" "YES" - "$$(ghc-cabal_INPLACE)" hscolour $1 $2 -endif - # N.B. in a source tree from tarball the testsuite/ directory may not exist - mkdir -p $$(TOP)/testsuite/tests/perf/haddock - "$$(TOP)/$$(INPLACE_BIN)/haddock" \ - --verbosity=0 \ - --odir="$1/$2/doc/html/$$($1_PACKAGE)" \ - --dump-interface=$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) \ - --html \ - --hoogle \ - --quickjump \ - --title="$$($1_PACKAGE)-$$($1_$2_VERSION)$$(if $$(strip $$($1_$2_SYNOPSIS)),: $$(strip $$($1_$2_SYNOPSIS)),)" \ - --prologue="$1/$2/haddock-prologue.txt" \ - --optghc="-D__HADDOCK_VERSION__=$$(HADDOCK_VERSION_STRING)" \ - $$(foreach mod,$$($1_$2_HIDDEN_MODULES),--hide=$$(mod)) \ - $$(foreach pkg,$$($1_$2_DEPS),$$(if $$($$(pkg)_HADDOCK_FILE),--read-interface=../$$(pkg)$$(comma)../$$(pkg)/src/%{MODULE/./-}.html\#%{NAME}$$(comma)$$($$(pkg)_HADDOCK_FILE))) \ - $$($1_$2_HADDOCK_GHC_OPTS) \ - $$($1_$2_HADDOCK_FLAGS) $$($1_$2_HADDOCK_OPTS) \ - $$($1_$2_HS_SRCS) \ - $$($1_$2_EXTRA_HADDOCK_SRCS) \ - $$(EXTRA_HADDOCK_OPTS) \ - +RTS -t"$$(TOP)/testsuite/tests/perf/haddock/$$($1_PACKAGE).t" --machine-readable - -# Make the haddocking depend on the library .a file, to ensure -# that we wait until the library is fully built before we haddock it -$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$($1_$2_$$(HADDOCK_WAY)_LIB) -endif - -endif # $1_$2_DO_HADDOCK - -$(call profEnd, haddock($1,$2)) -endef diff --git a/rules/hi-rule.mk b/rules/hi-rule.mk deleted file mode 100644 index be4a460abe..0000000000 --- a/rules/hi-rule.mk +++ /dev/null @@ -1,110 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -# Here's an interesting rule! - -# The .hi file may or may not change when we compile the corresponding -# .hs file. If GHC figures out that the .hi file has not changed, it -# doesn't touch it. This is a useful optimisation, because it means -# some modules may not get recompiled if the .hi files of the modules -# they depend on have not changed. -# -# See: -# https://gitlab.haskell.org/ghc/ghc/wikis/commentary/compiler/recompilation-avoidance -# -# So how do we express this dependency to make? The exact form of -# this rule is quite fragile. Here are some versions that don't work -# very well: -# -# %.hi : %.o -# @if [ ! -f $@ ] ; then \ -# echo Panic! $< exists, but $@ does not.; \ -# exit 1; \ -# fi -# -# This version adds a useful sanity check, and is a good solution, -# except that it means spawning a shell. This can be expensive, -# especially on Windows where spawning a shell takes about 0.3s. -# We'd like to avoid the shell if necessary. This also hides the -# message "nothing to be done for 'all'", since make thinks it has -# actually done something. Therefore we only use this version -# if ExtraMakefileSanityChecks is enabled. -# -# %.hi : %.o -# -# This version doesn't work: GNU make knows it has't done anything to -# update the .hi file, so even if the .o file has been updated, it -# won't rebuild anything that depends on the .hi file. So you might -# think a more correct way is to change the .hs rule: -# -# %.hi %.o : %.hs -# $(HC) ... -# -# this says "compiling %.hs updates both %.hi and %.o", but that's not -# true, since compiling the .hs file might not update the .hi file, if -# the .hi file didn't change. And if we use this version, then make -# will keep trying to rebuild %.hi if it is out of date with respect -# to %.hs. -# -# Using this form seems to be the best compromise: -# -# %.hi : %.o ; -# -# the ';' at the end signifies an "empty command" (see the GNU make -# documentation). An empty command is enough to get GNU make to think -# it has updated %.hi, but without actually spawning a shell to do so. -# -# However, given that rule, make thinks that it can make .hi files -# for any object file, even if the object file was created from e.g. -# a C source file. We therefore also add a dependency on the .hs/.lhs -# source file, which means we end up with rules like: -# -# a/%.hi : a/%.o b/%.hs ; -# -# But! If a file is not explicitly mentioned in a makefile, then if -# make needs to build it using such a %-rule then it treats it as an -# 'intermediate file', and deletes it when it is finished. Most .hi -# files are mentioned in .depend* files, as some other module depends on -# them, but there are some library modules that aren't imported by -# anything in the tree. -# -# We could stop make from deleting the .hi files by declaring -# ".SECONDARY:", but if we do that then make takes a pathologically long -# time with our build system. So we now generate (by calling hi-rule -# from .depend* files) rules that look like -# -# a/B.hi a/B.dyn_hi : %hi : %o x/B.hs -# -# Now all the .hi files are explicitly mentioned in the makefiles, so -# make doesn't think they are merely intermediate files, and doesn't -# delete them. - -ifeq "$(ExtraMakefileSanityChecks)" "NO" - -define hi-rule # $1 = rule header -$1 ; -endef - -else - -define hi-rule # $1 = rule header -$1 - @if [ ! -f $$@ ] ; then \ - echo "Panic! $$< exists, but $$@ does not."; \ - exit 1; \ - fi - -endef - -endif - diff --git a/rules/hs-objs.mk b/rules/hs-objs.mk deleted file mode 100644 index f46e527343..0000000000 --- a/rules/hs-objs.mk +++ /dev/null @@ -1,17 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define hs-objs # args: $1 = dir, $2 = distdir, $3 = way -$1_$2_$3_HS_OBJS = $$(patsubst %,$1/$2/build/%.$$($3_osuf),$$($1_$2_SLASH_MODS)) -$1_$2_$3_HI = $$(patsubst %,$1/$2/build/%.$$($3_hisuf),$$($1_$2_SLASH_MODS)) -endef diff --git a/rules/hs-sources.mk b/rules/hs-sources.mk deleted file mode 100644 index 1df4ed7a89..0000000000 --- a/rules/hs-sources.mk +++ /dev/null @@ -1,58 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define hs-sources # args: $1 = dir, $2 = distdir - -ifeq "$$($1_$2_HS_SRC_DIRS)" "" -$1_$2_HS_SRC_DIRS = . -endif - -# Here we collect all the .hs/.lhs source files that we can find. If -# we can't find a Haskell source file for a given module, then presumably -# it can be generated by preprocessing something (.hsc, .y, .x etc.), so -# we depend on dist/build/Foo.hs in anticipation that the implicit rules -# will put the preprocessed source file there. -# -# NB. use :=, we only want this thing evaluated once. -# -$1_$2_HS_SRCS := $$(foreach file,$$($1_$2_SLASH_MODS),\ - $$(firstword \ - $$(wildcard \ - $$(foreach dir,$$($1_$2_HS_SRC_DIRS) $2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen,\ - $1/$$(dir)/$$(file).hs $1/$$(dir)/$$(file).lhs)) \ - $1/$2/build/$$(file).hs)) - -# .hs-boot files must be in the same place as the .hs file they go -# with (GHC assumes this). When we preprocess a source file, and -# that module has a .hs-boot or .lhs-boot file, we must arrange to -# copy the file into the distdir so that it ends up alongside the -# preprocessed .hs file. This complicated macro figures out for which -# files we need to do this, so we can add them as dependencies of the -# .depend file rule. -# -# for each .hs file in the build dir, -# if there is a .hs-boot or .lhs-boot file for it in a source dir, -# we want that file in the build dir. -# -# NB. use :=, we only want this thing evaluated once. -# -$1_$2_HS_BOOT_SRCS := $$(foreach dir,$$($1_$2_HS_SRC_DIRS),\ - $$(subst $1/$$(dir),$1/$2/build,\ - $$(wildcard \ - $$(subst $1/$2/build,$1/$$(dir),\ - $$(foreach file,\ - $$(filter $1/$2/build%,$$($1_$2_HS_SRCS)),\ - $$(patsubst %.hs,%.hs-boot,$$(file)) \ - $$(patsubst %.hs,%.lhs-boot,$$(file))))))) - -endef diff --git a/rules/hs-suffix-rules-srcdir.mk b/rules/hs-suffix-rules-srcdir.mk deleted file mode 100644 index 1798bfb0b1..0000000000 --- a/rules/hs-suffix-rules-srcdir.mk +++ /dev/null @@ -1,50 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define hs-suffix-rules-srcdir -# args: $1 = dir, $2 = distdir, $3 = srcdir - -# Preprocessing Haskell source - -ifneq "$$(BINDIST)" "YES" - -$1/$2/build/%.hs : $1/$3/%.ly | $$$$(dir $$$$@)/. - $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@ - -$1/$2/build/%.hs : $1/$3/%.y | $$$$(dir $$$$@)/. - $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@ - -$1/$2/build/%.hs : $1/$2/build/%.ly | $$$$(dir $$$$@)/. - $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@ - -$1/$2/build/%.hs : $1/$2/build/%.y | $$$$(dir $$$$@)/. - $$(call cmd,HAPPY) $$($1_$2_ALL_HAPPY_OPTS) $$< -o $$@ - -$1/$2/build/%.hs : $1/$3/%.x | $$$$(dir $$$$@)/. - $$(call cmd,ALEX) $$($1_$2_ALL_ALEX_OPTS) $$< -o $$@ - -$1/$2/build/%_hsc.c $1/$2/build/%_hsc.h $1/$2/build/%.hs : $1/$3/%.hsc $$$$(hsc2hs_INPLACE) | $$$$(dir $$$$@)/. - $$(call cmd,hsc2hs_INPLACE) $$($1_$2_ALL_HSC2HS_OPTS) $$< -o $$@ - -# Now the rules for hs-boot files. - -$1/$2/build/%.hs-boot : $1/$3/%.hs-boot | $$$$(dir $$$$@)/. - "$$(CP)" $$< $$@ - -$1/$2/build/%.lhs-boot : $1/$3/%.lhs-boot | $$$$(dir $$$$@)/. - "$$(CP)" $$< $$@ - -endif - -endef - diff --git a/rules/hs-suffix-way-rules-srcdir.mk b/rules/hs-suffix-way-rules-srcdir.mk deleted file mode 100644 index 7223b553ba..0000000000 --- a/rules/hs-suffix-way-rules-srcdir.mk +++ /dev/null @@ -1,94 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define hs-suffix-way-rules-srcdir -# args: $1 = dir, $2 = distdir, $3 = way, $4 = srcdir - -ifneq "$$(BINDIST)" "YES" - -# Compiling Haskell source - -$1/$2/build/%.$$($3_osuf) : $1/$4/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) - $$(call ohi-sanity-check,$1,$2,$3,$1/$2/build/$$*) - -$1/$2/build/%.$$($3_osuf) : $1/$4/%.lhs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) - $$(call ohi-sanity-check,$1,$2,$3,$1/$2/build/$$*) - -$1/$2/build/%.$$($3_hcsuf) : $1/$4/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@ - -$1/$2/build/%.$$($3_hcsuf) : $1/$4/%.lhs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@ - -# XXX: for some reason these get used in preference to the direct -# .hs->.o rule, I don't know why --SDM - -$1/$2/build/%.$$($3_osuf) : $1/$4/%.hc | $$$$(dir $$$$@)/. - $$(call cmd,$1_$2_CC) \ - $$($1_$2_$3_ALL_CC_OPTS) \ - -x c -c $$< -o $$@ \ - $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc - $$(call cmd,$1_$2_CC) \ - $$($1_$2_$3_ALL_CC_OPTS) \ - -x c -c $$< -o $$@ \ - $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) - -# $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_hcsuf) -# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ -# -# $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hc -# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ -# -# $1/$2/build/%.$$($3_ssuf) : $1/$2/build/%.$$($3_hcsuf) -# $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -S $$< -o $$@ - -# Now the rules for hs-boot files. - -$1/$2/build/%.$$($3_o-bootsuf) : $1/$4/%.hs-boot $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf)-boot,$$(basename $$@))) - -$1/$2/build/%.$$($3_o-bootsuf) : $1/$4/%.lhs-boot $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) $$($1_$2_PKGDATA_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf)-boot,$$(basename $$@))) - -# stubs are automatically generated and compiled by GHC - -$1/$2/build/%_stub.$$($3_osuf): $1/$2/build/%.$$($3_osuf) - @: - -endif - -endef - -ifeq "$(ExtraMakefileSanityChecks)" "NO" -ohi-sanity-check = -else -# We don't look for the .hi file if this is for a program, as if the -# Main module is in foo.hs then we get foo.o but Main.hi -define ohi-sanity-check - @for f in $4.$($3_osuf) \ - $(if $($1_$2_PROG),,$4.$($3_hisuf)) \ - $(if $(findstring v,$3), \ - $(if $(findstring YES,$($1_$2_DYNAMIC_TOO)), \ - $4.$(dyn_osuf) $4.$(dyn_hisuf))); do \ - if [ ! -f $$f ]; then \ - echo "Panic! $$f not created."; \ - exit 1; \ - fi; \ - done -endef -endif - diff --git a/rules/hs-suffix-way-rules.mk b/rules/hs-suffix-way-rules.mk deleted file mode 100644 index e75d7b458e..0000000000 --- a/rules/hs-suffix-way-rules.mk +++ /dev/null @@ -1,132 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define hs-suffix-way-rules # args: $1 = dir, $2 = distdir, $3 = way - -ifeq "$3 $$($1_$2_DYNAMIC_TOO)" "dyn YES" -# We only want this rule to be used for Haskell sources, not for -# e.g. C sources, so we depend on the v_hisuf rather than v_osuf. -$1/$2/build/%.$$(dyn_osuf): $1/$2/build/%.$$(v_hisuf) - @if [ ! -f $$@ ] ; then \ - echo "Panic! $$< exists, but $$@ does not."; \ - exit 1; \ - fi - -$1/$2/build/%.$$(dyn_osuf)-boot: $1/$2/build/%.$$(v_hisuf)-boot - @if [ ! -f $$@ ] ; then \ - echo "Panic! $$< exists, but $$@ does not."; \ - exit 1; \ - fi -else - -# Note [Implicit rule search algorithm] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# The order in which implicit rules are defined can influence a build. -# -# Case study: genprimops/Lexer.hs -# -# We have two implicit rules for creating .o files, which after instantiating -# with a specific directory ($1=utils/genprimops) and distdir ($2=dist) look -# like this: -# -# utils/genprimops/dist/build/%.o : utils/genprimops/dist/build/%.hs -# -# utils/genprimops/dist/build/%.o : utils/genprimops/./%.hs -# -# -# The first rule is defined in hs-suffix-way-rules.mk (this file), the other -# in hs-suffix-way-rules-srcdir.mk. -# -# Assume for rest of this story that %=Lexer. -# -# In a normal repository checkout, neither Lexer.hs exists, but we have a rule -# to generate the one in the build directory by running alex on Lexer.x (the -# rule for that operation is defined in hs-suffix-rules-srcdir.mk). Since make -# needs to make a choice which of the above two implicit rules to follow (it -# never runs 2 recipes for the same target, unless double colon rules are -# used, which we don't), logically it will choose the first rule: Lexer.o will -# depend on Lexer.hs in the build directory, that file will be built, and then -# Lexer.o can be built. -# -# In an sdist however, Lexer.hs is present in the source directory. It was -# copied there during the creation of the sdist by a rule in -# sdist-ghc-file.mk. And this time we *don't* know how to generate the -# Lexer.hs in the build directory, because 1) alex is not installed when -# building from sdist and 2) the sdist creation process renamed Lexer.x to -# Lexer.x.source. So normally make would now choose the second rule: Lexer.o -# will depend on Lexer.hs in the source directory, for which nothing needs to -# be done, and then Lexer.o can be built. -# -# There is however another actor in play, a rule in sdist-ghc-file.mk, which -# after after instantiating with the same directory ($1=utils/genprimops) and -# distdir ($2=dist) looks like this: -# -# sdist_utils/genprimops_dist_Lexer : utils/genprimops/dist/build/Lexer.hs -# -# Note that this is not an implicit rule, there aren't any %'s. This rule -# *explicitly* depends on Lexer.hs in the build directory. What follows is the -# following: -# -# * make thinks Lexer.hs in the build directory "ought to exist" [1], -# because it is an explicit dependency of /some/ target. -# -# * this puts our two implicit rules on equal footing: one depends on a -# file that exists, the other on a file that ought to exist. Make's -# implicit rule search algorithm doesn't distinguish between these two -# cases [1]. -# -# * to break the tie, make chooses the rule that is defined first. Lexer.o -# will depend on Lexer.hs in the build directory, which doesn't exist, -# and which make doesn't know how to build, causing a build failure. -# -# To prevent this from happening we define rules for haskell source files in -# the source directory before those in the distdir. -# -# Alternative solutions: -# -# * Don't include the explicit rule above when not creating an sdist, as -# that is the only time when it is needed. -# -# * Merge the two implicit rules, with help from $1_$2_HS_SRCS from -# hs-sources.mk, which is sdist aware. -# -# * Require alex and happy to be installed when building from an sdist, -# simplifying all this drastically. -# -# [1] https://www.gnu.org/software/make/manual/make.html#Implicit-Rule-Search - -$$(foreach dir,$$($1_$2_HS_SRC_DIRS),\ - $$(eval $$(call hs-suffix-way-rules-srcdir,$1,$2,$3,$$(dir)))) - - -ifneq "$$(BINDIST)" "YES" - -$1/$2/build/%.$$($3_hcsuf) : $1/$2/build/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) - -$1/$2/build/%.$$($3_hcsuf) : $1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -C $$< -o $$@ - -$1/$2/build/%.$$($3_osuf) : $1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/%.hs $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) - $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno $$(addsuffix .$$(dyn_osuf),$$(basename $$@))) - -endif - - -endif - -endef # hs-suffix-way-rules - diff --git a/rules/include-dependencies.mk b/rules/include-dependencies.mk deleted file mode 100644 index 7d4c38b73b..0000000000 --- a/rules/include-dependencies.mk +++ /dev/null @@ -1,45 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define include-dependencies -$(call trace, include-dependencies($1,$2,$3)) -$(call profStart, include-dependencies($1,$2,$3)) -# $1 = dir -# $2 = distdir -# $3 = GHC stage to use (0 == bootstrapping compiler) - -$1_$2_INCLUDE_DEPFILES = YES -ifeq "$$(NO_INCLUDE_DEPS)" "YES" -$1_$2_INCLUDE_DEPFILES = NO -endif -ifneq "$$(ONLY_DEPS_FOR)" "" -ifeq "$$(filter $1_$2,$$(ONLY_DEPS_FOR))" "" -$1_$2_INCLUDE_DEPFILES = NO -endif -endif - -ifeq "$$($1_$2_INCLUDE_DEPFILES)" "YES" -ifneq "$$(strip $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS))" "" -ifneq "$$(NO_STAGE$3_DEPS)" "YES" -include $$($1_$2_depfile_haskell) -endif -endif -include $$($1_$2_depfile_c_asm) -else -ifeq "$$(DEBUG)" "YES" -$$(warning not building dependencies in $1) -endif -endif - -$(call profEnd, include-dependencies($1,$2,$3)) -endef - diff --git a/rules/includes-sources.mk b/rules/includes-sources.mk deleted file mode 100644 index fca114bffd..0000000000 --- a/rules/includes-sources.mk +++ /dev/null @@ -1,26 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define includes-sources # args: $1 = dir, $2 = distdir - -ifeq "$$($1_$2_INCLUDE_DIRS)" "" -$1_$2_INCLUDE_DIRS = . -endif - -$1_$2_INSTALL_INCLUDES_SRCS :=\ - $$(foreach file,$$($1_$2_INSTALL_INCLUDES),\ - $$(firstword \ - $$(wildcard \ - $$(foreach dir,$$($1_$2_INCLUDE_DIRS),\ - $1/$$(dir)/$$(file))))) -endef diff --git a/rules/library-path.mk b/rules/library-path.mk deleted file mode 100644 index 9a398eebf0..0000000000 --- a/rules/library-path.mk +++ /dev/null @@ -1,21 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2010 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# $1 = paths to prepend -ifeq "$(TargetOS_CPP)" "mingw32" -prependLibraryPath = $(error Do not know how to prependLibraryPath on Windows) -else ifeq "$(TargetOS_CPP)" "darwin" -prependLibraryPath = export DYLD_LIBRARY_PATH="$1$${DYLD_LIBRARY_PATH:+:$$DYLD_LIBRARY_PATH}" -else -prependLibraryPath = export LD_LIBRARY_PATH="$1$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}" -endif - diff --git a/rules/make-command.mk b/rules/make-command.mk deleted file mode 100644 index 17d0921525..0000000000 --- a/rules/make-command.mk +++ /dev/null @@ -1,21 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2010 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# $1 = the line -# The formatting of this definition (in particular, the blank line at -# the start) is important, in order to get make to generate the right -# makefile code. - -define make-command - - $1 -endef diff --git a/rules/manual-package-config.mk b/rules/manual-package-config.mk deleted file mode 100644 index a9993d9fae..0000000000 --- a/rules/manual-package-config.mk +++ /dev/null @@ -1,45 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define manual-package-config -# args: -# $1 = dir -# $2 = distdir -$(call trace, manual-package-config($1, $2)) -$(call profStart, manual-package-config($1, $2)) - -$1/$2/package.conf.inplace : $1/package.conf.in $$$$(ghc-pkg_INPLACE) | $$$$(dir $$$$@)/. - $$(HS_CPP) -P \ - -DTOP='"$$(TOP)"' \ - $$($1_$2_PACKAGE_CPP_OPTS) \ - -x c $$< -o $$@.raw - grep -v '^#pragma GCC' $$@.raw | \ - sed -e 's/""//g' -e 's/:[ ]*,/: /g' > $$@ - - "$$(ghc-pkg_INPLACE)" update --force $$@ - -# This is actually a real file, but we need to recreate it on every -# "make install", so we declare it as phony -.PHONY: $1/$2/package.conf.install -$1/$2/package.conf.install : $1/package.conf.in | $$$$(dir $$$$@)/. - $$(HS_CPP) -P \ - -DINSTALLING \ - -DLIB_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/$1"' \ - -DINCLUDE_DIR='"$$(if $$(filter YES,$$(RelocatableBuild)),$$$$topdir,$$(ghclibdir))/$1/include"' \ - $$($1_$2_PACKAGE_CPP_OPTS) \ - -x c $1/package.conf.in -o $$@.raw - grep -v '^#pragma GCC' $$@.raw | \ - sed -e 's/""//g' -e 's/:[ ]*,/: /g' >$$@ - -$(call profEnd, manual-package-config($1)) -endef diff --git a/rules/package-config.mk b/rules/package-config.mk deleted file mode 100644 index 86054071ad..0000000000 --- a/rules/package-config.mk +++ /dev/null @@ -1,69 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -define package-config # args: $1 = dir, $2 = distdir, $3 = GHC stage -$(call trace, package-config($1,$2,$3)) -$(call profStart, package-config($1,$2,$3)) - -$1_$2_HC = $$(GHC_STAGE$3) -$1_$2_CC = $$(CC_STAGE$3) -$1_$2_AS = $$(AS_STAGE$3) -$1_$2_AR = $$(AR_STAGE$3) -$1_$2_AR_OPTS = $$(AR_OPTS_STAGE$3) -$1_$2_EXTRA_AR_ARGS = $$(EXTRA_AR_ARGS_STAGE$3) -$1_$2_ArSupportsAtFile = $$(ArSupportsAtFile_STAGE$3) - -# configuration stuff that depends on which GHC we're building with -ifeq "$3" "0" -$1_$2_HC_CONFIG = $$(GHC_STAGE0) -$1_$2_HC_CONFIG_DEP = -$1_$2_GHC_PKG = $$(GHC_PKG) -$1_$2_GHC_PKG_DEP = -$1_$2_HC_MK_DEPEND = $$($1_$2_HC) -# We can't make rules depend on the bootstrapping compiler, as then -# on cygwin we get a dep on c:/ghc/..., and make gets confused by the : -$1_$2_HC_MK_DEPEND_DEP = -$1_$2_HC_DEP = -$1_$2_HC_PKGCONF = -package-db $$(BOOTSTRAPPING_CONF) -$1_$2_GHC_PKG_OPTS = --package-db=$$(BOOTSTRAPPING_CONF) -$1_$2_CONFIGURE_OPTS += --package-db=$$(TOP)/$$(BOOTSTRAPPING_CONF) -$1_$2_MORE_HC_OPTS += -no-user-package-db -$1_$2_MORE_HC_OPTS += -rtsopts -else -$1_$2_HC_PKGCONF = -$1_$2_HC_CONFIG = $$(TOP)/$$(GHC_STAGE1) -$1_$2_HC_CONFIG_DEP = $$(GHC_STAGE1) -$1_$2_GHC_PKG = $$(TOP)/$$(ghc-pkg_INPLACE) -$1_$2_GHC_PKG_DEP = $$$$(ghc-pkg_INPLACE) -$1_$2_GHC_PKG_OPTS = -# If stage is not 0 then we always use stage1 for making .depend, as later -# stages aren't available early enough -$1_$2_HC_MK_DEPEND = $$(GHC_STAGE1) -$1_$2_HC_MK_DEPEND_DEP = $$($1_$2_HC_MK_DEPEND) -$1_$2_HC_DEP = $$($1_$2_HC) -$1_$2_MORE_HC_OPTS += -no-user-package-db -$1_$2_MORE_HC_OPTS += -rtsopts -endif - -# Used by pretty_commands.mk -label_$1_$2_CC=CC -label_$1_$2_AS=AS -label_$1_$2_AR=AR -label_$1_$2_HC=HC [stage $3] -label_$1_$2_GHC_PKG=GHC PKG - -# Useful later -$1_$2_SLASH_MODS = $$(subst .,/,$$($1_$2_MODULES)) - -$(call profEnd, package-config($1,$2,$3)) -endef diff --git a/rules/pretty_commands.mk b/rules/pretty_commands.mk deleted file mode 100644 index f7576e171f..0000000000 --- a/rules/pretty_commands.mk +++ /dev/null @@ -1,13 +0,0 @@ -ifneq ($(V),1) -cmd = @echo ' $(if $(label_$1),$(label_$1),$1) $@'; "$($1)" -else -cmd = "$($1)" -endif - -label_ALEX=ALEX -label_HAPPY=HAPPY -label_hsc2hs_INPLACE=HSC2HS - - - - diff --git a/rules/prof.mk b/rules/prof.mk deleted file mode 100644 index 5733b415ca..0000000000 --- a/rules/prof.mk +++ /dev/null @@ -1,20 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2010 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define profStart -$$(if $(PROF),$$(info $$(shell date +%s.%N): Start $1)) -endef - -define profEnd -$$(if $(PROF),$$(info $$(shell date +%s.%N): End $1)) -endef - diff --git a/rules/sdist-ghc-file.mk b/rules/sdist-ghc-file.mk deleted file mode 100644 index b1e13a1ea0..0000000000 --- a/rules/sdist-ghc-file.mk +++ /dev/null @@ -1,77 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -# Add files generated by alex and happy to a source distribution. -# -# Invoke like this: -# -# $(eval $(call sdist-ghc-file,compiler,stage2,parser,Parser,y)) -# -# This adds the file 'compiler/stage2/build/Parser.hs' to the sdist, in the -# same directory as 'compiler/GHC/Parser.y' (which is renamed). - -define sdist-ghc-file -# $1 = dir -# $2 = distdir -# $3 = srcdir (can be empty) -# $4 = filename -# $5 = extension - -.PHONY: sdist_$1_$2_$4 - -# We should do this before creating the `sdist-ghc` tarball, or when just -# running `make sdist-ghc-prep`. -sdist-ghc-prep : sdist_$1_$2_$4 - -# But first create SRC_DIST_GHC_DIR. -sdist_$1_$2_$4 : sdist-ghc-prep-tree - -# Generate the .hs files if they don't exist yet, then do actual copying and -# moving. -sdist_$1_$2_$4 : $1/$2/build/$4.hs - "$(CP)" $1/$2/build/$4.hs $(SRC_DIST_GHC_DIR)/$1/$3/$$(dir $4) - mv $(SRC_DIST_GHC_DIR)/$1/$3/$4.$5 $(SRC_DIST_GHC_DIR)/$1/$3/$4.$5.source - -# And make sure the rules for generating the .hs files exist, even when we -# didn't generate all package-data.mk files. -$$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$3)) -endef - -# ----------------------------------------------------------------------------- -# Variant of sdist-ghc-file whose `$3`-argument is interpreted -# differently in a more appropriate way for cabal-packages - -define sdist-ghc-file2 -# $1 = dir -# $2 = distdir -# $3 = moduledir -# $4 = filename -# $5 = extension - -.PHONY: sdist_$1_$2_$4 - -# We should do this before creating the `sdist-ghc` tarball, or when just -# running `make sdist-ghc-prep`. -sdist-ghc-prep : sdist_$1_$2_$4 - -# But first create SRC_DIST_GHC_DIR. -sdist_$1_$2_$4 : sdist-ghc-prep-tree - -# Generate the .hs files if they don't exist yet, then do actual copying and -# moving. -sdist_$1_$2_$4 : $1/$2/build/$3/$4.hs - "$(CP)" $1/$2/build/$3/$4.hs $(SRC_DIST_GHC_DIR)/$1/$3 - mv $(SRC_DIST_GHC_DIR)/$1/$3/$4.$5 $(SRC_DIST_GHC_DIR)/$1/$3/$4.$5.source - -# And make sure the rules for generating the .hs files exist, even when we -# didn't generate all package-data.mk files. -$$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$3)) -endef diff --git a/rules/shell-wrapper.mk b/rules/shell-wrapper.mk deleted file mode 100644 index 37d01e6ecd..0000000000 --- a/rules/shell-wrapper.mk +++ /dev/null @@ -1,120 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009-2012 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define shell-wrapper -$(call trace, shell-wrapper($1,$2)) -$(call profStart, shell-wrapper($1,$2)) -# $1 = dir -# $2 = distdir - -ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" "" -$1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROGNAME).wrapper -endif - - -ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" - -$1_$2_INPLACE_SHELL_WRAPPER_NAME = $$($1_$2_PROG) - -ifeq "$$($1_$2_TOPDIR)" "YES" -$1_$2_INPLACE_WRAPPER = $$(INPLACE_LIB)/bin/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME) -else -$1_$2_INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_INPLACE_SHELL_WRAPPER_NAME) -endif - -all_$1_$2 : $$($1_$2_INPLACE_WRAPPER) - -$(call clean-target,$1,$2_inplace_wrapper,$$($1_$2_INPLACE_WRAPPER)) - -$$($1_$2_INPLACE_WRAPPER): WRAPPER=$$@ -ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" -$$($1_$2_INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME) -endif -$$($1_$2_INPLACE_WRAPPER): $$($1_$2_INPLACE) - $$(call removeFiles, $$@) - echo '#!/bin/sh' >> $$@ - echo 'executablename="$$(TOP)/$$<"' >> $$@ - echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@ - echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@ - echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@ - echo 'pgmgcc="$$(CC)"' >> $$@ - $$($1_$2_SHELL_WRAPPER_EXTRA) - $$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA) -ifeq "$$(DYNAMIC_GHC_PROGRAMS)" "YES" - echo '$$(call prependLibraryPath,$$($1_$2_DEP_LIB_DIRS_SEARCHPATH))' >> $$@ -endif -ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" - cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@ -else - echo 'exec "$$$$executablename" $$$${1+"$$$$@"}' >> $$@ -endif - $$(EXECUTABLE_FILE) $$@ - -endif # $1_$2_WANT_INPLACE_WRAPPER - - -ifeq "$$($1_$2_WANT_INSTALLED_WRAPPER)" "YES" - -ifeq "$$($1_$2_INSTALL_SHELL_WRAPPER_NAME)" "" -$1_$2_INSTALL_SHELL_WRAPPER_NAME = $$($1_$2_PROG) -endif - -# Install the binary in $(ghclibexecdir), and install a shell wrapper in $(bindir) -INSTALL_LIBEXECS += $1/$2/build/tmp/$$($1_$2_PROG) -BINDIST_WRAPPERS += $$($1_$2_SHELL_WRAPPER_NAME) - -install: install_$1_$2_wrapper - -.PHONY: install_$1_$2_wrapper -install_$1_$2_wrapper: WRAPPER=$$(DESTDIR)$$(bindir)/$(CrossCompilePrefix)$$($1_$2_INSTALL_SHELL_WRAPPER_NAME) -install_$1_$2_wrapper: - $$(INSTALL_DIR) "$$(DESTDIR)$$(bindir)" - $$(call removeFiles, "$$(WRAPPER)") - $$(CREATE_SCRIPT) "$$(WRAPPER)" - echo '#!/bin/sh' >> "$$(WRAPPER)" - echo 'exedir="$$(ghclibexecdir)/bin"' >> "$$(WRAPPER)" - echo 'exeprog="$$($1_$2_PROG)"' >> "$$(WRAPPER)" - echo 'executablename="$$$$exedir/$$$$exeprog"' >> "$$(WRAPPER)" - echo 'datadir="$$(datadir)"' >> "$$(WRAPPER)" - echo 'bindir="$$(bindir)"' >> "$$(WRAPPER)" - echo 'topdir="$$(topdir)"' >> "$$(WRAPPER)" - $$($1_$2_SHELL_WRAPPER_EXTRA) - $$($1_$2_INSTALL_SHELL_WRAPPER_EXTRA) - cat $$($1_$2_SHELL_WRAPPER_NAME) >> "$$(WRAPPER)" - $$(EXECUTABLE_FILE) "$$(WRAPPER)" - -endif # $1_$2_WANT_INSTALLED_WRAPPER - - -ifeq "$$($1_$2_WANT_BINDIST_WRAPPER)" "YES" -ifneq "$$(TargetOS_CPP)" "mingw32" - -$1_$2_BINDIST_WRAPPER = $1/$2/build/tmp/$$($1_$2_PROGNAME)-bindist - -all_$1_$2 : $$($1_$2_BINDIST_WRAPPER) - -BINDIST_EXTRAS += $$($1_$2_BINDIST_WRAPPER) - -$$($1_$2_BINDIST_WRAPPER): $1/$2/build/tmp/$$($1_$2_PROG) - $$(call removeFiles, $$@) - echo '#!/bin/sh' >> $$@ -ifeq "$$(DYNAMIC_GHC_PROGRAMS)" "YES" - echo '$$(call prependLibraryPath,$$($1_$2_DEP_LIB_REL_DIRS_SEARCHPATH))' >> $$@ -endif - echo 'exec "$$<" $$$${1+"$$$$@"}' >> $$@ - $$(EXECUTABLE_FILE) $$@ - -endif -endif # $1_$2_WANT_BINDIST_WRAPPER - -$(call profEnd, shell-wrapper($1,$2)) -endef diff --git a/rules/sphinx.mk b/rules/sphinx.mk deleted file mode 100644 index 38692a8cdb..0000000000 --- a/rules/sphinx.mk +++ /dev/null @@ -1,77 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - - -# Build Sphinx documentation - -# We are careful not to use the same directory the doctree files for the -# various Sphinx targets as make may run them in parallel (see #10950). - -define sphinx -$(call trace, sphinx($1,$2)) -$(call profStart, sphinx($1,$2)) -# $1 = dir -# $2 = docname - -$(eval $(call clean-target,$1,sphinx,$1/.doctrees-html/ $1/.doctrees-pdf/ $1/build-html/ $1/build-pdf/ $1/$2.pdf)) - -# empty "all_$1" target just in case we're not building docs at all -$(call all-target,$1,) - -.PHONY: html_$1 -ifeq "$$(phase)" "final" -ifeq "$$(BUILD_SPHINX_HTML)" "YES" -$(call all-target,$1,html_$1) -INSTALL_HTML_DOC_DIRS += $1/build-html/$2 -endif -endif - -html_$1 : $1/build-html/$2/index.html -html : html_$1 - -ifneq "$$(BINDIST)" "YES" -$1/build-html/$2/index.html: $1/conf.py $$($1_RST_SOURCES) - $(SPHINXBUILD) -b html -d $1/.doctrees-html -w $1/.log -n $(SPHINXOPTS) $1 $1/build-html/$2 -endif - - -.PHONY: pdf_$1 -ifeq "$$(phase)" "final" -ifeq "$$(BUILD_SPHINX_PDF)" "YES" -$(call all-target,$1,pdf_$1) -INSTALL_DOCS += $1/$2.pdf -endif -endif - -pdf_$1 : $1/$2.pdf -pdf : pdf_$1 - -ifneq "$$(BINDIST)" "YES" -# N.B. If we don't redirect latex output to /dev/null then we end up with literally -# 30% of the build output being warnings, even in a successful build. However, -# to make sure that we don't silence errors we allow each xelatex invocation -# besides the last to fail. - -$1/$2.pdf: $1/conf.py $$($1_RST_SOURCES) - $(SPHINXBUILD) -b latex -d $1/.doctrees-pdf -w $1/.log -n $(SPHINXOPTS) $1 $1/build-pdf/$2 - cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex 2>/dev/null >/dev/null || true - cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex 2>/dev/null >/dev/null || true - cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex 2>/dev/null >/dev/null || true - cd $1/build-pdf/$2 ; $(MAKEINDEX) -s python.ist $2.idx - cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex 2>/dev/null >/dev/null || true - cd $1/build-pdf/$2 ; $(XELATEX) -halt-on-error $2.tex - cp $1/build-pdf/$2/$2.pdf $1/$2.pdf -endif - - -$(call profEnd, sphinx($1,$2)) -endef diff --git a/rules/trace.mk b/rules/trace.mk deleted file mode 100644 index ec92fea1d5..0000000000 --- a/rules/trace.mk +++ /dev/null @@ -1,21 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2010 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# A helpful little debug macro. Call it from a macro like this: -# -# $(call trace, this-macro($1,$2,$3)) -# -# And invoke the build system with TRACE=1 to turn on tracing. - -define trace -$$(if $(TRACE),$$(warning $1),) -endef diff --git a/rules/way-prelims.mk b/rules/way-prelims.mk deleted file mode 100644 index 4709149dff..0000000000 --- a/rules/way-prelims.mk +++ /dev/null @@ -1,36 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -define way-prelims # $1 = way -ifeq "$1" "v" -$1__way = -$1_way_ = -else -$1__way = _$1 -$1_way_ = $1_ -endif -$1_osuf = $$($1_way_)o -$1_o-bootsuf = $$($1_way_)o-boot -$1_hisuf = $$($1_way_)hi -$1_hcsuf = $$($1_way_)hc -$1_ssuf = $$($1_way_)s - -ifneq "$(findstring dyn,$1)" "" -# If the way includes "dyn" then it's a dynamic lib way. We mangle the -# way name to remove "dyn" (or "_dyn") and we change the suffix to -# include the versioned dynamic lib extension (eg .so or .dynlib). -# For example: thr_debug_dyn_libsuf="_thr_debug-ghc6.11.20090426.so" -$1_libsuf = $$($(subst dyn,,$(subst _dyn,,$1))__way)-ghc$(ProjectVersion)$(soext) -else -$1_libsuf = $$($1__way).a -endif -endef diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 7ccbaa3024..4c5f8d545b 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -89,7 +89,7 @@ class TestConfig: # Verbosity level self.verbose = 2 - # See Note [validate and testsuite speed] in toplevel Makefile. + # See Note [validate and testsuite speed] in `validate` self.speed = 1 self.list_broken = False diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 813e26f832..432b196053 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1092,7 +1092,7 @@ def test_common_work(watcher: testutil.Watcher, do_ways = list(filter (ok_way,all_ways)) # Only run all ways in slow mode. - # See Note [validate and testsuite speed] in toplevel Makefile. + # See Note [validate and testsuite speed] in `validate` if config.accept: # Only ever run one way do_ways = do_ways[:1] diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index 4728ab400e..4ce9bbb8a0 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -300,7 +300,7 @@ else set_list_broken = endif -# See Note [validate and testsuite speed] in toplevel Makefile. +# See Note [validate and testsuite speed] in `validate` ifneq "$(SPEED)" "" setspeed = -e config.speed="$(SPEED)" else ifeq "$(fast)" "YES" @@ -356,7 +356,7 @@ accept: $(MAKE) accept=YES fast fasttest: - # See Note [validate and testsuite speed] in toplevel Makefile. + # See Note [validate and testsuite speed] in `validate` $(MAKE) SPEED=2 slow slowtest: diff --git a/testsuite/tests/linters/notes.stdout b/testsuite/tests/linters/notes.stdout index f7f4ba63e1..00b3388183 100644 --- a/testsuite/tests/linters/notes.stdout +++ b/testsuite/tests/linters/notes.stdout @@ -50,7 +50,6 @@ ref compiler/Language/Haskell/Syntax/Binds.hs:204:31: Note [fun_id in Mat ref compiler/Language/Haskell/Syntax/Pat.hs:336:12: Note [Disambiguating record fields] ref configure.ac:212:10: Note [Linking ghc-bin against threaded stage0 RTS] ref docs/core-spec/core-spec.mng:177:6: Note [TyBinders] -ref ghc/ghc.mk:62:6: Note [Linking ghc-bin against threaded stage0 RTS] ref hadrian/src/Expression.hs:130:30: Note [Linking ghc-bin against threaded stage0 RTS] ref libraries/base/GHC/ST.hs:134:7: Note [Definition of runRW#] ref linters/lint-notes/Notes.hs:32:29: Note [" <> T.unpack x <> "] @@ -75,5 +74,4 @@ ref testsuite/tests/typecheck/should_compile/tc228.hs:9:7: Note [Inferenc ref testsuite/tests/typecheck/should_compile/tc231.hs:12:16: Note [Important subtlety in oclose] ref testsuite/tests/typecheck/should_fail/UnliftedNewtypesMultiFieldGadt.hs:11:28: Note [Kind-checking the field type] ref testsuite/tests/typecheck/should_fail/tcfail093.hs:13:7: Note [Important subtlety in oclose] -ref validate:412:14: Note [Why is there no stage1 setup function?] diff --git a/utils/check-exact/ghc.mk b/utils/check-exact/ghc.mk deleted file mode 100644 index f8ad02948b..0000000000 --- a/utils/check-exact/ghc.mk +++ /dev/null @@ -1,18 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/check-exact_USES_CABAL = YES -utils/check-exact_PACKAGE = check-exact -utils/check-exact_dist-install_PROGNAME = check-exact -utils/check-exact_dist-install_INSTALL = NO -utils/check-exact_dist-install_INSTALL_INPLACE = YES -$(eval $(call build-prog,utils/check-exact,dist-install,2)) diff --git a/utils/check-ppr/ghc.mk b/utils/check-ppr/ghc.mk deleted file mode 100644 index 08e4062256..0000000000 --- a/utils/check-ppr/ghc.mk +++ /dev/null @@ -1,18 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/check-ppr_USES_CABAL = YES -utils/check-ppr_PACKAGE = check-ppr -utils/check-ppr_dist-install_PROGNAME = check-ppr -utils/check-ppr_dist-install_INSTALL = NO -utils/check-ppr_dist-install_INSTALL_INPLACE = YES -$(eval $(call build-prog,utils/check-ppr,dist-install,2)) diff --git a/utils/compare_sizes/ghc.mk b/utils/compare_sizes/ghc.mk deleted file mode 100644 index d659a5e6d8..0000000000 --- a/utils/compare_sizes/ghc.mk +++ /dev/null @@ -1,9 +0,0 @@ - -utils/compare_sizes_USES_CABAL = YES -utils/compare_sizes_PACKAGE = compareSizes -utils/compare_sizes_MODULES = Main -utils/compare_sizes_dist-install_PROGNAME = compareSizes -utils/compare_sizes_dist-install_INSTALL_INPLACE = NO - -$(eval $(call build-prog,utils/compare_sizes,dist-install,1)) - diff --git a/utils/count-deps/ghc.mk b/utils/count-deps/ghc.mk deleted file mode 100644 index 45259efee6..0000000000 --- a/utils/count-deps/ghc.mk +++ /dev/null @@ -1,18 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/count-deps_USES_CABAL = YES -utils/count-deps_PACKAGE = count-deps -utils/count-deps_dist-install_PROGNAME = count-deps -utils/count-deps_dist-install_INSTALL = NO -utils/count-deps_dist-install_INSTALL_INPLACE = YES -$(eval $(call build-prog,utils/count-deps,dist-install,2)) diff --git a/utils/deriveConstants/ghc.mk b/utils/deriveConstants/ghc.mk deleted file mode 100644 index 98c8633666..0000000000 --- a/utils/deriveConstants/ghc.mk +++ /dev/null @@ -1,20 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009-2012 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/deriveConstants_USES_CABAL = YES -utils/deriveConstants_PACKAGE = deriveConstants -utils/deriveConstants_dist_PROGNAME = deriveConstants -utils/deriveConstants_dist_INSTALL = NO -utils/deriveConstants_dist_INSTALL_INPLACE = YES - -$(eval $(call build-prog,utils/deriveConstants,dist,0)) - diff --git a/utils/gen-dll/ghc.mk b/utils/gen-dll/ghc.mk deleted file mode 100644 index 77c75f07ed..0000000000 --- a/utils/gen-dll/ghc.mk +++ /dev/null @@ -1,19 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/gen-dll_USES_CABAL = YES -utils/gen-dll_PACKAGE = gen-dll -utils/gen-dll_dist_PROGNAME = gen-dll -utils/gen-dll_dist_INSTALL = NO -utils/gen-dll_dist_INSTALL_INPLACE = YES - -$(eval $(call build-prog,utils/gen-dll,dist,0)) diff --git a/utils/genapply/ghc.mk b/utils/genapply/ghc.mk deleted file mode 100644 index 5721c9069a..0000000000 --- a/utils/genapply/ghc.mk +++ /dev/null @@ -1,30 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/genapply_USES_CABAL = YES -utils/genapply_PACKAGE = genapply -utils/genapply_dist_PROGNAME = genapply -utils/genapply_dist_INSTALL = NO -utils/genapply_dist_INSTALL_INPLACE = YES - -utils/dist/package-data.mk : $(includes_1_H_PLATFORM) -utils/dist/package-data.mk : $(includes_1_H_CONFIG) - -ifeq "$(GhcUnregisterised)" "YES" -utils/genapply_CONFIGURE_OPTS = --flag unregisterised -endif - -$(eval $(call build-prog,utils/genapply,dist,0)) - -# Purposely do the wrong stage for HOST := TARGET hack. -# See Note [Genapply target as host for RTS macros]. -utils/genapply_dist_CC_OPTS += $(addprefix -Irts/include,$(includes_dist-install_DIST_INCLUDE_DIRS)) diff --git a/utils/genprimopcode/ghc.mk b/utils/genprimopcode/ghc.mk deleted file mode 100644 index 47250711a9..0000000000 --- a/utils/genprimopcode/ghc.mk +++ /dev/null @@ -1,19 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/genprimopcode_USES_CABAL = YES -utils/genprimopcode_PACKAGE = genprimopcode -utils/genprimopcode_dist_PROGNAME = genprimopcode -utils/genprimopcode_dist_INSTALL = NO -utils/genprimopcode_dist_INSTALL_INPLACE = YES - -$(eval $(call build-prog,utils/genprimopcode,dist,0)) diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk deleted file mode 100644 index 035ee8adaa..0000000000 --- a/utils/ghc-cabal/ghc.mk +++ /dev/null @@ -1,97 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# Bootstrapping ghc-cabal - -# Euch, hideous hack: -# XXX This should be in a different Makefile -CABAL_DOTTED_VERSION := $(shell grep "^version:" libraries/Cabal/Cabal/Cabal.cabal | sed "s/^version: *//") -CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION)) -CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)" - -# Starting with GHC 8.0 we make use of GHC's native ability to -# generate MIN_VERSION_() CPP macros. The generation of those -# macros is triggered by `-hide-all-packages`, so we have to explicitly -# enumerate all packages we need in scope. -CABAL_BUILD_DEPS := ghc-prim base binary array transformers time containers bytestring deepseq process pretty directory filepath template-haskell text -ifeq "$(Windows_Host)" "YES" -CABAL_BUILD_DEPS += Win32 -else -CABAL_BUILD_DEPS += unix -endif - -ghc-cabal_DIST_BINARY_NAME = ghc-cabal$(exeext0) -ghc-cabal_DIST_BINARY = utils/ghc-cabal/dist/build/tmp/$(ghc-cabal_DIST_BINARY_NAME) -ghc-cabal_INPLACE = inplace/bin/$(ghc-cabal_DIST_BINARY_NAME) - -ifneq "$(BINDIST)" "YES" -$(ghc-cabal_INPLACE) : $(ghc-cabal_DIST_BINARY) | $$(dir $$@)/. - "$(CP)" $< $@ - -CABAL_LEXER_DEP := libraries/Cabal/Cabal-syntax/src/Distribution/Fields/Lexer.hs - -$(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal/src/Distribution/*/*/*.hs) -$(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal/src/Distribution/*/*.hs) -$(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal/src/Distribution/*.hs) -$(ghc-cabal_DIST_BINARY): $(wildcard libraries/Cabal/Cabal-syntax/src/Distribution/*.hs) - -# N.B. Compile with -O0 since this is not a performance-critical executable -# and the Cabal takes nearly twice as long to build with -O1. See #16817. -$(ghc-cabal_DIST_BINARY): $(CABAL_LEXER_DEP) utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/. - "$(GHC)" $(SRC_HC_OPTS) \ - $(addprefix -optc, $(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0)) \ - $(addprefix -optl, $(SRC_LD_OPTS) $(CONF_GCC_LINKER_OPTS_STAGE0)) \ - -O0 \ - -XHaskell2010 \ - -hide-all-packages \ - -package-env - \ - $(addprefix -package , $(CABAL_BUILD_DEPS)) \ - --make utils/ghc-cabal/Main.hs -o $@ \ - -no-user-package-db \ - -Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \ - -DCABAL_VERSION=$(CABAL_VERSION) \ - -DBOOTSTRAPPING \ - -odir bootstrapping \ - -hidir bootstrapping \ - $(CABAL_LEXER_DEP) \ - -ilibraries/Cabal/Cabal/src \ - -ilibraries/Cabal/Cabal-syntax/src \ - -ilibraries/binary/src \ - -ilibraries/filepath \ - -ilibraries/hpc \ - -ilibraries/mtl \ - -ilibraries/parsec/src \ - $(utils/ghc-cabal_dist_EXTRA_HC_OPTS) \ - $(EXTRA_HC_OPTS) - "$(TOUCH_CMD)" $@ -endif - -# touch is required, because otherwise if mkdirhier is newer, we -# repeatedly rebuild ghc-cabal. - -$(eval $(call clean-target,utils/ghc-cabal,dist,\ - utils/ghc-cabal/dist bootstrapping)) - -$(eval $(call all-target,utils/ghc-cabal,$(ghc-cabal_INPLACE))) - -# ----------------------------------------------------------------------------- -# Now make another copy that goes in bindists. This needs to be built -# with the in-tree compiler. - -utils/ghc-cabal_USES_CABAL = YES -utils/ghc-cabal_PACKAGE = ghc-cabal -utils/ghc-cabal_dist-install_PROGNAME = ghc-cabal -utils/ghc-cabal_dist-install_INSTALL_INPLACE = NO -utils/ghc-cabal_dist-install_WANT_BINDIST_WRAPPER = YES -utils/ghc-cabal_dist-install_MODULES = Main - -$(eval $(call build-prog,utils/ghc-cabal,dist-install,1)) diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk deleted file mode 100644 index 029d0b86e6..0000000000 --- a/utils/ghc-pkg/ghc.mk +++ /dev/null @@ -1,98 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009-2012 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# ----------------------------------------------------------------------------- -# Bootstrapping ghc-pkg - -utils/ghc-pkg_PACKAGE = ghc-pkg - -# Note [Why build certain utils twice?] -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# We build certain utils twice: once with stage0, and once with stage1. -# Examples are ghc-pkg and hsc2hs. -# -# These tools are needed during the bootstrapping process, so we have to use -# stage0 to build them at first (stage1 doesn't exist yet). (side note: they're -# also used later in the build process). We install them inplace. -# -# But we can't install these copies when you run 'make install'. The reason is -# that when DYNAMIC_GHC_PROGRAMS=YES, we want to install copies that are -# dynamically linked. But the stage0 copies are either statically linked, or -# linked against libraries on the build machine. -# -# Therefore we build fresh copies, using the stage1 compiler, and install them -# when you run 'make install'. They are not used for any other purpose. - -# ----------------------------------------------------------------------------- -# Build ghc-pkg with the stage0 compiler in the dist directory, and install -# inplace. This is the copy we use during in-tree development. -utils/ghc-pkg_dist_USES_CABAL = YES -utils/ghc-pkg_dist_PROGNAME = ghc-pkg -utils/ghc-pkg_dist_SHELL_WRAPPER = YES -utils/ghc-pkg_dist_INSTALL_INPLACE = YES - -# When cross-built ghc-stage2 is installed 'make install' needs to call -# native ghc-pkg (not the cross-built one) to register installed packages -# 'ghc-pkg_DIST_BINARY' variable only refer to native binary. -ghc-pkg_DIST_BINARY_NAME = ghc-pkg$(exeext0) -ghc-pkg_DIST_BINARY = utils/ghc-pkg/dist/build/tmp/$(ghc-pkg_DIST_BINARY_NAME) - -# See Note [Stage1Only vs stage=1] in mk/config.mk.in. -ifeq "$(Stage1Only)" "YES" -# Install the copy of ghc-pkg from the dist directory when running 'make -# install' (it's the only copy we have at this stage). -utils/ghc-pkg_dist_INSTALL = YES -utils/ghc-pkg_dist_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion) -endif - -ifeq "$(WITH_TERMINFO)" "NO" -utils/ghc-pkg_dist-install_CONFIGURE_OPTS += -f-terminfo -endif - -$(eval $(call build-prog,utils/ghc-pkg,dist,0)) - -# ghc-pkg uses `settings` to figure out the target platform to figure out a -# subdirectory for the user pkg db. So make sure `settings` exists (alternative -# is to specify global package db only). -$(ghc-pkg_INPLACE) : | $(INPLACE_PACKAGE_CONF)/. $(INPLACE_LIB)/settings - -# ----------------------------------------------------------------------------- -# Build another copy of ghc-pkg with the stage1 compiler in the dist-install -# directory. Don't install it inplace (we use the dist copy there), but do -# install it when running 'make install'. -# -# See Note [Why build certain utils twice?]. - -# See Note [Stage1Only vs stage=1] in mk/config.mk.in. -ifneq "$(Stage1Only)" "YES" -utils/ghc-pkg_dist-install_USES_CABAL = YES -utils/ghc-pkg_dist-install_PROGNAME = ghc-pkg -utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES -utils/ghc-pkg_dist-install_INSTALL_INPLACE = NO -utils/ghc-pkg_dist-install_INSTALL = YES -utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion) - -$(eval $(call build-prog,utils/ghc-pkg,dist-install,1)) -endif - -# ----------------------------------------------------------------------------- -# Link ghc-pkg to ghc-pkg-$(ProjectVersion) when installing - -ifeq "$(Windows_Host)" "NO" -install: install_utils/ghc-pkg_link - -.PHONY: install_utils/ghc-pkg_link -install_utils/ghc-pkg_link: - $(INSTALL_DIR) "$(DESTDIR)$(bindir)" - $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc-pkg") - $(LN_S) $(CrossCompilePrefix)ghc-pkg-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghc-pkg" -endif diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk deleted file mode 100644 index d7797be3e9..0000000000 --- a/utils/hp2ps/ghc.mk +++ /dev/null @@ -1,42 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# stage0 -utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ - Reorder.c TopTwenty.c AuxFile.c Deviation.c \ - HpFile.c Marks.c Scale.c TraceElement.c \ - Axes.c Dimensions.c Key.c PsFile.c Shade.c \ - Utilities.c -utils/hp2ps_dist_EXTRA_LIBRARIES = m -utils/hp2ps_dist_PROGNAME = hp2ps -utils/hp2ps_dist_INSTALL_INPLACE = YES -utils/hp2ps_dist_SHELL_WRAPPER = YES -utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps - -# stage 1 -utils/hp2ps_dist-install_C_SRCS = $(utils/hp2ps_dist_C_SRCS) -utils/hp2ps_dist-install_EXTRA_LIBRARIES = $(utils/hp2ps_dist_EXTRA_LIBRARIES) -utils/hp2ps_dist-install_PROGNAME = $(utils/hp2ps_dist_PROGNAME) -utils/hp2ps_dist-install_INSTALL_INPLACE = NO -utils/hp2ps_dist-install_SHELL_WRAPPER = YES -utils/hp2ps_dist-install_INSTALL_SHELL_WRAPPER_NAME = $(utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME) - -ifeq "$(Stage1Only)" "YES" -utils/hp2ps_dist_INSTALL = YES -utils/hp2ps_dist-install_INSTALL = NO -else -utils/hp2ps_dist_INSTALL = NO -utils/hp2ps_dist-install_INSTALL = YES -endif - -$(eval $(call build-prog,utils/hp2ps,dist,0)) -$(eval $(call build-prog,utils/hp2ps,dist-install,1)) diff --git a/utils/hpc/ghc.mk b/utils/hpc/ghc.mk deleted file mode 100644 index 9b2bce238e..0000000000 --- a/utils/hpc/ghc.mk +++ /dev/null @@ -1,21 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/hpc_USES_CABAL = YES -utils/hpc_PACKAGE = hpc-bin -utils/hpc_dist-install_INSTALL = YES -utils/hpc_dist-install_INSTALL_INPLACE = YES -utils/hpc_dist-install_PROGNAME = hpc -utils/hpc_dist-install_SHELL_WRAPPER = YES -utils/hpc_dist-install_INSTALL_SHELL_WRAPPER_NAME = hpc - -$(eval $(call build-prog,utils/hpc,dist-install,1)) diff --git a/utils/iserv/ghc.mk b/utils/iserv/ghc.mk deleted file mode 100644 index 74f90e60b7..0000000000 --- a/utils/iserv/ghc.mk +++ /dev/null @@ -1,113 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009-2012 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/iserv_USES_CABAL = YES -utils/iserv_PACKAGE = iserv -utils/iserv_EXECUTABLE = iserv - -ifeq "$(GhcDebugged)" "YES" -utils/iserv_stage2_MORE_HC_OPTS += -debug -utils/iserv_stage2_p_MORE_HC_OPTS += -debug -utils/iserv_stage2_dyn_MORE_HC_OPTS += -debug -endif - -ifeq "$(GhcThreaded)" "YES" -utils/iserv_stage2_MORE_HC_OPTS += -threaded -utils/iserv_stage2_p_MORE_HC_OPTS += -threaded -utils/iserv_stage2_dyn_MORE_HC_OPTS += -threaded -endif - -# Add -Wl,--export-dynamic enables GHCi to load dynamic objects that -# refer to the RTS. This is harmless if you don't use it (adds a bit -# of overhead to startup and increases the binary sizes) but if you -# need it there's no alternative. -ifeq "$(TargetElf)" "YES" -ifneq "$(TargetOS_CPP)" "solaris2" -# The Solaris linker does not support --export-dynamic option. It also -# does not need it since it exports all dynamic symbols by default -utils/iserv_stage2_MORE_HC_OPTS += -optl-Wl,--export-dynamic -utils/iserv_stage2_p_MORE_HC_OPTS += -optl-Wl,--export-dynamic -utils/iserv_stage2_dyn_MORE_HC_OPTS += -optl-Wl,--export-dynamic -endif -endif - -# Override the default way, because we want a specific version of this -# program for each way. Note that it's important to do this even for -# the vanilla version, otherwise we get a dynamic executable when -# DYNAMIC_GHC_PROGRAMS=YES. -utils/iserv_stage2_PROGRAM_WAY = v -utils/iserv_stage2_p_PROGRAM_WAY = p -utils/iserv_stage2_dyn_PROGRAM_WAY = dyn - -utils/iserv_stage2_PROGNAME = ghc-iserv -utils/iserv_stage2_p_PROGNAME = ghc-iserv-prof -utils/iserv_stage2_dyn_PROGNAME = ghc-iserv-dyn - -utils/iserv_stage2_MORE_HC_OPTS += -no-hs-main -utils/iserv_stage2_p_MORE_HC_OPTS += -no-hs-main -utils/iserv_stage2_dyn_MORE_HC_OPTS += -no-hs-main - -utils/iserv_stage2_INSTALL = YES -utils/iserv_stage2_p_INSTALL = YES -utils/iserv_stage2_dyn_INSTALL = YES - -# Install in $(libexec), not in $(bindir) -utils/iserv_stage2_TOPDIR = YES -utils/iserv_stage2_p_TOPDIR = YES -utils/iserv_stage2_dyn_TOPDIR = YES - -utils/iserv_stage2_INSTALL_INPLACE = YES -utils/iserv_stage2_p_INSTALL_INPLACE = YES -utils/iserv_stage2_dyn_INSTALL_INPLACE = YES - -ifeq "$(CLEANING)" "YES" - -NEED_iserv = YES -NEED_iserv_p = YES -NEED_iserv_dyn = YES - -else - -ifneq "$(findstring v, $(GhcLibWays))" "" -NEED_iserv = YES -else -NEED_iserv = NO -endif - -ifneq "$(findstring p, $(GhcLibWays))" "" -NEED_iserv_p = YES -else -NEED_iserv_p = NO -endif - -ifneq "$(findstring dyn, $(GhcLibWays))" "" -NEED_iserv_dyn = YES -else -NEED_iserv_dyn = NO -endif -endif - -ifeq "$(NEED_iserv)" "YES" -$(eval $(call build-prog,utils/iserv,stage2,1)) -endif - -ifeq "$(NEED_iserv_p)" "YES" -$(eval $(call build-prog,utils/iserv,stage2_p,1)) -endif - -ifeq "$(NEED_iserv_dyn)" "YES" -$(eval $(call build-prog,utils/iserv,stage2_dyn,1)) -endif - -all_ghc_stage2 : $(iserv-stage2_INPLACE) -all_ghc_stage2 : $(iserv-stage2_p_INPLACE) -all_ghc_stage2 : $(iserv-stage2_dyn_INPLACE) diff --git a/utils/mkdirhier/ghc.mk b/utils/mkdirhier/ghc.mk deleted file mode 100644 index a574b86861..0000000000 --- a/utils/mkdirhier/ghc.mk +++ /dev/null @@ -1,22 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -$(MKDIRHIER) : utils/mkdirhier/mkdirhier.sh - mkdir -p $(INPLACE_BIN) - mkdir -p $(INPLACE_LIB) - $(call removeFiles,$@) - echo '#!/bin/sh' >> $@ - cat utils/mkdirhier/mkdirhier.sh >> $@ - $(EXECUTABLE_FILE) $@ - -$(eval $(call all-target,utils/mkdirhier,$(MKDIRHIER))) -$(eval $(call clean-target,utils/mkdirhier,,$(MKDIRHIER))) diff --git a/utils/remote-iserv/ghc.mk b/utils/remote-iserv/ghc.mk deleted file mode 100644 index f0cd9ffa49..0000000000 --- a/utils/remote-iserv/ghc.mk +++ /dev/null @@ -1,113 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009-2012 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/remote-iserv_USES_CABAL = YES -utils/remote-iserv_PACKAGE = remote-iserv -utils/remote-iserv_EXECUTABLE = remote-iserv - -ifeq "$(GhcDebugged)" "YES" -utils/remote-iserv_stage2_MORE_HC_OPTS += -debug -utils/remote-iserv_stage2_p_MORE_HC_OPTS += -debug -utils/remote-iserv_stage2_dyn_MORE_HC_OPTS += -debug -endif - -ifeq "$(GhcThreaded)" "YES" -utils/remote-iserv_stage2_MORE_HC_OPTS += -threaded -utils/remote-iserv_stage2_p_MORE_HC_OPTS += -threaded -utils/remote-iserv_stage2_dyn_MORE_HC_OPTS += -threaded -endif - -# Add -Wl,--export-dynamic enables GHCi to load dynamic objects that -# refer to the RTS. This is harmless if you don't use it (adds a bit -# of overhead to startup and increases the binary sizes) but if you -# need it there's no alternative. -ifeq "$(TargetElf)" "YES" -ifneq "$(TargetOS_CPP)" "solaris2" -# The Solaris linker does not support --export-dynamic option. It also -# does not need it since it exports all dynamic symbols by default -utils/remote-iserv_stage2_MORE_HC_OPTS += -optl-Wl,--export-dynamic -utils/remote-iserv_stage2_p_MORE_HC_OPTS += -optl-Wl,--export-dynamic -utils/remote-iserv_stage2_dyn_MORE_HC_OPTS += -optl-Wl,--export-dynamic -endif -endif - -# Override the default way, because we want a specific version of this -# program for each way. Note that it's important to do this even for -# the vanilla version, otherwise we get a dynamic executable when -# DYNAMIC_GHC_PROGRAMS=YES. -utils/remote-iserv_stage2_PROGRAM_WAY = v -utils/remote-iserv_stage2_p_PROGRAM_WAY = p -utils/remote-iserv_stage2_dyn_PROGRAM_WAY = dyn - -utils/remote-iserv_stage2_PROGNAME = ghc-iserv -utils/remote-iserv_stage2_p_PROGNAME = ghc-iserv-prof -utils/remote-iserv_stage2_dyn_PROGNAME = ghc-iserv-dyn - -utils/remote-iserv_stage2_MORE_HC_OPTS += -no-hs-main -utils/remote-iserv_stage2_p_MORE_HC_OPTS += -no-hs-main -utils/remote-iserv_stage2_dyn_MORE_HC_OPTS += -no-hs-main - -utils/remote-iserv_stage2_INSTALL = YES -utils/remote-iserv_stage2_p_INSTALL = YES -utils/remote-iserv_stage2_dyn_INSTALL = YES - -# Install in $(libexec), not in $(bindir) -utils/remote-iserv_stage2_TOPDIR = YES -utils/remote-iserv_stage2_p_TOPDIR = YES -utils/remote-iserv_stage2_dyn_TOPDIR = YES - -utils/remote-iserv_stage2_INSTALL_INPLACE = YES -utils/remote-iserv_stage2_p_INSTALL_INPLACE = YES -utils/remote-iserv_stage2_dyn_INSTALL_INPLACE = YES - -ifeq "$(CLEANING)" "YES" - -NEED_iserv = YES -NEED_iserv_p = YES -NEED_iserv_dyn = YES - -else - -ifneq "$(findstring v, $(GhcLibWays))" "" -NEED_iserv = YES -else -NEED_iserv = NO -endif - -ifneq "$(findstring p, $(GhcLibWays))" "" -NEED_iserv_p = YES -else -NEED_iserv_p = NO -endif - -ifneq "$(findstring dyn, $(GhcLibWays))" "" -NEED_iserv_dyn = YES -else -NEED_iserv_dyn = NO -endif -endif - -ifeq "$(NEED_iserv)" "YES" -$(eval $(call build-prog,utils/remote-iserv,stage2,1)) -endif - -ifeq "$(NEED_iserv_p)" "YES" -$(eval $(call build-prog,utils/remote-iserv,stage2_p,1)) -endif - -ifeq "$(NEED_iserv_dyn)" "YES" -$(eval $(call build-prog,utils/remote-iserv,stage2_dyn,1)) -endif - -all_ghc_stage2 : $(remote-iserv-stage2_INPLACE) -all_ghc_stage2 : $(remote-iserv-stage2_p_INPLACE) -all_ghc_stage2 : $(remote-iserv-stage2_dyn_INPLACE) diff --git a/utils/runghc/ghc.mk b/utils/runghc/ghc.mk deleted file mode 100644 index 76272d9d80..0000000000 --- a/utils/runghc/ghc.mk +++ /dev/null @@ -1,43 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/runghc_PACKAGE = runghc -utils/runghc_dist-install_USES_CABAL = YES -utils/runghc_dist-install_PROGNAME = runghc -utils/runghc_dist-install_SHELL_WRAPPER = YES -utils/runghc_dist-install_INSTALL = YES -utils/runghc_dist-install_INSTALL_INPLACE = YES -utils/runghc_dist-install_INSTALL_SHELL_WRAPPER_NAME = runghc-$(ProjectVersion) - -# Be explicit about which version of ghc to call (#9054). -define utils/runghc_dist-install_INPLACE_SHELL_WRAPPER_EXTRA -echo 'ghcprog="$(ghc_stage2_INPLACE_SHELL_WRAPPER_NAME)"' >> "$(WRAPPER)" -endef -define utils/runghc_dist-install_INSTALL_SHELL_WRAPPER_EXTRA -echo 'ghcprog="$(ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME)"' >> "$(WRAPPER)" -endef - -$(eval $(call build-prog,utils/runghc,dist-install,1)) - -install: install_runhaskell - -.PHONY: install_runhaskell -ifeq "$(Windows_Host)" "YES" -install_runhaskell: install_bins - "$(CP)" $(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc$(exeext1) $(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell$(exeext1) -else -install_runhaskell: - $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell") - $(LN_S) $(CrossCompilePrefix)runghc "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell" - $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc") - $(LN_S) $(CrossCompilePrefix)runghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc" -endif diff --git a/utils/testremove/ghc.mk b/utils/testremove/ghc.mk deleted file mode 100644 index ac9ef6ce03..0000000000 --- a/utils/testremove/ghc.mk +++ /dev/null @@ -1,9 +0,0 @@ - -.PHONY: utils/testremove_all -utils/testremove_all: utils/testremove/wouldrm utils/testremove/checkremove - -utils/testremove/wouldrm: $$@.hs - $(GHC_STAGE1) --make -O $@ - -utils/testremove/checkremove: $$@.hs - $(GHC_STAGE1) --make -O $@ diff --git a/utils/touchy/ghc.mk b/utils/touchy/ghc.mk deleted file mode 100644 index 9c093c19cf..0000000000 --- a/utils/touchy/ghc.mk +++ /dev/null @@ -1,18 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -utils/touchy_dist_C_SRCS = touchy.c -utils/touchy_dist_PROGNAME = touchy -utils/touchy_dist_TOPDIR = YES -utils/touchy_dist_INSTALL = YES -utils/touchy_dist_INSTALL_INPLACE = YES -$(eval $(call build-prog,utils/touchy,dist,0)) diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk deleted file mode 100644 index fe38cbbd0f..0000000000 --- a/utils/unlit/ghc.mk +++ /dev/null @@ -1,34 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# (c) 2009 The University of Glasgow -# -# This file is part of the GHC build system. -# -# To understand how the build system works and how to modify it, see -# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture -# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying -# -# ----------------------------------------------------------------------------- - -# built by ghc-stage0 -utils/unlit_dist_C_SRCS = unlit.c fs.c -utils/unlit_dist_PROGNAME = unlit -utils/unlit_dist_TOPDIR = YES -utils/unlit_dist_INSTALL_INPLACE = YES - -# built by ghc-stage1 -utils/unlit_dist-install_C_SRCS = $(utils/unlit_dist_C_SRCS) -utils/unlit_dist-install_PROGNAME = $(utils/unlit_dist_PROGNAME) -utils/unlit_dist-install_TOPDIR = $(utils/unlit_dist_TOPDIR) -utils/unlit_dist-install_INSTALL_INPLACE = NO - -ifeq "$(Stage1Only)" "YES" -utils/unlit_dist_INSTALL = YES -utils/unlit_dist-install_INSTALL = NO -else -utils/unlit_dist_INSTALL = NO -utils/unlit_dist-install_INSTALL = YES -endif - -$(eval $(call build-prog,utils/unlit,dist,0)) -$(eval $(call build-prog,utils/unlit,dist-install,1)) diff --git a/validate b/validate index 6031b7d5ca..6850096349 100755 --- a/validate +++ b/validate @@ -65,6 +65,42 @@ Flags: EOF } +# Note [validate and testsuite speed] +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# There are 3 different validate and testsuite speed settings: +# fast, normal and slow. +# +# how how used +# cd tests config. many many by +# validate && make speed= tests ways whom +# ============================================================================= +# --fast fast 2 some 1+exs Travis (to stay within time limit) +# --normal test 1 all 1+exs Phabricator (slow takes too long?) +# --slow slow 0 all all Nightly (slow is ok) +# +# accept 1 all 1 +# +# `--fast` and `--normal` run one default way, as well as any other ways which +# are explicitly requested by the test using extra_ways(). +# +# `make accept` should run all tests exactly once. There is no point in +# accepting a test for multiple ways, since it should produce the same output +# for all ways. +# +# To make sure all .stderr and .stdout files in the testsuite are never +# out-of-date, it is useful if CI runs each test at least once. + +# Note [Default build system verbosity] +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# From https://gitlab.haskell.org/ghc/ghc/wikis/design/build-system: +# +# "The build system should clearly report what it's doing (and sometimes +# why), without being too verbose. It should emit actual command lines as +# much as possible, so that they can be inspected and cut & pasted." +# +# That should be the default. Only suppress commands, by setting V=0 and using +# `make -s`, when user explicitly asks for it with `./validate --quiet`. + no_clean=0 testsuite_only=0 build_only=0 -- cgit v1.2.1