|
|
|
### Programme ###
|
|
|
|
# XSLT-Prozessor:
|
|
|
|
PROCESSOR=xsltproc
|
|
|
|
# Downloadmanager (Alternativ: curl, fetch):
|
|
|
|
WGET=wget
|
|
|
|
# Editor
|
|
|
|
EDITOR?=vim
|
|
|
|
# Browser
|
|
|
|
BROWSER?=links
|
|
|
|
|
|
|
|
### 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)
|
|
|
|
CLEAN:=$(CONTENT) www/news.html www/news-rss.xml chaosupdates.rdf
|
|
|
|
|
|
|
|
### Defaults ###
|
|
|
|
.PHONY: contents clean
|
|
|
|
.DEFAULT: contents
|
|
|
|
.PRECIOUS: content/%.xml www/%.html
|
|
|
|
|
|
|
|
contents: $(CONTENT)
|
|
|
|
|
|
|
|
### 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)
|
|
|
|
{ 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) -o $@ $(filter-out $(NEWSITEMS) $(NAVIGATION),$^) -
|
|
|
|
|
|
|
|
www/%.html: content/%.xml $(STYLE) $(NAVIGATION) chaosupdates.rdf
|
|
|
|
$(PROCESSOR) -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
|
|
|
|
|
|
|
|
|
|
|
|
### Mr. Propper ###
|
|
|
|
clean:
|
|
|
|
rm -f $(CLEAN)
|