Add build rules for *.S sources, add rts/*.S files.
authorAndrey Mokhov <andrey.mokhov@gmail.com>
Thu, 7 Jan 2016 23:53:44 +0000 (23:53 +0000)
committerAndrey Mokhov <andrey.mokhov@gmail.com>
Thu, 7 Jan 2016 23:53:44 +0000 (23:53 +0000)
See #126.

src/Rules/Data.hs
src/Rules/Dependencies.hs

index 46072ce..de4f8c0 100644 (file)
@@ -95,13 +95,18 @@ buildPackageData rs target @ (PartialTarget stage pkg) = do
                           ++ [ "posix" | not windows ]
                           ++ [ "win32" |     windows ]
                 -- TODO: rts/dist/build/sm/Evac_thr.c, rts/dist/build/sm/Scav_thr.c
-                -- TODO: adding cmm sources to C_SRCS is a hack; rethink after #18
+                -- TODO: adding cmm/S sources to C_SRCS is a hack; rethink after #18
                 cSrcs    <- getDirectoryFiles (pkgPath pkg) (map (-/- "*.c") dirs)
                 cmmSrcs  <- getDirectoryFiles (pkgPath pkg) ["*.cmm"]
-                let extraSrcs = [ targetDirectory Stage1 rts -/- "build/AutoApply.cmm" ]
+                buildAdjustor   <- anyTargetArch ["i386", "powerpc", "powerpc64"]
+                buildStgCRunAsm <- anyTargetArch ["powerpc64le"]
+                let sSrcs = [ "AdjustorAsm.S" | buildAdjustor   ]
+                         ++ [ "StgCRunAsm.S"  | buildStgCRunAsm ]
+                    extraSrcs = [ targetDirectory Stage1 rts -/- "build/AutoApply.cmm" ]
                 includes <- interpretPartial target $ fromDiffExpr includesArgs
                 let contents = unlines $ map (prefix++)
-                        [ "C_SRCS = "   ++ unwords (cSrcs ++ cmmSrcs ++ extraSrcs)
+                        [ "C_SRCS = "
+                          ++ unwords (cSrcs ++ cmmSrcs ++ sSrcs ++ extraSrcs)
                         , "CC_OPTS = "  ++ unwords includes
                         , "COMPONENT_ID = " ++ "rts" ]
                 writeFileChanged mk contents
index 79bcdb2..2da9549 100644 (file)
@@ -15,10 +15,11 @@ buildPackageDependencies _ target @ (PartialTarget stage pkg) =
         dropBuild = (pkgPath pkg ++) . drop (length buildPath)
         hDepFile  = buildPath -/- ".hs-dependencies"
     in do
-        [ buildPath ++ "//*.c.deps", buildPath ++ "//*.cmm.deps" ] |%> \out -> do
-            let srcFile = dropBuild . dropExtension $ out
-            need [srcFile]
-            build $ fullTarget target (GccM stage) [srcFile] [out]
+        fmap (buildPath++)
+            [ "//*.c.deps", "//*.cmm.deps", "//*.S.deps" ] |%> \out -> do
+                let srcFile = dropBuild . dropExtension $ out
+                need [srcFile]
+                build $ fullTarget target (GccM stage) [srcFile] [out]
 
         hDepFile %> \out -> do
             srcs <- interpretPartial target getPackageSources