c3d2-web/Makefile

199 lines
6.6 KiB
Makefile
Raw Normal View History

# eingebaute Variablen und Regeln werden nicht gebraucht
MAKEFLAGS += -rR
### Programme ###
# XSLT-Prozessor:
PROCESSOR=xsltproc
PFLAGS=--novalid --catalogs --stringparam baseurl $(BASEURL)
BASEURL=""
# XML-Validator
VALIDATOR=xmllint
# VALIDATOR-Flags für Eingabe-XML (meist c3d2web)
VFLAGS_IN=--noout --schema xsd/c3d2web.xsd
# VALIDATOR-Flags für Ausgabe-XML (xhtml, rss, atom, ...)
VFLAGS_OUT=$(VFLAGS_IN)
SGML_CATALOG_FILES=$(XML_CATALOG)
export SGML_CATALOG_FILES
# Downloadmanager (Alternativ: curl, fetch):
WGET=wget
# rsync
RSYNC=rsync
RSYNC_FLAGS=--verbose --recursive --delete --delete-after --delete-excluded --checksum --chmod=ugo=rX
# 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
# Document-Type-Definition:
DTD:=dtd/c3d2web.dtd
# XML-Katalog (Pfad zu den DTDs) - wird benötigt vom Validator
XML_CATALOG:=dtd/catalog.xml
# Navigationsleiste:
NAVIGATION=content/navigation.xml
# Chaosupdates:
WWW_CCC_DE_UPDATES=chaosupdates.rdf
# Calendar summary::
CALENDAR_SUMMARY=calendar-summary.xml
### Ziele ###
# Mindestens 1x täglich neubauen wegen Chaosupdates & Kalender
DATESTAMP=build/.stamp-$(shell date +%Y-%m-%d)
# Dateinamen der zu erzeugenden html-Dateien:
CONTENT=$(PAGES) $(NEWS_PAGES) $(DS_PAGES) $(NEWSFILES) $(SEARCH_TMPL) build/calendar.html
# 'normale' Seiten:
PAGES:=$(patsubst content/pages/%.xml, build/%.html, $(wildcard content/pages/*.xml))
# Seiten zu einzelnen News-Items:
NEWS_PAGES:=$(patsubst content/news/%.xml, build/news/%.html, $(wildcard content/news/*.xml))
# News-Index und Feeds:
NEWSFILES:=build/news.html build/news-rss.xml build/news-atom.xml build/podcast.xml \
build/ical.ics build/xcal.xml build/reminders build/datenspuren/news-rss.xml build/datenspuren/news-atom.xml
PLAYLISTS:=$(patsubst content/news/pentaradio%.xml, build/news/pentaradio%.xspf, $(wildcard content/news/pentaradio*.xml)) \
$(patsubst content/news/pentaradio%.xml, build/news/pentaradio%.pls, $(wildcard content/news/pentaradio*.xml)) \
$(patsubst content/news/pentaradio%.xml, build/news/pentaradio%.m3u, $(wildcard content/news/pentaradio*.xml))
# Datenspuren-Seiten:
DS_PAGES:=$(patsubst content/datenspuren/%.xml, build/datenspuren/%.html, $(wildcard content/datenspuren/*.xml))
# Suchseiten-Template
SEARCH_TMPL:=build/cgi-bin/search.html
# Quellen
NEWSITEMS:=$(wildcard content/news/*.xml)
CLEAN=$(CONTENT) $(NEWSFILES) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DS_PAGES)
NOVALID_IGNORE:=false
define xml_process
$(VALIDATOR) $(VFLAGS_IN) $<
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
$(VALIDATOR) $(VFLAGS_OUT) $@ || $(NOVALID_IGNORE) || \
{ touch -m -t 197001010000 Makefile $@ ; exit 1 ; }
endef
### Defaults ###
.PHONY: www
www: $(XML_CATALOG) $(CONTENT)
$(RSYNC) $(RSYNC_FLAGS) --exclude=".stamp-*" content/static/ content/old-site/ build/ $@
.PHONY: export
export: www
$(RSYNC) $(RSYNC_FLAGS) --exclude=".svn/" www/ $(DESTDIR)/
$(DATESTAMP):
$(RM) $(wildcard build/.stamp-*)
touch $@
### Regeln für den XSLT-Prozess ###
build/%.html : VFLAGS_OUT=--noout --schema xsd/xhtml1-strict.xsd
build/news.html: $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DATESTAMP)
build/news-rss.xml : STYLE=xsl/rss.xsl
build/news-rss.xml : NOVALID_IGNORE:=true
build/news-rss.xml : PFLAGS+=--stringparam prefix ""
build/news-rss.xml : VFLAGS_OUT=--noout --schema xsd/rss20.xsd
build/news-atom.xml : STYLE=xsl/atom.xsl
build/news-atom.xml : NOVALID_IGNORE:=true
build/news-atom.xml : PFLAGS+=--stringparam prefix ""
build/news-atom.xml : VFLAGS_OUT=--noout --relaxng xsd/atom.rng
build/podcast.xml : STYLE=xsl/podcast.xsl
build/podcast.xml : NOVALID_IGNORE:=true
build/podcast.xml : VFLAGS_OUT=--noout --schema xsd/rss20.xsd
build/podcast.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
#.INTERMEDIATE: news.xml
news.xml: $(NEWSITEMS)
sh scripts/gen_news.xml.sh $^ > $@
$(NEWSFILES): news.xml $(NAVIGATION) $(STYLE)
$(call xml_process)
# Calendar
$(CALENDAR_SUMMARY) : STYLE=xsl/calendar-summary.xsl
$(CALENDAR_SUMMARY) : NOVALID_IGNORE:=true
$(CALENDAR_SUMMARY) : VFLAGS_IN=--noout
$(CALENDAR_SUMMARY): content/events.xml news.xml
$(call xml_process)
build/calendar.html : VFLAGS_IN=--noout
build/calendar.html: $(CALENDAR_SUMMARY) $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) $(DATESTAMP)
$(call xml_process)
# XCal
build/xcal.xml : STYLE=xsl/xcal.xsl
build/xcal.xml : VFLAGS_IN=--noout
build/xcal.xml: $(CALENDAR_SUMMARY) $(STYLE)
$(call xml_process)
# iCal
build/ical.ics : STYLE=xsl/ical.xsl
build/ical.ics : NOVALID_IGNORE:=true
build/ical.ics : VFLAGS_IN=--noout
build/ical.ics : VFLAGS_OUT=--noout
build/ical.ics: $(CALENDAR_SUMMARY) $(STYLE)
$(call xml_process)
# Remind
build/reminders : STYLE=xsl/remind.xsl
build/reminders : NOVALID_IGNORE:=true
build/reminders : VFLAGS_IN=--noout
build/reminders : VFLAGS_OUT=--noout
build/reminders: $(CALENDAR_SUMMARY) $(STYLE)
$(call xml_process)
# Playlists
build/%.xspf : VFLAGS_OUT=--noout --relaxng xsd/xspf-1_0.5.rng
build/%.m3u : NOVALID_IGNORE:=true
build/%.pls : NOVALID_IGNORE:=true
# Pages:
build/%.html: content/pages/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DATESTAMP) news.xml
$(call xml_process)
# News:
build/news/%.html : BASEURL="../"
build/news/%.html: content/news/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DATESTAMP)
$(call xml_process)
# Suche:
build/cgi-bin/search.html : BASEURL="../"
build/cgi-bin/search.html: content/cgi-bin/search.xml $(STYLE) $(NAVIGATION) $(DATESTAMP)
$(call xml_process)
build/datenspuren/%html : STYLE=$(DS_STYLE)
build/datenspuren/%.html: content/datenspuren/%.xml $(DS_STYLE)
$(call xml_process)
build/datenspuren/schedule.html : VFLAGS_IN=--noout --schema xsd/xhtml1-strict.xsd
build/datenspuren/schedule.html : NOVALID_IGNORE:=true
#content/datenspuren/schedule.xml: content/static/datenspuren/fahrplan/days.de.html
# cp $< $@
build/datenspuren/news-rss.xml : STYLE=xsl/rss.xsl
build/datenspuren/news-rss.xml : NOVALID_IGNORE:=true
build/datenspuren/news-rss.xml : PFLAGS+=--stringparam prefix ds08-
build/datenspuren/news-rss.xml : VFLAGS_OUT=--noout --schema xsd/rss20.xsd
build/datenspuren/news-atom.xml : STYLE=xsl/atom.xsl
build/datenspuren/news-atom.xml : NOVALID_IGNORE:=true
build/datenspuren/news-atom.xml : PFLAGS+=--stringparam prefix ds08-
build/datenspuren/news-atom.xml : VFLAGS_OUT=--noout --relaxng xsd/atom.rng
### Die neuesten Chaosupdates holen ###
$(WWW_CCC_DE_UPDATES): $(DATESTAMP)
$(RM) $@
$(WGET) -O $@ http://www.ccc.de/updates/$(WWW_CCC_DE_UPDATES) || \
cp chaosupdates-2006-01-02.rdf $@
### Mr. Propper ###
.PHONY: clean
clean:
$(RM) $(CLEAN) news.xml