|
|
|
### 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
|
|
|
|
DS_STYLE=xsl/datenspuren/xhtml.xsl
|
|
|
|
STYLE_RSS=xsl/rss.xsl
|
|
|
|
STYLE_ATOM=xsl/atom.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) $(DS_PAGES) $(NEWSFILES)
|
|
|
|
# Chaosupdates
|
|
|
|
WWW_CCC_DE_UPDATES=chaosupdates.rdf
|
|
|
|
|
|
|
|
PAGES:=$(patsubst content/%.xml, www/%.html, $(filter-out $(NAVIGATION) $(SKELETONS), $(wildcard content/*.xml)))
|
|
|
|
DS_PAGES:=$(patsubst content/datenspuren/%.xml, www/datenspuren/%.html, $(wildcard content/datenspuren/*.xml))
|
|
|
|
NEWSINDEX:=content/news.xml
|
|
|
|
NEWSITEMS:=$(filter-out $(NEWSINDEX), $(wildcard content/news/*.xml))
|
|
|
|
NEWSFILES:=www/news.html www/news-rss.xml www/news-atom.xml
|
|
|
|
DTD:=dtd/c3d2web.dtd
|
|
|
|
CLEAN=$(CONTENT) $(NEWSFILES) $(WWW_CCC_DE_UPDATES)
|
|
|
|
|
|
|
|
### Defaults ###
|
|
|
|
.PHONY: export contents clean mrproper all install check mirrorcontent
|
|
|
|
.PRECIOUS: content/%.xml www/%.html content/datenspuren/%.xml www/datenspuren/%.html
|
|
|
|
.SILENT: check
|
|
|
|
|
|
|
|
all: contents
|
|
|
|
|
|
|
|
install: export
|
|
|
|
|
|
|
|
contents: $(CONTENT) $(DTD)
|
|
|
|
|
|
|
|
export: contents
|
|
|
|
$(RSYNC) $(RSYNC_FLAGS) --exclude=".svn/" www/ $(WWW_CCC_DE_UPDATES) content dtd xsl $(DESTDIR)/
|
|
|
|
|
|
|
|
|
|
|
|
check: $(PAGES)
|
|
|
|
ln -sfn $(PWD)/dtd www/DTD
|
|
|
|
for page in $^ ; 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-atom.xml: $(STYLE_ATOM)
|
|
|
|
|
|
|
|
$(NEWSFILES): $(NAVIGATION) $(NEWSINDEX)
|
|
|
|
$(VALIDATOR) $(VFLAGS) $(NEWSINDEX)
|
|
|
|
$(PROCESSOR) $(PFLAGS) -o $@ $(filter-out $(NEWSITEMS) $(NAVIGATION) $(NEWSINDEX),$^) $(NEWSINDEX)
|
|
|
|
|
|
|
|
$(NEWSINDEX): $(NEWSITEMS) Makefile
|
|
|
|
for item in $(NEWSITEMS) ; do \
|
|
|
|
$(VALIDATOR) $(VFLAGS) $${item} || exit 1 ; \
|
|
|
|
done
|
|
|
|
|
|
|
|
{ echo '<?xml version="1.0" encoding="UTF-8"?>' ; \
|
|
|
|
echo '<!DOCTYPE page SYSTEM "../dtd/c3d2web.dtd">' ; \
|
|
|
|
echo '<?xml-stylesheet type="text/xsl" href="../xsl/html.xsl" ?>' ; \
|
|
|
|
echo "<page title=\"News\">"; \
|
|
|
|
echo " <news>"; \
|
|
|
|
for item in $(patsubst content/news/%,news/%,$(NEWSITEMS)) ; do \
|
|
|
|
echo " <newsfile>$${item}</newsfile>"; \
|
|
|
|
done; \
|
|
|
|
echo " </news>"; \
|
|
|
|
echo "</page>"; } > $@
|
|
|
|
|
|
|
|
www/datenspuren/%.html: content/datenspuren/%.xml $(DS_STYLE)
|
|
|
|
# -- MNE-20060421: Lt. Astro geht Validierung noch nicht mit dem Fahrplan,
|
|
|
|
# daher fuer Datenspuren auskommentiert
|
|
|
|
$(VALIDATOR) $(VFLAGS) $<
|
|
|
|
$(PROCESSOR) $(PFLAGS) -o $@ $(DS_STYLE) $<
|
|
|
|
|
|
|
|
www/%.html: content/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES)
|
|
|
|
$(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 ###
|
|
|
|
$(WWW_CCC_DE_UPDATES):
|
|
|
|
$(WGET) http://www.ccc.de/updates/$(WWW_CCC_DE_UPDATES) || \
|
|
|
|
cp chaosupdates-2006-01-02.rdf $@
|
|
|
|
|
|
|
|
### Mr. Propper ###
|
|
|
|
clean:
|
|
|
|
rm -f $(CLEAN)
|
|
|
|
|
|
|
|
mrproper: clean
|
|
|
|
rm -f $(WWW_CCC_DE_UPDATES)
|
|
|
|
rm -f $(XHTML_DTD_FILES)
|
|
|
|
rm -rf www-export
|