tock-mirror/CompilerCommands.hs.in
Neil Brown 4e890a45d5 Reworked the way we record the C/C++ compiler flags for Tock to use
Previously, the files were auto-generated from the Makefile.am.  This patch changes to generate the flags using .in files, generated by the configure script.

The only problem with this is that the include directory for the Tock support files became difficult, because it depended on Tock's install prefix.  As a solution, I've added a pkg-config file for the Tock flags.  There might be some way to streamline the whole process once CCSP uses pkg-config, as then Tock, CCSP and C++CSP will all use pkg-config; it might be more flexible for Tock to run the pkg-config command every time it compiles, to avoid having to recompile Tock if you reinstall one of its C/C++ dependencies to a new directory.
2008-03-25 14:53:06 +00:00

24 lines
1008 B
Haskell

-- | 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@"