[edit web page: add use getVals sample Yoshikuni Jujo **20081130032150] { hunk ./web_page/Variables.hs 6 +import Text.RegexPR (gsubRegexPR) + hunk ./web_page/Variables.hs 13 - cont <- readFile $ "../samples/" ++ dir ++ "/Hakefile" + cont_ <- readFile $ "../samples/" ++ dir ++ "/Hakefile" + let cont = flip (foldr (uncurry gsubRegexPR)) [ (">", ">"), ("<", "<") ] cont_ adddir ./web_page/samples/use_getVals addfile ./web_page/samples/use_getVals/Hakefile hunk ./web_page/samples/use_getVals/Hakefile 1 +import Development.Hake +import Development.Hake.FunSetRaw +import System.Environment + +target = "hello" +default_cflags = [ "-O" ] + +main = do + args <- getArgs + let cflags_ = getVals "cflags" args + cflags = if null cflags_ then default_cflags else cflags_ + hake [ + + dflt [ target ] + , + rule "" ".c" $ \t (s:_) -> [ [ "cc" ] ++ cflags ++ [ "-o", t, s ] ] + , + task "clean" [ [ "rm", "-f", target ] ] + + ] addfile ./web_page/samples/use_getVals/hello.c hunk ./web_page/samples/use_getVals/hello.c 1 +#include + +int +main (int argc, char *argv[]) +{ +#if DEBUG + printf( "DEBUG FLAG ON\n" ); +#endif + printf( "Hello, world!\n" ); + return 0; + } hunk ./web_page/samples/use_ruleSS/Hakefile 13 - ruleSS "" ".o" $ \t s -> [ (".c" , [ [ "gcc", "-o", t ] ++ filter (isSuffixOf ".o") s ]), - (".cc", [ [ "g++", "-o", t ] ++ filter (isSuffixOf ".o") s ]) ] + ruleSS "" ".o" $ \t s -> + [ (".c" , [ [ "gcc", "-o", t ] ++ filter (isSuffixOf ".o") s ]), + (".cc", [ [ "g++", "-o", t ] ++ filter (isSuffixOf ".o") s ]) ] hunk ./web_page/short_tutorial.xhtml.ehs 34 +

7. use getVals sample

+

7.1. getVals function

+

7.2. try

hunk ./web_page/short_tutorial/Hakefile 18 +useGetValsXhtml = "use_getVals.xhtml" hunk ./web_page/short_tutorial/Hakefile 27 +useGetValsXhtmlMoreFile = [ "Hakefile_use_getVals" ] hunk ./web_page/short_tutorial/Hakefile 37 + , useGetValsXhtml hunk ./web_page/short_tutorial/Hakefile 48 + ++ useGetValsXhtmlMoreFile hunk ./web_page/short_tutorial/Hakefile 58 + , (useGetValsXhtml , useGetValsXhtmlMoreFile ++ [ "Variables.hs" ] ) addfile ./web_page/short_tutorial/use_getVals.xhtml.ehs hunk ./web_page/short_tutorial/use_getVals.xhtml.ehs 1 + +<%% import Variables %%> +<%% import System.Time (getClockTime) %%> +<%% import Text.RegexPR (gsubRegexPR) %%> +> +use getVals + + +

7. use getVals

+

updated at <%==$ getClockTime %>

+

This page is under construction

+ +

7.1. getVals function

+
> ls
+Hakefile hello.c
+<%== catHakefile "use_getVals" %> + +

7.2. try

+
> hake
+cc -O -o hello hello.c
+> touch hello.c
+> hake "cflags=-Wall -DDEBUG"
+cc -Wall -DDEBUG -o hello hello.c
+ + + }