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:
parent
d457b793c0
commit
8153cfc659
8
Main.hs
8
Main.hs
|
@ -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 ->
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user