Commit 817c1a94 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

Define GHC_STAGE in headers instead of command-line

parent 63a5371d
......@@ -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
......
......@@ -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.
......
......@@ -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"
......
......@@ -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 >> $$@
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment