Squashed 'hadrian/' content from commit 438dc57
[ghc.git] / src / Stage.hs
1 module Stage (Stage (..), stageString) where
2
3 import Development.Shake.Classes
4 import GHC.Generics
5
6 -- | A stage refers to a certain compiler in GHC's build process.
7 --
8 -- * Stage 0 is built with the bootstrapping compiler, i.e. the one already
9 -- installed on the user's system. The compiler that is produced during
10 -- stage 0 is called /stage 1 compiler/.
11 --
12 -- * Stage 1 is built using the stage 1 compiler and all GHC sources. The result
13 -- is called /stage 2 compiler/ and it has all features of the new GHC.
14 --
15 -- * Stage 2 is built using the stage 2 compiler. The result is a compiler
16 -- fully "built by itself", commonly referred to as /bootstrapping/.
17 --
18 -- * Stage 3 is built as a self test. The resulting compiler should have
19 -- the same object code as the one built in stage 2, which is a good test
20 -- for the compiler. Since it serves no other purpose than that, the stage 3
21 -- build is usually omitted in the build process.
22 data Stage = Stage0 | Stage1 | Stage2 | Stage3
23 deriving (Show, Eq, Ord, Enum, Generic, Bounded)
24
25 instance Binary Stage
26 instance Hashable Stage
27 instance NFData Stage
28
29 -- | Prettyprint a 'Stage'.
30 stageString :: Stage -> String
31 stageString stage = "stage" ++ show (fromEnum stage)