summaryrefslogtreecommitdiff
path: root/rules
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 /rules
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 'rules')
-rw-r--r--rules/sdist-ghc-file.mk46
1 files changed, 46 insertions, 0 deletions
diff --git a/rules/sdist-ghc-file.mk b/rules/sdist-ghc-file.mk
new file mode 100644
index 0000000000..9ea0b6521a
--- /dev/null
+++ b/rules/sdist-ghc-file.mk
@@ -0,0 +1,46 @@
+# -----------------------------------------------------------------------------
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+# http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
+# http://ghc.haskell.org/trac/ghc/wiki/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/parser/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
+ 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