|
|
|
### Programme ###
|
|
|
|
# XSLT-Prozessor:
|
|
|
|
PROCESSOR=xsltproc
|
|
|
|
PFLAGS=
|
|
|
|
# XML-Validator
|
|
|
|
VALIDATOR=xmllint
|
|
|
|
VFLAGS=--noout --valid
|
|
|
|
# Downloadmanager (Alternativ: curl, fetch):
|
|
|
|
WGET=wget --timestamping
|
|
|
|
# rsync
|
|
|
|
RSYNC=rsync
|
|
|
|
RSYNC_FLAGS=--verbose --recursive --delete --delete-after --delete-excluded --checksum
|
|
|
|
# Editor
|
|
|
|
EDITOR?=vim
|
|
|
|
# Browser
|
|
|
|
BROWSER?=links
|
|
|
|
|
|
|
|
# Verzeichnis, in das exportiert werden soll
|
|
|
|
DESTDIR?=www-export
|
|
|
|
|
|
|
|
### Ressourcen ###
|
|
|
|
# XSLT-Stylesheets:
|
|
|
|
STYLE=xsl/xhtml.xsl
|
|
|
|
STYLE_RSS=xsl/rss.xsl
|
|
|
|
# Navigationsleiste:
|
|
|
|
NAVIGATION=content/navigation.xml
|
|
|
|
# XML-Skeletons
|
|
|
|
SKELETONS:=$(wildcard content/skel-*.xml)
|
|
|
|
SKEL:=empty
|
|
|
|
# Zu verwendendes Skeleton
|
|
|
|
SKELFILE=content/skel-$(SKEL).xml
|
|
|
|
# Dateinamen der Inhalte:
|
|
|
|
CONTENT=$(PAGES) www/news.html www/news-rss.xml
|
|
|
|
PAGES:=$(patsubst content/%.xml, www/%.html, $(filter-out $(NAVIGATION) $(SKELETONS), $(wildcard content/*.xml)))
|
|
|
|
NEWSITEMS:=$(wildcard content/news/*.xml)
|
|
|
|
DTD:=$(wildcard dtd/*.dtd)
|
|
|
|
CLEAN=$(CONTENT) www/news.html www/news-rss.xml
|
|
|
|
|
|
|
|
### Defaults ###
|
|
|
|
.PHONY: export contents clean mrproper all install check
|
|
|
|
.PRECIOUS: content/%.xml www/%.html
|
|
|
|
.SILENT: check
|
|
|
|
|
|
|
|
all: contents
|
|
|
|
|
|
|
|
install: export
|
|
|
|
|
|
|
|
contents: $(CONTENT)
|
|
|
|
|
|
|
|
export: contents
|
|
|
|
$(RSYNC) $(RSYNC_FLAGS) --exclude=".svn/" www/ $(DESTDIR)/
|
|
|
|
|
|
|
|
check: $(PAGES)
|
|
|
|
ln -sfn ../dtd www/DTD
|
|
|
|
for page in $(PAGES) ; do \
|
|
|
|
echo "Checking $${page}..." ; \
|
|
|
|
$(VALIDATOR) $(VFLAGS) $${page} ; \
|
|
|
|
done
|
|
|
|
rm -f www/DTD
|
|
|
|
|
|
|
|
### Regeln für den XSLT-Prozess ###
|
|
|
|
www/news.html: $(STYLE)
|
|
|
|
www/news-rss.xml: $(STYLE_RSS)
|
|
|
|
|
|
|
|
www/news.html www/news-rss.xml: $(NEWSITEMS) $(NAVIGATION)
|
|
|
|
for item in $(NEWSITEMS) ; do \
|
|
|
|
$(VALIDATOR) $(VFLAGS) $${item} || exit 1 ; \
|
|
|
|
done
|
|
|
|
|
|
|
|
{ echo '<?xml version="1.0" encoding="UTF-8"?>' ; \
|
|
|
|
echo "<page>"; \
|
|
|
|
echo " <news>"; \
|
|
|
|
for item in $(NEWSITEMS) ; do \
|
|
|
|
echo " <newsfile>$${item}</newsfile>"; \
|
|
|
|
done; \
|
|
|
|
echo " </news>"; \
|
|
|
|
echo "</page>"; } | \
|
|
|
|
$(PROCESSOR) $(PFLAGS) -o $@ $(filter-out $(NEWSITEMS) $(NAVIGATION),$^) -
|
|
|
|
|
|
|
|
www/%.html: content/%.xml $(STYLE) $(NAVIGATION) chaosupdates.rdf
|
|
|
|
$(VALIDATOR) $(VFLAGS) $<
|
|
|
|
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
|
|
|
|
|
|
|
|
### Hilfsregeln zum Editieren ###
|
|
|
|
edit/%:
|
|
|
|
@if [ ! -e content/$(@F).xml ] ; then \
|
|
|
|
cp $(SKELFILE) content/$(@F).xml ;\
|
|
|
|
fi
|
|
|
|
|
|
|
|
@$(EDITOR) content/$(@F).xml
|
|
|
|
|
|
|
|
@if diff -q $(SKELFILE) content/$(@F).xml >/dev/null ; then \
|
|
|
|
echo "Warning: content/$(@F).xml does not differ from the skeleton $(SKELFILE)" ;\
|
|
|
|
rm -i content/$(@F).xml ;\
|
|
|
|
fi
|
|
|
|
|
|
|
|
view/%: www/%.html
|
|
|
|
@$(BROWSER) $<
|
|
|
|
|
|
|
|
content/%.xml:
|
|
|
|
$(MAKE) edit/$(patsubst content/%.xml,%,$@)
|
|
|
|
|
|
|
|
### Die neuesten Chaosupdates holen ###
|
|
|
|
chaosupdates.rdf:
|
|
|
|
$(WGET) http://www.ccc.de/updates/chaosupdates.rdf || \
|
|
|
|
cp chaosupdates-2006-01-02.rdf $@
|
|
|
|
|
|
|
|
### Mr. Propper ###
|
|
|
|
clean:
|
|
|
|
rm -f $(CLEAN)
|
|
|
|
rm -rf www/dtd
|
|
|
|
|
|
|
|
mrproper: clean
|
|
|
|
rm -f chaosupdates.rdf
|
|
|
|
rm -f $(XHTML_DTD_FILES)
|
|
|
|
rm -rf www-export
|