summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-11-10 19:24:51 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-12 21:25:40 -0500
commit490e8c750ea23ce8e2b7309e0d514b7d27f231bb (patch)
tree67a425e67c39f66165dcddbaa524c53e09068c95 /rts
parent4c6ace75435f23774de8ee3f317c9503bb1c5139 (diff)
downloadhaskell-490e8c750ea23ce8e2b7309e0d514b7d27f231bb.tar.gz
Generate ghcversion.h with the top-level configure
This is, rather unintuitively, part of the goal of making the packages that make of the GHC distribution more freestanding. `ghcversion.h` is very simple, so we easily can move it out of the main build systems (make and Hadrian). By doing so, the RTS becomes less of a special case to those build systems as the header, already existing in the source tree, appears like any other. We could do this with the upcomming RTS configure, but it hardly matters because there is nothing platform-specific here, it is just versioning information like the other files the top-level configure can be responsible for.
Diffstat (limited to 'rts')
-rw-r--r--rts/.gitignore18
-rw-r--r--rts/ghcversion.h.bottom10
-rw-r--r--rts/ghcversion.h.top3
-rw-r--r--rts/include/ghc.mk46
4 files changed, 37 insertions, 40 deletions
diff --git a/rts/.gitignore b/rts/.gitignore
new file mode 100644
index 0000000000..a0fafa79ab
--- /dev/null
+++ b/rts/.gitignore
@@ -0,0 +1,18 @@
+# Specific generated files
+/dist/
+/dist-*/
+
+/rts.cabal
+
+/include/ghcversion.h
+
+/package.conf.inplace
+/package.conf.inplace.raw
+/package.conf.install
+/package.conf.install.raw
+/fs.*
+
+/autom4te.cache/
+/config.log
+/config.status
+/configure
diff --git a/rts/ghcversion.h.bottom b/rts/ghcversion.h.bottom
new file mode 100644
index 0000000000..b9a8fc29c6
--- /dev/null
+++ b/rts/ghcversion.h.bottom
@@ -0,0 +1,10 @@
+
+#define MIN_VERSION_GLASGOW_HASKELL(ma,mi,pl1,pl2) ( \
+ ((ma)*100+(mi)) < __GLASGOW_HASKELL__ || \
+ ((ma)*100+(mi)) == __GLASGOW_HASKELL__ \
+ && (pl1) < __GLASGOW_HASKELL_PATCHLEVEL1__ || \
+ ((ma)*100+(mi)) == __GLASGOW_HASKELL__ \
+ && (pl1) == __GLASGOW_HASKELL_PATCHLEVEL1__ \
+ && (pl2) <= __GLASGOW_HASKELL_PATCHLEVEL2__ )
+
+#endif /* __GHCVERSION_H__ */
diff --git a/rts/ghcversion.h.top b/rts/ghcversion.h.top
new file mode 100644
index 0000000000..788dba3f40
--- /dev/null
+++ b/rts/ghcversion.h.top
@@ -0,0 +1,3 @@
+#if !defined(__GHCVERSION_H__)
+#define __GHCVERSION_H__
+
diff --git a/rts/include/ghc.mk b/rts/include/ghc.mk
index 11e72c3daa..7bc4fc2d8b 100644
--- a/rts/include/ghc.mk
+++ b/rts/include/ghc.mk
@@ -19,9 +19,6 @@ 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_1_H_VERSION = rts/dist-install/build/include/ghcversion.h
-includes_2_H_VERSION = $(includes_1_H_VERSION)
-
BUILD_0_INCLUDE_DIR = rts/dist/build/include
BUILD_1_INCLUDE_DIR = rts/dist-install/build/include
BUILD_2_INCLUDE_DIR = $(BUILD_1_INCLUDE_DIR)
@@ -41,8 +38,7 @@ includes_H_FILES := $(subst /./,/,$(includes_H_FILES))
includes_H_FILES_GENERATED = \
ghcautoconf.h \
- ghcplatform.h \
- ghcversion.h
+ ghcplatform.h
# Unlike above, include generated files. We still need the previous list
# without the generated files separtely and not just as part of this due to
@@ -76,40 +72,6 @@ ifneq "$(GhcWithSMP)" "YES"
includes_CC_OPTS += -DNOSMP
endif
-define includesHeaderVersion
-# $1 = stage
-$$(includes_$1_H_VERSION) : mk/project.mk | $$$$(dir $$$$@)/.
- $$(call removeFiles,$$@)
- @echo "Creating $$@..."
- @echo "#if !defined(__GHCVERSION_H__)" > $$@
- @echo "#define __GHCVERSION_H__" >> $$@
- @echo >> $$@
- @echo "#define __GLASGOW_HASKELL__ $$(ProjectVersionInt)" >> $$@
- @echo "#define __GLASGOW_HASKELL_FULL_VERSION__ \"$$(ProjectVersion)\"" >> $$@
- @echo >> $$@
- @if [ -n "$$(ProjectPatchLevel1)" ]; then \
- echo "#define __GLASGOW_HASKELL_PATCHLEVEL1__ $$(ProjectPatchLevel1)" >> $$@; \
- fi
- @if [ -n "$$(ProjectPatchLevel2)" ]; then \
- echo "#define __GLASGOW_HASKELL_PATCHLEVEL2__ $$(ProjectPatchLevel2)" >> $$@; \
- fi
- @echo >> $$@
- @echo '#define MIN_VERSION_GLASGOW_HASKELL(ma,mi,pl1,pl2) (\' >> $$@
- @echo ' ((ma)*100+(mi)) < __GLASGOW_HASKELL__ || \' >> $$@
- @echo ' ((ma)*100+(mi)) == __GLASGOW_HASKELL__ \' >> $$@
- @echo ' && (pl1) < __GLASGOW_HASKELL_PATCHLEVEL1__ || \' >> $$@
- @echo ' ((ma)*100+(mi)) == __GLASGOW_HASKELL__ \' >> $$@
- @echo ' && (pl1) == __GLASGOW_HASKELL_PATCHLEVEL1__ \' >> $$@
- @echo ' && (pl2) <= __GLASGOW_HASKELL_PATCHLEVEL2__ )' >> $$@
- @echo >> $$@
- @echo "#endif /* __GHCVERSION_H__ */" >> $$@
- @echo "Done."
-
-endef
-
-$(eval $(call includesHeaderVersion,0))
-$(eval $(call includesHeaderVersion,1))
-
ifneq "$(BINDIST)" "YES"
define includesHeaderConfig
@@ -123,7 +85,11 @@ $$(includes_$1_H_CONFIG) : mk/config.h mk/config.mk rts/include/ghc.mk | $$$$(di
# Copy the contents of mk/config.h, turning '#define PACKAGE_FOO
# "blah"' into '/* #undef PACKAGE_FOO */' to avoid clashes.
#
- @sed 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$$$$,\1/* #undef \2 */,' mk/config.h >> $$@
+ @sed mk/config.h \
+ -e 's,^\([ ]*\)#[ ]*define[ ][ ]*\(PACKAGE_[A-Z]*\)[ ][ ]*".*".*$$$$,\1/* #undef \2 */,' \
+ -e '/__GLASGOW_HASKELL/d' \
+ -e '/REMOVE ME/d' \
+ >> $$@
#
@echo "#endif /* __GHCAUTOCONF_H__ */" >> $$@
@echo "Done."