old-website/Makefile

38 lines
1.8 KiB
Makefile

INPUTS = index.xml footer.xml
SUBDIRS = about events docs office news users clubs media
# the following two rules are there so cow gets built first.
cow-first: noroot events.ics recurse-cow books.xml members.xml menu.xml all
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
recurse-cow:
cd cow && $(MAKE) && cd ..
members.xml:
echo '<?xml version='\''1.0'\''?>' > $@
echo '<memberlist>' >> $@
ceoquery memberlist | awk -F \| '{ id = $$1; name = $$2; program = $$3; gsub(/&/, "\\&amp;", name); gsub(/&/, "\\&amp;", program); gsub(/"/, "\\&quot;", name); gsub(/"/, "\\&quot;", program); print "<member id=\"" id "\" name=\"" name "\" program=\"" program "\" />"; }' >> $@
echo '</memberlist>' >> $@
books.xml:
echo '<?xml version='\''1.0'\'' encoding="ISO-8859-1"?>' > $@
echo '<booklist>' >> $@
ceoquery booklist | awk -F \| '{ isbn = $$1; title = $$2; author = $$3; edition = $$4; published = $$5; gsub(/&/, "\\&amp;", title); gsub(/&/, "\\&amp;", author); gsub(/&/, "\\&amp;", published); gsub(/&/, "\\&amp;", edition); gsub(/"/, "\\&quot;", title); gsub(/"/, "\\&quot;", author); gsub(/"/, "\\&quot;", published); gsub(/"/, "\\&quot;", edition); print "<book isbn=\"" isbn "\" title=\"" title "\" author=\"" author "\" edition=\"" edition "\" published=\"" published "\"/>"; }' >> $@
echo '</booklist>' >> $@
events.ics:
perl scripts/xml2ics.pl events.xml > events.ics
include default.mk
default.mk: default.mk.in
echo 'ROOT = '`pwd` > $@
cat $< >> $@
.PHONY: members.xml books.xml