1:import java.io.*;
   2:import javax.xml.transform.*;
   3:import javax.xml.transform.stream.*;
   4:
   5:outdir = "..";
   6:contentdir = "content";
   7:
   8:contentFiles = make.createFileList(contentdir, ".*\\.html");
   9:destFiles = make.substitute("(.*)\\.html", outdir+"/$1.html", contentFiles);
  10:
  11:staticFiles = new String[]
  12:    {
  13:    "template.html",
  14:    "menu.html"
  15:    };
  16:
  17://-------------------------------------------------------------------
  18://==-- GENERATE NEWS CONTENT --==
  19:make.createExplicitDependency(outdir+"/index.html", "news.html");
  20:make.createExplicitRule("news.html", new String[]
  21:        {
  22:        "news.xml",
  23:        "news.xsl"
  24:        }, "transform", true);
  25:transform(String target, String[] prereqs)
  26:    {
  27:    print("Transforming "+target);
  28:    tf = TransformerFactory.newInstance();
  29:    trans = tf.newTransformer(new StreamSource(new File("news.xsl")));
  30:    trans.transform(new StreamSource(new File("news.xml")), new StreamResult(new File("news.html")));
  31:    }
  32:
  33://-------------------------------------------------------------------
  34://==-- HTML PROCESSING RULE --==
  35:make.createPatternDependency(outdir+"/(.*)\\.html", staticFiles);
  36:make.createPatternRule(outdir+"/(.*)\\.html", contentdir+"/$1.html", "combine", true);
  37:combine(String target, String[] prereqs)
  38:    {
  39:    print("Processing "+target);
  40:    f = new File(target);
  41:    htmlCombine = new HTMLCombine("template.html", f.getName());
  42:    htmlCombine.parseContentFile("content", prereqs[0]);
  43:    output = new PrintWriter(new FileWriter(target));
  44:    output.print(htmlCombine.combine());
  45:    output.close();
  46:    }
  47:    
  48://==-- SET DEPENDENCY ON BUILD FILE --==
  49:make.createPatternDependency(".*", "build.bsh");
  50:    
  51:make.createPhonyRule("build", destFiles, null);
  52:
  53:make.setDefaultTarget("build");
  54: