summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-07-29 03:28:50 -0400
committerBen Sima <ben@bsima.me>2022-07-29 03:28:50 -0400
commitc39c7eb0fa82cececf286b48d5215f8f892c4d41 (patch)
tree9ce4b01f94e24109cde598663962a226ba8f14de
parent368241c89957ec70ddc789b23dc03f2518198bf6 (diff)
Parse sysdeps for C code
-rw-r--r--Biz/Bild.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/Biz/Bild.hs b/Biz/Bild.hs
index 270508f..602a326 100644
--- a/Biz/Bild.hs
+++ b/Biz/Bild.hs
@@ -349,8 +349,13 @@ analyze path = do
Namespace.C -> do
pure
Target
- { langdeps = Set.empty,
- sysdeps = Set.empty,
+ { langdeps = Set.empty, -- c has no lang deps...?
+ sysdeps =
+ contentLines
+ /> Text.unpack
+ /> Regex.match (metaSys "//")
+ |> catMaybes
+ |> Set.fromList,
compiler = Gcc,
out =
contentLines
@@ -664,7 +669,7 @@ metaDep :: Regex.RE Char Dep
metaDep = Regex.string "-- : dep " *> Regex.many (Regex.psym Char.isAlpha)
metaSys :: [Char] -> Regex.RE Char Dep
-metaSys comment = Regex.string (comment ++ " : sys ") *> Regex.many (Regex.psym Char.isAlpha)
+metaSys comment = Regex.string (comment ++ " : sys ") *> Regex.many (Regex.psym (not <. Char.isSpace))
metaOut :: [Char] -> Regex.RE Char Out
metaOut comment = Regex.string (comment ++ " : out ") *> Regex.many (Regex.psym (/= ' '))