Skip to content

Commit

Permalink
Cleanup Generate a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
angerman committed Nov 8, 2017
1 parent d732756 commit d512b30
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Rules/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ primopsTxt stage = buildDir (vanillaContext stage compiler) -/- "primops.txt"
platformH :: Stage -> FilePath
platformH stage = buildDir (vanillaContext stage compiler) -/- "ghc_boot_platform.h"

versionsH :: Stage -> FilePath
versionsH stage = buildDir (vanillaContext stage compiler) -/- "HsVersions.h"

isGeneratedCmmFile :: FilePath -> Bool
isGeneratedCmmFile file = takeBaseName file == "AutoApply"

Expand Down Expand Up @@ -143,7 +146,9 @@ generatePackageCode context@(Context stage pkg _) =
when (pkg == compiler) $ do
"//" ++ primopsTxt stage %> \file -> do
root <- buildRoot
need $ [root -/- platformH stage, primopsSource]
need $ [ root -/- platformH stage
, root -/- versionsH stage
, primopsSource]
++ fmap (root -/-) includesDependencies
build $ target context HsCpp [primopsSource] [file]

Expand All @@ -152,6 +157,9 @@ generatePackageCode context@(Context stage pkg _) =
when (stage == Stage0) $ do
"//compiler/ghc_boot_platform.h" %> go generateGhcBootPlatformH
"//" ++ platformH stage %> go generateGhcBootPlatformH
"//" ++ versionsH stage %> \file -> do
dir <- return "compiler"
copyFile (dir -/- takeFileName file) file

when (pkg == rts) $ "//" ++ dir -/- "cmm/AutoApply.cmm" %> \file ->
build $ target context GenApply [] [file]
Expand Down

0 comments on commit d512b30

Please sign in to comment.