summaryrefslogtreecommitdiff
path: root/ghc.mk
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-05-27 20:54:36 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2015-06-04 23:58:29 +0200
commit092082e7583c8170ae41ef8d01a554db34f91bb3 (patch)
treed9a119e4674f4eec3031bb052a16a88d7fd2cfe8 /ghc.mk
parent14652b519eca12411e92c28cd06de32612b0973a (diff)
downloadhaskell-092082e7583c8170ae41ef8d01a554db34f91bb3.tar.gz
Build: ./boot && ./configure && make sdist (#8723)
Make it possible to run `make sdist` right after configure, without completing a complete build first. Test Plan: I compared the contents of the created `.tar.bz2` files in the `sdistprep` directory, after running `make sdist` both before and after completing a full build, using `diff -r`. There weren't any differences (after applying the patches from D914). Note that the `.tar.bz2` files were not exactly the same size, but they aren't either when tarring and bzipping the same directory twice. It seems tarring and bzipping is not deterministic (on my system). Differential Revision: https://phabricator.haskell.org/D917
Diffstat (limited to 'ghc.mk')
-rw-r--r--ghc.mk47
1 files changed, 23 insertions, 24 deletions
diff --git a/ghc.mk b/ghc.mk
index 3b38372353..42b1784045 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -309,9 +309,10 @@ include rules/manual-package-config.mk
include rules/docbook.mk
# -----------------------------------------------------------------------------
-# Making bindists
+# Making bindists and sdists
include rules/bindist.mk
+include rules/sdist-ghc-file.mk
# -----------------------------------------------------------------------------
# Directories
@@ -1052,19 +1053,20 @@ publish-docs:
# Do it like this:
#
-# $ make
+# $ ./boot
+# $ ./configure
# $ make sdist
#
-# A source dist is built from a complete build tree, because we
+# 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 dist' are as follows:
+# 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
-# - tar up first the extralibs package, then the main source package
#
# Directory in which we're going to build the src dist
@@ -1118,22 +1120,13 @@ GIT_COMMIT_ID:
then echo "$@ needs no update"; \
else echo "update $@ ($(ProjectGitCommitId))"; echo -n "$(ProjectGitCommitId)" > $@; fi
-sdist-ghc-prep : VERSION GIT_COMMIT_ID
-
-# Use:
-# $(call sdist_ghc_file,compiler,stage2,cmm,Foo/Bar,CmmLex,x)
-# to copy the generated file that replaces compiler/cmm/Foo/Bar/CmmLex.x, where
-# "stage2" is the dist dir.
-define sdist_ghc_file
- "$(CP)" $1/$2/build/$4/$5.hs $(SRC_DIST_GHC_DIR)/$1/$3/$4
- mv $(SRC_DIST_GHC_DIR)/$1/$3/$4/$5.$6 $(SRC_DIST_GHC_DIR)/$1/$3/$4/$5.$6.source
-endef
+sdist-ghc-prep-tree : VERSION GIT_COMMIT_ID
# Extra packages which shouldn't be in the source distribution: see #8801
EXTRA_PACKAGES=parallel stm random primitive vector dph
-.PHONY: sdist-ghc-prep
-sdist-ghc-prep :
+.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)
@@ -1147,15 +1140,21 @@ sdist-ghc-prep :
$(call removeTrees,$(SRC_DIST_GHC_DIR)/compiler/stage[123])
$(call removeFiles,$(SRC_DIST_GHC_DIR)/mk/build.mk)
for i in $(EXTRA_PACKAGES); do $(RM) $(RM_OPTS_REC) $(SRC_DIST_GHC_DIR)/libraries/$$i/; done
- $(call sdist_ghc_file,compiler,stage2,cmm,,CmmLex,x)
- $(call sdist_ghc_file,compiler,stage2,cmm,,CmmParse,y)
- $(call sdist_ghc_file,compiler,stage2,parser,,Lexer,x)
- $(call sdist_ghc_file,compiler,stage2,parser,,Parser,y)
- $(call sdist_ghc_file,utils/hpc,dist-install,,,HpcParser,y)
- $(call sdist_ghc_file,utils/genprimopcode,dist,,,Lexer,x)
- $(call sdist_ghc_file,utils/genprimopcode,dist,,,Parser,y)
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,cmm,CmmLex,x))
+$(eval $(call sdist-ghc-file,compiler,stage2,cmm,CmmParse,y))
+$(eval $(call sdist-ghc-file,compiler,stage2,parser,Lexer,x))
+$(eval $(call sdist-ghc-file,compiler,stage2,parser,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))
+
+.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))