diff options
author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2008-05-15 23:04:05 +0000 |
---|---|---|
committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2008-05-15 23:04:05 +0000 |
commit | bca61eb59ad615793175e4d1a3de7a243b41de44 (patch) | |
tree | 02712eef64353f69ef591bf3b922f3a1e018903f /utils/ext-core | |
parent | 2d0131da643d1f8da16816c672b7e29defcf2a2d (diff) | |
download | haskell-bca61eb59ad615793175e4d1a3de7a243b41de44.tar.gz |
don't rebuild PrimEnv if genprimopcode and/or primops.txt don't exist
This helps if, for example, you want to build the Core tools on a machine that doesn't have a GHC build tree, and have a pre-existing copy of PrimEnv.hs.
Diffstat (limited to 'utils/ext-core')
-rw-r--r-- | utils/ext-core/Setup.lhs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/utils/ext-core/Setup.lhs b/utils/ext-core/Setup.lhs index bdcd784ca0..806e9ff946 100644 --- a/utils/ext-core/Setup.lhs +++ b/utils/ext-core/Setup.lhs @@ -28,6 +28,10 @@ Mostly snarfed from ghc-prim's Setup.hs. \begin{code} type Hook a = PackageDescription -> LocalBuildInfo -> UserHooks -> a -> IO () + +-- Hack: If PrimEnv.hs exists *and* genprimopcode or +-- primops.txt doesn't exist, don't rebuild PrimEnv.hs + build_primitive_sources :: Hook a -> Hook a build_primitive_sources f pd lbi uhs x = do when (compilerFlavor (compiler lbi) == GHC) $ do @@ -37,10 +41,14 @@ build_primitive_sources f pd lbi uhs x "primops.txt"] primhs = joinPath ["Language", "Core", "PrimEnv.hs"] primhs_tmp = addExtension primhs "tmp" - maybeExit $ system (genprimopcode ++ " --make-ext-core-source < " + primEnvExists <- doesFileExist primhs + genprimopcodeExists <- doesFileExist genprimopcode + primopsExists <- doesFileExist primops + unless (primEnvExists && !genprimopcodeExists && !primopsExists) do + maybeExit $ system (genprimopcode ++ " --make-ext-core-source < " ++ primops ++ " > " ++ primhs_tmp) - maybeUpdateFile primhs_tmp primhs - maybeExit $ system ("make -C lib/GHC_ExtCore") + maybeUpdateFile primhs_tmp primhs + maybeExit $ system ("make -C lib/GHC_ExtCore") f pd lbi uhs x -- Replace a file only if the new version is different from the old. |