c3d2-web/Makefile

71 lines
1.5 KiB
Makefile
Raw Normal View History

### 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:=$(patsubst content/%.xml, www/%.html, $(filter-out $(NAVIGATION) $(SKELETONS), $(wildcard content/*.xml)))
CLEAN:=$(CONTENT) www/news-rss.xml chaosupdates.rdf
### Defaults ###
.PHONY: contents clean
.DEFAULT: contents
.PRECIOUS: content/%.xml www/%.html
contents: $(CONTENT)
#www/news-rss.xml
### Regeln für den XSLT-Prozess ###
www/%.html: content/%.xml $(STYLE) $(NAVIGATION) chaosupdates.rdf
$(PROCESSOR) -o $@ $(STYLE) $<
www/news-rss.xml: content/news.xml $(STYLE_RSS)
$(PROCESSOR) -o $@ $(STYLE_RSS) $<
### 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)