import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; import htmlc.*; outdir = ".."; content1Dir = "content1"; content2Dir = "content2"; content1Files = make.createFileList(content1Dir, ".*\\.html"); content2Files = make.createFileList(content2Dir, ".*\\.html"); destFiles = make.substitute("(.*)\\.html", outdir+"/$1.html", content1Files); destFiles = make.combine(destFiles, make.substitute("(.*)\\.html", outdir+"/$1.html", content2Files)); globalFiles = new String[] { "menu.html", "info.html" }; //------------------------------------------------------------------- //==-- RULE FOR FILES USING TEMPLATE1 --== for (file : content1Files) make.createExplicitRule(outdir+"/"+file, new String[] { content1Dir+"/"+file, "template1.html" }, "combine", true); //------------------------------------------------------------------- //==-- RULE FOR FILES USING TEMPLATE2 --== for (file : content2Files) make.createExplicitRule(outdir+"/"+file, new String[] { content2Dir+"/"+file, "template2.html" }, "combine", true); //------------------------------------------------------------------- //==-- HTML COMBINE RULE --== combine(String target, String[] prereqs) { print("Processing "+target); f = new File(target); htmlCombine = new HTMLCombine(prereqs[1], f.getName()); htmlCombine.parseContentFile("content", prereqs[0]); output = new PrintWriter(new FileWriter(target)); output.print(htmlCombine.combine()); output.close(); } //==-- SET DEPENDENCY ON BUILD FILE --== make.createPatternDependency(".*", "build.bsh"); //==-- SET DEPENDENCY ON GLOBAL FILES --== make.createPatternDependency(outdir+"/(.*)\\.html", globalFiles); make.createPhonyRule("build", destFiles, null); make.setDefaultTarget("build");