Added code for full compilation mode to include the relevant C files from occam #USE directives, and link to the relevant object files

This commit is contained in:
Neil Brown 2009-04-01 18:32:39 +00:00
parent d457b793c0
commit 8153cfc659
3 changed files with 11 additions and 2 deletions

View File

@ -285,9 +285,15 @@ compileFull inputFile moutputFile
lift $ withOutputFile postCFile $ \h -> postCAnalyse sFile ((h,intErr),intErr)
-- Compile this new "post" C file into an object file
exec $ cCommand postCFile postOFile (csCompilerFlags optsPS)
cs <- lift getCompState
let otherOFiles = [usedFile ++ ".o"
| usedFile <- Set.toList $ csUsedFiles cs]
-- Link the object files into a binary
when shouldLink $
exec $ cLinkCommand [oFile, postOFile] outputFile (csCompilerLinkFlags optsPS)
exec $ cLinkCommand (oFile : postOFile : otherOFiles) outputFile (csCompilerLinkFlags optsPS)
-- For C++, just compile the source file directly into a binary
BackendCPPCSP ->

View File

@ -169,6 +169,9 @@ cgenTopLevel headerName s
tell ["#include \"", dropPath headerName, "\"\n"]
sequence_ [tell ["#include \"", usedFile, ".h\"\n"]
| usedFile <- Set.toList $ csUsedFiles cs]
sequence_ [tell ["extern int ", nameString n, "_stack_size;\n"]
| n <- (Set.toList $ csParProcs cs)
++ [A.Name emptyMeta n | A.NameDef

View File

@ -6,7 +6,7 @@ import Data.List
import Paths
tockIncludeFlags :: String
tockIncludeFlags = "-I" ++ pkgIncludeDir
tockIncludeFlags = "-I. -I" ++ pkgIncludeDir
cCommand :: String -> String -> String -> String
cCommand inp out extra = "@CC@ @TOCK_CFLAGS@ " ++ tockIncludeFlags ++ " -c -o " ++ out ++ " " ++ inp