summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-10-03 20:41:44 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-09 16:21:14 -0400
commit817c1a947d50a070613815e02a530f83d9078eb8 (patch)
treea044789c0cbd1a3a73ed495afc599167aff39bbf
parent63a5371d420686f4959a5be9e5a0d3d647577615 (diff)
downloadhaskell-817c1a947d50a070613815e02a530f83d9078eb8.tar.gz
Define GHC_STAGE in headers instead of command-line
-rw-r--r--compiler/ghc.mk7
-rw-r--r--hadrian/src/Rules/Generate.hs4
-rw-r--r--hadrian/src/Settings/Packages.hs3
-rw-r--r--includes/ghc.mk2
4 files changed, 7 insertions, 9 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 8703e247c8..de14a01646 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -93,7 +93,7 @@ compiler/stage$1/build/Config.hs : mk/config.mk mk/project.mk | $$$$(dir $$$$@)/
@echo 'cBooterVersion = "$(GhcVersion)"' >> $$@
@echo >> $$@
@echo 'cStage :: String' >> $$@
- @echo 'cStage = show (GHC_STAGE :: Int)' >> $$@
+ @echo 'cStage = show ($1 :: Int)' >> $$@
@echo done.
endef
@@ -270,11 +270,6 @@ endif
compiler_stage3_CONFIGURE_OPTS := $(compiler_stage2_CONFIGURE_OPTS)
-compiler_stage1_CONFIGURE_OPTS += --ghc-option=-DGHC_STAGE=1
-compiler_stage2_CONFIGURE_OPTS += --ghc-option=-DGHC_STAGE=2
-compiler_stage3_CONFIGURE_OPTS += --ghc-option=-DGHC_STAGE=3
-compiler_stage2_HADDOCK_OPTS += --optghc=-DGHC_STAGE=2
-
compiler/stage1/package-data.mk : compiler/ghc.mk
compiler/stage2/package-data.mk : compiler/ghc.mk
compiler/stage3/package-data.mk : compiler/ghc.mk
diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs
index 3e4815216a..3faafbaaf7 100644
--- a/hadrian/src/Rules/Generate.hs
+++ b/hadrian/src/Rules/Generate.hs
@@ -239,6 +239,8 @@ generateGhcPlatformH = do
[ "#if !defined(__GHCPLATFORM_H__)"
, "#define __GHCPLATFORM_H__"
, ""
+ , "#define GHC_STAGE " ++ show (fromEnum stage + 1)
+ , ""
, "#define BuildPlatform_TYPE " ++ cppify buildPlatform
, "#define HostPlatform_TYPE " ++ cppify hostPlatform
, ""
@@ -369,7 +371,7 @@ generateConfigHs = do
, "cBooterVersion = " ++ show cBooterVersion
, ""
, "cStage :: String"
- , "cStage = show (GHC_STAGE :: Int)"
+ , "cStage = show (" ++ show (fromEnum stage + 1) ++ " :: Int)"
]
-- | Generate @ghcautoconf.h@ header.
diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs
index 6c6b00064c..94a586444d 100644
--- a/hadrian/src/Settings/Packages.hs
+++ b/hadrian/src/Settings/Packages.hs
@@ -58,8 +58,7 @@ packageArgs = do
pure ["-O0"] ]
, builder (Cabal Setup) ? mconcat
- [ arg $ "--ghc-option=-DGHC_STAGE=" ++ show (fromEnum stage + 1)
- , arg "--disable-library-for-ghci"
+ [ arg "--disable-library-for-ghci"
, anyTargetOs ["openbsd"] ? arg "--ld-options=-E"
, flag GhcUnregisterised ? arg "--ghc-option=-DNO_REGS"
, notM ghcWithSMP ? arg "--ghc-option=-DNOSMP"
diff --git a/includes/ghc.mk b/includes/ghc.mk
index a19e6109e1..eee72128b0 100644
--- a/includes/ghc.mk
+++ b/includes/ghc.mk
@@ -179,6 +179,8 @@ $$(includes_$1_H_PLATFORM) : includes/ghc.mk includes/Makefile | $$$$(dir $$$$@)
@echo "#if !defined(__GHCPLATFORM_H__)" > $$@
@echo "#define __GHCPLATFORM_H__" >> $$@
@echo >> $$@
+ @echo "#define GHC_STAGE $1" >> $$@
+ @echo >> $$@
@echo "#define BuildPlatform_TYPE $(BuildPlatform_$1_CPP)" >> $$@
@echo "#define HostPlatform_TYPE $(HostPlatform_$1_CPP)" >> $$@
@echo >> $$@