-- | This file is automatically generated by autoconf from CompilerCommands.hs.in
module CompilerCommands where

import Data.List

-- Because we can't know for sure yet where Tock will be installed,
-- we must include this pkg-config call to be executed each time
-- to find out where our headers live.  Suggestions for a better way
-- are welcome.
tockIncludeFlags :: String
tockIncludeFlags = "`pkg-config --cflags tock-1.0`"

cCommand :: String -> String -> String
cCommand inp out = "@CC@ @TOCK_CFLAGS@ " ++ tockIncludeFlags ++ " -c -o " ++ out ++ " " ++ inp

cAsmCommand :: String -> String -> String
cAsmCommand inp out = "@CC@ @TOCK_CFLAGS@ -S -o " ++ out ++ " " ++ inp

cLinkCommand :: [String] -> String -> String
cLinkCommand files out = "@CC@ @TOCK_CFLAGS@ -o " ++ out ++ " " ++ (concat (intersperse " " files)) ++ " @TOCK_CLDFLAGS@"

cxxCommand :: String -> String -> String
cxxCommand inp out = "@CXX@ @TOCK_CXXFLAGS@ " ++ tockIncludeFlags ++ " -o " ++ out ++ " " ++ inp ++ " @TOCK_CXXLDFLAGS@"