compiler: honor project title

This commit is contained in:
hellerve 2018-01-29 13:13:41 +01:00
parent 0d1ca0dfca
commit 06401dae56
2 changed files with 5 additions and 7 deletions

5
.gitignore vendored
View File

@ -5,10 +5,7 @@
/CarpHask-exe.prof
/out/*.so
/out/.DS_Store
/out/a.out
/out/main.c
/out/
/.DS_Store
/Carp.prof
dist/

View File

@ -83,6 +83,7 @@ commandProjectSet [XObj (Str key) _ _, value] =
"echoC" -> return ctx { contextProj = proj { projectEchoC = (valueStr == "true") } }
"echoCompilationCommand" -> return ctx { contextProj = proj { projectEchoCompilationCommand = (valueStr == "true") } }
"compiler" -> return ctx { contextProj = proj { projectCompiler = valueStr } }
"title" -> return ctx { contextProj = proj { projectTitle = valueStr } }
_ -> err ("Unrecognized key: '" ++ key ++ "'") ctx
put newCtx
return dynamicNil
@ -110,7 +111,7 @@ commandRunExe :: CommandCallback
commandRunExe args =
do ctx <- get
let outDir = projectOutDir (contextProj ctx)
outExe = outDir ++ "a.out"
outExe = outDir ++ projectTitle (contextProj ctx)
liftIO $ do handle <- spawnCommand outExe
exitCode <- waitForProcess handle
case exitCode of
@ -146,8 +147,8 @@ commandBuild args =
flags = projectFlags proj ++ includeCorePath ++ switches
outDir = projectOutDir proj
outMain = outDir ++ "main.c"
outExe = outDir ++ "a.out"
outLib = outDir ++ "lib.so"
outExe = outDir ++ projectTitle proj
outLib = outDir ++ projectTitle proj
createDirectoryIfMissing False outDir
writeFile outMain (incl ++ okSrc)
case Map.lookup "main" (envBindings env) of