[edit web page: add use hakefileIs Yoshikuni Jujo **20081130054529] { hunk ./web_page/Variables.hs 4 +, catFile adddir ./web_page/samples/use_hakefileIs addfile ./web_page/samples/use_hakefileIs/Hakefile hunk ./web_page/samples/use_hakefileIs/Hakefile 1 +import Development.Hake + +main = hakefileIs "hakeMain.hs" [ "Variables.hs" ] addfile ./web_page/samples/use_hakefileIs/Variables.hs hunk ./web_page/samples/use_hakefileIs/Variables.hs 1 +module Variables ( + target +) where + +target = "hello" addfile ./web_page/samples/use_hakefileIs/hakeMain.hs hunk ./web_page/samples/use_hakefileIs/hakeMain.hs 1 +import Development.Hake +import Development.Hake.FunSetRaw +import Variables + +main = hake [ + + dflt [ target ] + , + rule "" ".c" $ \t (s:_) -> [ [ "cc", "-o", t, s ] ] + + ] addfile ./web_page/samples/use_hakefileIs/hello.c hunk ./web_page/samples/use_hakefileIs/hello.c 1 +#include + +int +main (int argc, char *argv[]) +{ + printf( "Hello, world!\n" ); + return 0; + } hunk ./web_page/short_tutorial.xhtml.ehs 44 +

10. use hakefileIs

+

10.1. hakefileIs function

+

10.2. try

+

10.3. and something

hunk ./web_page/short_tutorial/Hakefile 10 +import System.IO.Unsafe hunk ./web_page/short_tutorial/Hakefile 13 -firstSampleXhtml = "first_sample.xhtml" -useRuleXhtml = "use_rule.xhtml" -useDefaultXhtml = "use_default.xhtml" -useAddDepsXhtml = "use_addDeps.xhtml" -useRuleSSXhtml = "use_ruleSS.xhtml" -useRuleVXhtml = "use_ruleV.xhtml" -useGetValsXhtml = "use_getVals.xhtml" -fileAgainXhtml = "file_again.xhtml" -useGetNewersXhtml = "use_getNewers.xhtml" +firstSampleXhtml = "first_sample.xhtml" +useRuleXhtml = "use_rule.xhtml" +useDefaultXhtml = "use_default.xhtml" +useAddDepsXhtml = "use_addDeps.xhtml" +useRuleSSXhtml = "use_ruleSS.xhtml" +useRuleVXhtml = "use_ruleV.xhtml" +useGetValsXhtml = "use_getVals.xhtml" +fileAgainXhtml = "file_again.xhtml" +useGetNewersXhtml = "use_getNewers.xhtml" +useHakefileIsXhtml = "use_hakefileIs.xhtml" hunk ./web_page/short_tutorial/Hakefile 25 -firstSampleXhtmlMoreFile = [ "Hakefile_first_sample" ] -useRuleXhtmlMoreFile = [ "Hakefile_use_rule" , "Hakefile_use_rule_FunSetRaw" ] -useDefaultXhtmlMoreFile = [ "Hakefile_use_default" ] -useAddDepsXhtmlMoreFile = [ "Hakefile_use_addDeps" ] -useRuleSSXhtmlMoreFile = [ "Hakefile_use_ruleSS" ] -useRuleVXhtmlMoreFile = [ "Hakefile_use_ruleV" ] -useGetValsXhtmlMoreFile = [ "Hakefile_use_getVals" ] -fileAgainXhtmlMoreFile = [ "Hakefile_file_again" ] -useGetNewersXhtmlMoreFile = [ "Hakefile_use_getNewers" ] +firstSampleXhtmlMoreFile = [ "Hakefile_first_sample" ] +useRuleXhtmlMoreFile = [ "Hakefile_use_rule" , "Hakefile_use_rule_FunSetRaw" ] +useDefaultXhtmlMoreFile = [ "Hakefile_use_default" ] +useAddDepsXhtmlMoreFile = [ "Hakefile_use_addDeps" ] +useRuleSSXhtmlMoreFile = [ "Hakefile_use_ruleSS" ] +useRuleVXhtmlMoreFile = [ "Hakefile_use_ruleV" ] +useGetValsXhtmlMoreFile = [ "Hakefile_use_getVals" ] +fileAgainXhtmlMoreFile = [ "Hakefile_file_again" ] +useGetNewersXhtmlMoreFile = [ "Hakefile_use_getNewers" ] +useHakefileIsXhtmlMoreFile = [ "Hakefile_use_hakefileIs" ] ++ moreMoreFile hunk ./web_page/short_tutorial/Hakefile 47 + , useHakefileIsXhtml hunk ./web_page/short_tutorial/Hakefile 61 + ++ useHakefileIsXhtmlMoreFile hunk ./web_page/short_tutorial/Hakefile 63 -moreMoreFile = [] +moreMoreFile = [ "hakeMain.hs_use_hakefileIs", "Variables.hs_use_hakefileIs" ] hunk ./web_page/short_tutorial/Hakefile 67 - (firstSampleXhtml , firstSampleXhtmlMoreFile) - , (useRuleXhtml , useRuleXhtmlMoreFile ) - , (useDefaultXhtml , useDefaultXhtmlMoreFile ++ [ "Variables.hs" ] ) - , (useAddDepsXhtml , useAddDepsXhtmlMoreFile ++ [ "Variables.hs" ] ) - , (useRuleSSXhtml , useRuleSSXhtmlMoreFile ++ [ "Variables.hs" ] ) - , (useRuleVXhtml , useRuleVXhtmlMoreFile ++ [ "Variables.hs" ] ) - , (useGetValsXhtml , useGetValsXhtmlMoreFile ++ [ "Variables.hs" ] ) - , (fileAgainXhtml , fileAgainXhtmlMoreFile ++ [ "Variables.hs" ] ) - , (useGetNewersXhtml, useGetNewersXhtmlMoreFile ++ [ "Variables.hs" ] ) + (firstSampleXhtml , firstSampleXhtmlMoreFile) + , (useRuleXhtml , useRuleXhtmlMoreFile ) + , (useDefaultXhtml , useDefaultXhtmlMoreFile ++ [ "Variables.hs" ] ) + , (useAddDepsXhtml , useAddDepsXhtmlMoreFile ++ [ "Variables.hs" ] ) + , (useRuleSSXhtml , useRuleSSXhtmlMoreFile ++ [ "Variables.hs" ] ) + , (useRuleVXhtml , useRuleVXhtmlMoreFile ++ [ "Variables.hs" ] ) + , (useGetValsXhtml , useGetValsXhtmlMoreFile ++ [ "Variables.hs" ] ) + , (fileAgainXhtml , fileAgainXhtmlMoreFile ++ [ "Variables.hs" ] ) + , (useGetNewersXhtml , useGetNewersXhtmlMoreFile ++ [ "Variables.hs" ] ) + , (useHakefileIsXhtml, useHakefileIsXhtmlMoreFile ++ [ "Variables.hs" ] ) hunk ./web_page/short_tutorial/Hakefile 80 -copyFileRuleList = map (uncurry copyFileRule . mkCopyPairOfHakefile) moreFile ++ - map (uncurry copyFileRule . mkCopyPairOf) moreMoreFile +copyFileRuleList = map (uncurry copyFileRule . mkCopyPairOf) moreFile +-- ++ map (uncurry copyFileRule . mkCopyPairOf) moreMoreFile hunk ./web_page/short_tutorial/Hakefile 85 - = (fn, "../samples/" ++ getSecondBrReg "(.+)_(.+)" fn ++ "/" ++ getFirstBrReg "(.+)_(.+)" fn) + = let ret = (fn, "../samples/" ++ getSecondBrReg "(.+?)_(.+)" fn ++ "/" ++ getFirstBrReg "(.+?)_(.+)" fn) + in unsafePerformIO $ do +-- print ret + return ret addfile ./web_page/short_tutorial/use_hakefileIs.xhtml.ehs hunk ./web_page/short_tutorial/use_hakefileIs.xhtml.ehs 1 + +<%% import Variables %%> +<%% import System.Time (getClockTime) %%> +> +10. use hakefileIs + + +

10. use hakefileIs

+

updated at <%==$ getClockTime %>

+ +

10.1. hakefileIs function

+
> ls
+Hakefile Variables.hs hakeMain.hs hello.c
+<%== catHakefile "use_hakefileIs" %> +<%== catFile "hakeMain.hs" "use_hakefileIs" %> +<%== catFile "Variables.hs" "use_hakefileIs" %> + +

10.2. try

+
> hake
+cc -o hello hello.c
+ +

10.3. and something

+

You can use another directory's Hakefile and modules like following.

+

hakefileIs "../Hakefile" [ "../Variables.hs" ]

+ + + }