[edit web page: add ruleSS document Yoshikuni Jujo **20081130004211] { hunk ./memo.ja_JP.utf8 258 +2008.11.30 Sun. +upload する前に、yjtools を upload すること。 + hunk ./todo.ja_JP.utf8 14 +[ ] upload する前に、yjtools を 0.9.6 に upload すること。 hunk ./web_page/Hakefile 25 -hakeSrc = "../dist/hake-0.9.9.1.tar.gz" +hakeSrc = "../dist/hake-0.9.9.2.tar.gz" adddir ./web_page/samples/use_ruleSS addfile ./web_page/samples/use_ruleSS/Hakefile hunk ./web_page/samples/use_ruleSS/Hakefile 1 +import Development.Hake +import Development.Hake.FunSetRaw + +targets = [ hello, goodBye ] +hello = "hello" +goodBye = "good-bye" +moduleN = "sayHelloTo" + +main = hake $ [ + + dflt targets + , + ruleSS "" ".o" $ \t s -> [ (".c" , [ [ "gcc", "-o", t ] ++ filter (isSuffixOf ".o") s ]), + (".cc", [ [ "g++", "-o", t ] ++ filter (isSuffixOf ".o") s ]) ] + , + rule ".o" ".c" $ \_ (s:_) -> [ [ "gcc", "-c", s ] ] + , + rule ".o" ".cc" $ \_ (s:_) -> [ [ "g++", "-c", s ] ] + , + task "clean" [ [ "rm", "-f" ] ++ + concatMap (\s -> [ s, s ++ ".o"]) targets ++ + [ moduleN ++ ".o" ] ] + + ] `addDeps` [ + + ( hello , [ moduleN ++ ".o" ] ) + , + ( hello ++ ".o", [ moduleN ++ ".h" ] ) + + ] addfile ./web_page/samples/use_ruleSS/good-bye.cc hunk ./web_page/samples/use_ruleSS/good-bye.cc 1 +#include + +using namespace std; + +int +main() +{ + cout << "Hello, world!" << endl; + return 0; + } addfile ./web_page/samples/use_ruleSS/hello.c hunk ./web_page/samples/use_ruleSS/hello.c 1 +#include "sayHelloTo.h" + +int +main (int argc, char *argv[]) +{ + sayToWorld( "Hello" ); + return 0; + } addfile ./web_page/samples/use_ruleSS/sayHelloTo.c hunk ./web_page/samples/use_ruleSS/sayHelloTo.c 1 +#include + +void +sayToWorld (char who[]) +{ + printf( "Hello, %s!\n", who ); + } addfile ./web_page/samples/use_ruleSS/sayHelloTo.h hunk ./web_page/samples/use_ruleSS/sayHelloTo.h 1 +void +sayHelloTo (char who[]); hunk ./web_page/short_tutorial.xhtml.ehs 28 +

5. use ruleSS sample

+

5.1. ruleSS function

+

5.2. try

hunk ./web_page/short_tutorial/Hakefile 16 +useRuleSSXhtml = "use_ruleSS.xhtml" hunk ./web_page/short_tutorial/Hakefile 23 +useRuleSSXhtmlMoreFile = [ "Hakefile_use_ruleSS" ] hunk ./web_page/short_tutorial/Hakefile 31 + , useRuleSSXhtml hunk ./web_page/short_tutorial/Hakefile 40 + ++ useRuleSSXhtmlMoreFile hunk ./web_page/short_tutorial/Hakefile 48 + , (useRuleSSXhtml , useRuleSSXhtmlMoreFile ++ [ "Variables.hs" ] ) hunk ./web_page/short_tutorial/use_addDeps.xhtml.ehs 5 -use addDeps +4. use addDeps hunk ./web_page/short_tutorial/use_addDeps.xhtml.ehs 11 +
> ls
+hello.c sayHello.c Hakefile
addfile ./web_page/short_tutorial/use_ruleSS.xhtml.ehs hunk ./web_page/short_tutorial/use_ruleSS.xhtml.ehs 1 + +<%% import Variables %%> +<%% import System.Time (getClockTime) %%> +> +use ruleSS + +

5. use ruleSS

+

updated at <%==$ getClockTime %>

+

This page is under construction.

+ +

5.1. ruleSS function

+
> ls
+Hakefile good-bye.cc hello.c sayHelloTo.c sayHelloTo.h
+<%== catHakefile "use_ruleSS" %> + +

5.2. try

+
> hake
+g++ -c good-bye.cc
+g++ -o good-bye good-bye.o
+gcc -c sayHelloTo.c
+gcc -c hello.c
+gcc -o hello hello.o sayHelloTo.o
+ + + hunk ./web_page/versions_file 2 -my_home_version: 0.9.9.1 +my_home_version: 0.9.9.2 }