[edit web page: add use delRules sample Yoshikuni Jujo **20081130062432] { adddir ./web_page/samples/use_delRules addfile ./web_page/samples/use_delRules/Hakefile hunk ./web_page/samples/use_delRules/Hakefile 1 +import Development.Hake +import Development.Hake.FunSetRaw + +target = "hello" +moduleN = "sayHelloTo" + +main = hake $ [ + + dflt [ target ] + , + rule "" ".o" $ \t s -> [ [ "cc", "-o", t ] ++ filter (isSuffixOf ".o") s ] + , + rule ".o" ".c" $ \_ (s:_) -> [ [ "cc", "-c", s ] ] + , + task "clean" [ [ "rm", "-f", target, target ++ ".o", moduleN ++ ".o" ] ] + + ] `addDeps` [ + + (target , [ moduleN ++ ".o" ]) + , + (target ++ ".o", [ moduleN ++ ".h" ]) + + ] `delRules` [ + + (moduleN, [ moduleN ++ ".o" ]) + + ] addfile ./web_page/samples/use_delRules/hello.c hunk ./web_page/samples/use_delRules/hello.c 1 +#include "sayHelloTo.h" + +int +main( int argc, char *argv[] ) +{ + sayHelloTo( "world" ); + return 0; + } addfile ./web_page/samples/use_delRules/sayHelloTo.c hunk ./web_page/samples/use_delRules/sayHelloTo.c 1 +#include + +void +sayHelloTo( char who[] ) +{ + printf( "Hello, %s!", who ); + } addfile ./web_page/samples/use_delRules/sayHelloTo.h hunk ./web_page/samples/use_delRules/sayHelloTo.h 1 +void +sayHelloTo( char who[] ); hunk ./web_page/short_tutorial.xhtml.ehs 48 +

11. use delRules

+

11.1. delRules function

+

11.2. try

hunk ./web_page/short_tutorial/Hakefile 23 +useDelRulesXhtml = "use_delRules.xhtml" hunk ./web_page/short_tutorial/Hakefile 36 +useDelRulesXhtmlMoreFile = [ "Hakefile_use_delRules" ] hunk ./web_page/short_tutorial/Hakefile 50 + , useDelRulesXhtml hunk ./web_page/short_tutorial/Hakefile 65 + ++ useDelRulesXhtmlMoreFile hunk ./web_page/short_tutorial/Hakefile 81 + , (useDelRulesXhtml , useDelRulesXhtmlMoreFile ++ [ "Variables.hs" ] ) addfile ./web_page/short_tutorial/use_delRules.xhtml.ehs hunk ./web_page/short_tutorial/use_delRules.xhtml.ehs 1 + +<%% import Variables %%> +<%% import System.Time (getClockTime) %%> +> +use delRules + + +

11. use delRules

+

updated at <%==$ getClockTime %>

+ +

If you don't need, you can delete rules by delRules.

+ +

11.1. delRules function

+
> ls
+Hakefile hello.c sayHelloTo.c sayHelloTo.h
+<%== catHakefile "use_delRules" %> + +

11.2. try

+
> hake
+cc -c sayHelloTo.c
+cc -c hello.c
+cc -o hello hello.o sayHelloTo.o
+> hake sayHelloTo
+Hakefile: No usable rules for make target 'sayHelloTo'
+
+ + + }