Add --keep option to not delete *.hs_make.c.
Add -c -l -C -L -i as synonyms for --cc --ld --cflag --lflag --include.
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.21 2001/02/13 17:40:37 qrczak Exp $
+-- $Id: Main.hs,v 1.22 2001/02/22 22:39:56 qrczak Exp $
--
-- (originally "GlueHsc.hs" by Marcin 'Qrczak' Kowalczyk)
--
--
-- (originally "GlueHsc.hs" by Marcin 'Qrczak' Kowalczyk)
--
| Linker String
| CompFlag String
| LinkFlag String
| Linker String
| CompFlag String
| LinkFlag String
| Include String
include :: String -> Flag
| Include String
include :: String -> Flag
options :: [OptDescr Flag]
options = [
Option "t" ["template"] (ReqArg Template "FILE") "template file",
options :: [OptDescr Flag]
options = [
Option "t" ["template"] (ReqArg Template "FILE") "template file",
- Option "" ["cc"] (ReqArg Compiler "PROG") "C compiler to use",
- Option "" ["ld"] (ReqArg Linker "PROG") "linker to use",
- Option "" ["cflag"] (ReqArg CompFlag "FLAG") "flag to pass to the C compiler",
+ Option "c" ["cc"] (ReqArg Compiler "PROG") "C compiler to use",
+ Option "l" ["ld"] (ReqArg Linker "PROG") "linker to use",
+ Option "C" ["cflag"] (ReqArg CompFlag "FLAG") "flag to pass to the C compiler",
Option "I" [] (ReqArg (CompFlag . ("-I"++))
"DIR") "passed to the C compiler",
Option "I" [] (ReqArg (CompFlag . ("-I"++))
"DIR") "passed to the C compiler",
- Option "" ["lflag"] (ReqArg LinkFlag "FLAG") "flag to pass to the linker",
- Option "" ["include"] (ReqArg include "FILE") "as if placed in the source",
+ Option "L" ["lflag"] (ReqArg LinkFlag "FLAG") "flag to pass to the linker",
+ Option "" ["keep"] (NoArg Keep) "don't delete *.hs_make.c",
+ Option "i" ["include"] (ReqArg include "FILE") "as if placed in the source",
Option "" ["help"] (NoArg Help) "display this help and exit",
Option "" ["version"] (NoArg Version) "output version information and exit"]
Option "" ["help"] (NoArg Help) "display this help and exit",
Option "" ["version"] (NoArg Version) "output version information and exit"]
baseName = case reverse name of
'c':base -> reverse base
_ -> name++".hs"
baseName = case reverse name of
'c':base -> reverse base
_ -> name++".hs"
- cProgName = baseName++"c_make_hs.c"
- oProgName = baseName++"c_make_hs.o"
- progName = baseName++"c_make_hs"
+ cProgName = baseName++"_make.c"
+ oProgName = baseName++"_make.o"
+ progName = baseName++"_make"
outHsName = baseName
outHName = baseName++".h"
outCName = baseName++".c"
outHsName = baseName
outHName = baseName++".h"
outCName = baseName++".c"
case compilerStatus of
e@(ExitFailure _) -> exitWith e
_ -> return ()
case compilerStatus of
e@(ExitFailure _) -> exitWith e
_ -> return ()
+ when (null [() | Keep <- flags]) $ removeFile cProgName
linkerStatus <- system $
linker++
linkerStatus <- system $
linker++