Fix making it possible to build without the NCG
authorIan Lynagh <igloo@earth.li>
Mon, 18 Aug 2008 20:28:45 +0000 (20:28 +0000)
committerIan Lynagh <igloo@earth.li>
Mon, 18 Aug 2008 20:28:45 +0000 (20:28 +0000)
If
    GhcWithNativeCodeGen = NO
then we don't build the NCG modules, and we define OMIT_NATIVE_CODEGEN

compiler/Makefile
compiler/ghc.cabal

index eabf9c6..01a6ba4 100644 (file)
@@ -80,6 +80,14 @@ CONFIGURE_FLAGS_STAGE2 += --flags=-stage1
 
 CONFIGURE_FLAGS_STAGE1 += --flags=-ghci
 
+ifeq "$(GhcWithNativeCodeGen)" "YES"
+CONFIGURE_FLAGS_STAGE1 += --flags=ncg
+CONFIGURE_FLAGS_STAGE2 += --flags=ncg
+else
+CONFIGURE_FLAGS_STAGE1 += --flags=-ncg
+CONFIGURE_FLAGS_STAGE2 += --flags=-ncg
+endif
+
 ifeq "$(GhcWithInterpreter)" "YES"
 CONFIGURE_FLAGS_STAGE2 += --flags=ghci
 
index 5a62841..88b04d1 100644 (file)
@@ -26,6 +26,9 @@ Flag editline
 Flag ghci
     Description: Build GHCi support.
 
+Flag ncg
+    Description: Build the NCG.
+
 Flag stage1
     Description: Is this stage 1?
 
@@ -60,6 +63,9 @@ Library
         CPP-Options: -DGHCI
         Include-Dirs: ../libffi/build/include
 
+    if !flag(ncg)
+        CPP-Options: -DOMIT_NATIVE_CODEGEN
+
     -- GHC 6.4.2 needs to be able to find WCsubst.c, which needs to be
     -- able to find WCsubst.h
     Include-Dirs: ../libraries/base/cbits, ../libraries/base/include
@@ -98,7 +104,6 @@ Library
         hsSyn
         iface
         main
-        nativeGen
         parser
         prelude
         profiling
@@ -269,24 +274,6 @@ Library
         StaticFlags
         SysTools
         TidyPgm
-        AsmCodeGen
-        MachCodeGen
-        MachInstrs
-        MachRegs
-        NCGMonad
-        PositionIndependentCode
-        PprMach
-        RegAllocColor
-        RegAllocInfo
-        RegAllocLinear
-        RegAllocStats
-        RegArchBase
-        RegArchX86
-        RegCoalesce
-        RegLiveness
-        RegSpill
-        RegSpillClean
-        RegSpillCost
         Ctype
         HaddockLex
         HaddockParse
@@ -418,6 +405,30 @@ Library
         VectUtils
         Vectorise
 
+    if flag(ncg)
+        hs-source-dirs:
+            nativeGen
+
+        Exposed-Modules:
+            AsmCodeGen
+            MachCodeGen
+            MachInstrs
+            MachRegs
+            NCGMonad
+            PositionIndependentCode
+            PprMach
+            RegAllocColor
+            RegAllocInfo
+            RegAllocLinear
+            RegAllocStats
+            RegArchBase
+            RegArchX86
+            RegCoalesce
+            RegLiveness
+            RegSpill
+            RegSpillClean
+            RegSpillCost
+
     if flag(ghci)
         Exposed-Modules:
             DsMeta