New build system
authorDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Sat, 6 Oct 2007 01:55:10 +0000 (21:55 -0400)
committerDavid Bartley <dtbartle@csclub.uwaterloo.ca>
Sat, 6 Oct 2007 20:11:45 +0000 (16:11 -0400)
* Website is now built in build/ by default
* Build directory can be controlled via BUILDDIR environment variable
* Build files are no longer accessible from the web page

21 files changed:
.gitignore
Makefile
about/Makefile
buttons/Makefile [new file with mode: 0644]
common.mk.in [new file with mode: 0644]
cscweb.xsl [deleted file]
default.mk.in [deleted file]
events/Makefile
flash/Makefile [new file with mode: 0644]
logos/Makefile [new file with mode: 0644]
media/Makefile
media/files/.htaccess [deleted file]
media/flash [deleted symlink]
news/Makefile
office/Makefile
services/Makefile
xsl/events.xsl
xsl/html.xsl [new file with mode: 0644]
xsl/media.xsl
xsl/members.xsl
xsl/news.xsl

index 1d81296..2cdffe7 100644 (file)
@@ -3,4 +3,4 @@
 /members.xml
 /events.ics
 /books.xml
-/default.mk
+/common.mk
index 6987751..3f2cb53 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,20 @@
-INPUTS = index.xml
-SUBDIRS = about events office news services media
+FILES = events.ics events.atom news.atom index.html \
+       favicon.ico default.css robots.txt csclub.der csclub.pem
+SUBDIRS = about events office news services media buttons logos flash
+include common.mk
 
-first: noroot events.ics members.xml events.atom news.atom all
+build: noroot mkoutdir common.mk $(OUTPUTS)
+       @for i in $(SUBDIRS) ; do ($(MAKE) -C $$i || exit 1); done
        find ! -regex '.*/\..*' -type f ! -perm -0664 -print0 | xargs -r0 chmod u=rwX,g=rwX,o=rX || true
        find ! -regex '.*/\..*' -type d ! -perm 2775 -print0 | xargs -r0 chmod 2775 || true
        find ! -regex '.*/\..*' -type d ! -group www -print0 | xargs -r0 chgrp www || true
 
-noroot:
-       if test $$UID = 0; then echo "don't build as root!"; exit 1; fi
-
-members.xml:
-       test -e /usr/bin/ceoquery || (echo 'Erorr: ceoquery not found'; exit 1)
-       echo '<?xml version='\''1.0'\''?>' > $@
-       echo '<memberlist>' >> $@
-       ceoquery memberlist | sort | awk -F \| '{ name = $$1; program = $$2; userid = $$3; gsub(/&/, "\\&amp;", name); gsub(/&/, "\\&amp;", program); gsub(/"/, "\\&quot;", name); gsub(/"/, "\\&quot;", program); print "<member name=\"" name "\" program=\"" program "\" userid=\"" userid "\" />"; }' >> $@
-       echo '</memberlist>' >> $@
-
-events.ics:
-       perl scripts/xml2ics.pl events.xml > events.ics
-
-include default.mk
-
-%.atom: %.xml xsl/atom.xsl
-       java -classpath $(CLASSPATH) net.sf.saxon.Transform -o $@  $< $(ROOT)/xsl/atom.xsl $(XSLTARGS)
-       sed -i 's| xmlns=""||' $@
-
-default.mk: default.mk.in
+common.mk: common.mk.in
        echo 'ROOT = '`pwd` > $@
        cat $< >> $@
+       make
+       exit $?
 
-.PHONY: members.xml
+.PHONY: noroot
+noroot:
+       if test $$UID = 0; then echo "don't build as root!"; exit 1; fi
index 83968cd..255e57c 100644 (file)
@@ -1,7 +1,13 @@
-INPUTS = index.xml exec.xml members.xml constitution.xml \
-    constitution-change-20020920.xml constitution-change-20040205.xml
+FILES = members.xml index.html exec.html members.html constitution.html \
+    constitution-change-20020920.html constitution-change-20040205.html
+RELDIR = about/
+include ../common.mk
 
-include ../default.mk
-
-members.html: ../members.xml
+$(OUTDIR)members.html: $(OUTDIR)members.xml
 
+$(OUTDIR)members.xml:
+       test -e /usr/bin/ceoquery || (echo 'Erorr: ceoquery not found'; exit 1)
+       echo '<?xml version='\''1.0'\''?>' > $@
+       echo '<memberlist>' >> $@
+       ceoquery memberlist | sort | awk -F \| '{ name = $$1; program = $$2; userid = $$3; gsub(/&/, "\\&amp;", name); gsub(/&/, "\\&amp;", program); gsub(/"/, "\\&quot;", name); gsub(/"/, "\\&quot;", program); print "<member name=\"" name "\" program=\"" program "\" userid=\"" userid "\" />"; }' >> $@
+       echo '</memberlist>' >> $@
diff --git a/buttons/Makefile b/buttons/Makefile
new file mode 100644 (file)
index 0000000..28d269f
--- /dev/null
@@ -0,0 +1,5 @@
+FILES = about.png events.png gitweb.png gopher.png home.png library.png \
+       mailman.png media.png office.png services.png stats.png webmail.png \
+       wiki.png
+RELDIR = buttons/
+include ../common.mk
diff --git a/common.mk.in b/common.mk.in
new file mode 100644 (file)
index 0000000..69542ba
--- /dev/null
@@ -0,0 +1,50 @@
+
+all: mkoutdir build
+
+OUTDIR = $(ROOT)/build/$(RELDIR)
+OUTPUTS = $(addprefix $(OUTDIR),$(FILES))
+
+.PHONY += mkoutdir
+mkoutdir:
+       mkdir -p $(OUTDIR)
+
+.PHONY += build
+build: $(OUTPUTS)
+
+.PHONY += clean
+clean:
+       rm -rf $(OUTDIR)
+
+XSLTARGS = g_date=`date -I` g_time=`date +%H:%M:%S` \
+       g_pwd="$$(pwd)" g_root="$(ROOT)" g_outdir="$(OUTDIR)"
+CLASSPATH = /users/www/saxon8/saxon8.jar
+
+$(OUTDIR)%.html: %.xml $(ROOT)/csc.dtd $(ROOT)/xsl/*.xsl $(ROOT)/events.xml $(ROOT)/news.xml directory.xml
+       java -classpath $(CLASSPATH) net.sf.saxon.Transform -o $@ $< $(ROOT)/xsl/html.xsl $(XSLTARGS)
+       sed -i 's| xmlns=""||' $@
+
+$(OUTDIR)%.atom: %.xml xsl/atom.xsl
+       java -classpath $(CLASSPATH) net.sf.saxon.Transform -o $@  $< $(ROOT)/xsl/atom.xsl $(XSLTARGS)
+       sed -i 's| xmlns=""||' $@
+
+$(OUTDIR)%.ics: %.xml
+       perl scripts/xml2ics.pl $< > $@
+
+$(OUTDIR)%.ico: %.ico
+       cp -f $< $@
+$(OUTDIR)%.css: %.css
+       cp -f $< $@
+$(OUTDIR)%.gif: %.gif
+       cp -f $< $@
+$(OUTDIR)%.png: %.png
+       cp -f $< $@
+$(OUTDIR)%.swf: %.swf
+       cp -f $< $@
+$(OUTDIR)%.js: %.js
+       cp -f $< $@
+$(OUTDIR)%.txt: %.txt
+       cp -f $< $@
+$(OUTDIR)%.der: %.der
+       cp -f $< $@
+$(OUTDIR)%.pem: %.pem
+       cp -f $< $@
diff --git a/cscweb.xsl b/cscweb.xsl
deleted file mode 100644 (file)
index e8be211..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version='1.0'?>
-
-<xsl:stylesheet version="2.0"
-    xmlns="http://www.w3.org/1999/xhtml"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:xs="http://www.w3.org/2001/XMLSchema"
-    xmlns:fn="http://www.w3.org/2005/xpath-functions"
-    xmlns:csc="http://csclub.uwaterloo.ca/xslt">
-
-<xsl:param name="g_date" required="yes" />
-<xsl:param name="g_time" required="yes" />
-<xsl:param name="g_pwd" required="yes" />
-<xsl:param name="g_root" required="yes" />
-
-<!--
-
-  Set global "g_pre" variable based on /cscpage/@pre, which represents the
-  relative path needed to get to the root. If you do not include a "pre"
-  attribute on cscpage then the "pre" attribute will default to "../".
-
--->
-<xsl:variable name="g_pre">
- <xsl:choose>
-  <xsl:when test="/cscpage/@pre"><xsl:value-of select="/cscpage/@pre" /></xsl:when>
-  <xsl:otherwise>../</xsl:otherwise>
- </xsl:choose>
-</xsl:variable>
-
-<!-- mirror variables -->
-<xsl:variable name="g_mirror_csc">http://csclub.uwaterloo.ca/files/</xsl:variable>
-<xsl:variable name="g_mirror_cs">http://mirror.cs.uwaterloo.ca/csclub/</xsl:variable>
-
-<xsl:output method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
-
-<!-- include additional style sheets -->
-<xsl:include href="./xsl/functions.xsl" />
-<xsl:include href="./xsl/common.xsl" />
-<xsl:include href="./xsl/directory.xsl" />
-<xsl:include href="./xsl/menu.xsl" />
-<xsl:include href="./xsl/exec.xsl" />
-<xsl:include href="./xsl/members.xsl" />
-<xsl:include href="./xsl/events.xsl" />
-<xsl:include href="./xsl/news.xsl" />
-<xsl:include href="./xsl/media.xsl" />
-
-<xsl:template match="*">
-  <xsl:copy>
-    <xsl:copy-of select="@*" />
-    <xsl:apply-templates />
-  </xsl:copy>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/default.mk.in b/default.mk.in
deleted file mode 100644 (file)
index b80933a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-
-OUTPUTS=$(INPUTS:.xml=.html)
-XSLTARGS=g_date=`date -I` g_time=`date +%H:%M:%S` \
-       g_pwd="$$(pwd)" g_root="$(ROOT)"
-CLASSPATH=/users/www/saxon8/saxon8.jar
-
-all: $(OUTPUTS)
-       @for i in $(SUBDIRS) ; do cd $$i && ($(MAKE) || exit 1) && cd .. ; done
-
-clean:
-       @for i in $(SUBDIRS) ; do cd $$i && ($(MAKE) clean || exit 1) && cd .. ; done
-       rm -f *.html events.ics
-
-%.html: %.xml $(ROOT)/csc.dtd $(ROOT)/cscweb.xsl $(ROOT)/xsl/*.xsl $(ROOT)/events.xml $(ROOT)/news.xml $(ROOT)/default.mk directory.xml
-       java -classpath $(CLASSPATH) net.sf.saxon.Transform -o $@ $< $(ROOT)/cscweb.xsl $(XSLTARGS)
-       sed -i 's| xmlns=""||' $@
index f3b1c93..cce7021 100644 (file)
@@ -1,6 +1,6 @@
-INPUTS = index.xml old.xml
+FILES = index.html old.html
+RELDIR = events/
+include ../common.mk
 
-include ../default.mk
-
-all:
-       sed -i 's| xmlns=""||' *.html
+build:
+       sed -i 's| xmlns=""||' $(OUTDIR)*.html
diff --git a/flash/Makefile b/flash/Makefile
new file mode 100644 (file)
index 0000000..0ceaeb4
--- /dev/null
@@ -0,0 +1,3 @@
+FILES = flvplayer.swf swfobject.js
+RELDIR = flash/
+include ../common.mk
diff --git a/logos/Makefile b/logos/Makefile
new file mode 100644 (file)
index 0000000..0123ee5
--- /dev/null
@@ -0,0 +1,3 @@
+FILES = acm_logo.gif csc_logo.gif csc_only.png csc_title.gif uw_logo.gif
+RELDIR = logos/
+include ../common.mk
index d6ae29e..03fbd24 100644 (file)
@@ -1,7 +1,6 @@
-INPUTS = index.xml
-SUBDIRS = 
+FILES = index.html
+RELDIR = media/
+include ../common.mk
 
-include ../default.mk
-
-all:
-       sed -i 's| xmlns=""||' *.html
+build:
+       sed -i 's| xmlns=""||' $(OUTDIR)*.html
diff --git a/media/files/.htaccess b/media/files/.htaccess
deleted file mode 100644 (file)
index 4bdc445..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Redirect /media/files/ http://www.csclub.uwaterloo.ca/files/
diff --git a/media/flash b/media/flash
deleted file mode 120000 (symlink)
index 0e967d4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../flash/
\ No newline at end of file
index 53503f3..7832242 100644 (file)
@@ -1,6 +1,6 @@
-INPUTS = index.xml
+FILES = index.html
+RELDIR = news/
+include ../common.mk
 
-include ../default.mk
-
-all:
-       sed -i 's| xmlns=""||' *.html
+build:
+       sed -i 's| xmlns=""||' $(OUTDIR)*.html
index 723f6ac..32f34ed 100644 (file)
@@ -1,3 +1,3 @@
-INPUTS = index.xml books.xml webcam.xml webcam-streaming.xml
-
-include ../default.mk
+FILES = index.html books.html webcam.html webcam-streaming.html
+RELDIR = office/
+include ../common.mk
index 8596a86..168c99e 100644 (file)
@@ -1,5 +1,4 @@
-INPUTS = index.xml clubs.xml machine_usage.xml machine_usage_summary.xml \
-    machine_usage-change-20070819.xml
-SUBDIRS = 
-
-include ../default.mk
+FILES = index.html clubs.html machine_usage.html machine_usage_summary.html \
+    machine_usage-change-20070819.html
+RELDIR = services/
+include ../common.mk
index 32a90db..3dd7ebc 100644 (file)
@@ -74,7 +74,7 @@
   <xsl:result-document method="xml" encoding="ISO-8859-1"
       doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-      href="{translate(concat($g_root, '/events/', @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
+      href="{translate(concat($g_outdir, @room, '-', @date, '-', @time, '.html'), ' ', '_')}">
     <html>
       <head>
         <title><xsl:value-of select="@title" /></title>
       <xsl:result-document method="xml" encoding="ISO-8859-1"
             doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
             doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-            href="{translate(concat($g_root, '/events/old-', csc:term(@date), '.html'), ' ', '_')}">
+            href="{translate(concat($g_outdir, 'old-', csc:term(@date), '.html'), ' ', '_')}">
         <html>
           <head>
             <title>Events for <xsl:value-of select="csc:term(@date)" /></title>
diff --git a/xsl/html.xsl b/xsl/html.xsl
new file mode 100644 (file)
index 0000000..ffd3d8d
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version='1.0'?>
+
+<xsl:stylesheet version="2.0"
+    xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:fn="http://www.w3.org/2005/xpath-functions"
+    xmlns:csc="http://csclub.uwaterloo.ca/xslt">
+
+<xsl:param name="g_date" required="yes" />
+<xsl:param name="g_time" required="yes" />
+<xsl:param name="g_pwd" required="yes" />
+<xsl:param name="g_root" required="yes" />
+<xsl:param name="g_outdir" required="yes" />
+
+<!--
+
+  Set global "g_pre" variable based on /cscpage/@pre, which represents the
+  relative path needed to get to the root. If you do not include a "pre"
+  attribute on cscpage then the "pre" attribute will default to "../".
+
+-->
+<xsl:variable name="g_pre">
+ <xsl:choose>
+  <xsl:when test="/cscpage/@pre"><xsl:value-of select="/cscpage/@pre" /></xsl:when>
+  <xsl:otherwise>../</xsl:otherwise>
+ </xsl:choose>
+</xsl:variable>
+
+<!-- mirror variables -->
+<xsl:variable name="g_mirror_csc">http://csclub.uwaterloo.ca/files/</xsl:variable>
+<xsl:variable name="g_mirror_cs">http://mirror.cs.uwaterloo.ca/csclub/</xsl:variable>
+
+<xsl:output method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
+
+<!-- include additional style sheets -->
+<xsl:include href="functions.xsl" />
+<xsl:include href="common.xsl" />
+<xsl:include href="directory.xsl" />
+<xsl:include href="menu.xsl" />
+<xsl:include href="exec.xsl" />
+<xsl:include href="members.xsl" />
+<xsl:include href="events.xsl" />
+<xsl:include href="news.xsl" />
+<xsl:include href="media.xsl" />
+
+<xsl:template match="*">
+  <xsl:copy>
+    <xsl:copy-of select="@*" />
+    <xsl:apply-templates />
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
index 0e7d935..e24efac 100644 (file)
 
 <xsl:template match="flvfile">
   <xsl:param name="mirror" />
-  <script type="text/javascript" src="flash/swfobject.js"><xsl:text> </xsl:text></script>
+  <script type="text/javascript" src="../flash/swfobject.js"><xsl:text> </xsl:text></script>
   <p id="player1"><a href="http://www.macromedia.com/go/getflashplayer">
     Get the Flash Player</a> to see this video using Flash Player.</p>
   <script type="text/javascript">
-    var s1 = new SWFObject("flash/flvplayer.swf","single","400","300","7");
+    var s1 = new SWFObject("../flash/flvplayer.swf","single","400","300","7");
     s1.addParam("allowfullscreen","true");
     s1.addVariable("file","<xsl:value-of select="$mirror" /><xsl:value-of select="@file" />");
     <xsl:if test="@preview">
@@ -58,7 +58,7 @@
   <xsl:result-document method="xml" encoding="ISO-8859-1"
       doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
       doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-      href="{concat($g_root, '/media/', @title, $suffix, '.html')}">
+      href="{concat($g_outdir, @title, $suffix, '.html')}">
     <html>
       <head>
         <title><xsl:value-of select="@title" /></title>
index 5b868d8..0219d25 100644 (file)
@@ -10,7 +10,7 @@
 <xsl:template match="members-this-term">
   <p>The members for <xsl:value-of select="csc:term($g_date)" /> are
     listed here. We currently have
-    <xsl:value-of select="count(document(concat($g_root, '/members.xml'))/memberlist/member)" />
+    <xsl:value-of select="count(document(concat($g_outdir, 'members.xml'))/memberlist/member)" />
     members.</p>
   <table>
     <tr>
@@ -18,7 +18,7 @@
       <th>Program</th>
       <th>Userid</th>
     </tr>
-    <xsl:for-each select="document(concat($g_root, '/members.xml'))/memberlist/member">
+    <xsl:for-each select="document(concat($g_outdir, 'members.xml'))/memberlist/member">
       <xsl:variable name="class">
         <xsl:choose>
           <xsl:when test="position() mod 2 = 0">members1</xsl:when>
index e2e9607..cb79f09 100644 (file)
@@ -68,7 +68,7 @@
       <xsl:result-document method="xml" encoding="ISO-8859-1"
           doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
           doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
-          href="{translate(concat($g_root, '/news/old-', csc:term(@date), '.html'), ' ', '_')}">
+          href="{translate(concat($g_outdir, 'old-', csc:term(@date), '.html'), ' ', '_')}">
         <html>
           <head>
             <title>News for <xsl:value-of select="csc:term(@date)" /></title>