c3d2-web/Makefile

307 lines
12 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
VFLAGS=--noout --nonet
# VALIDATOR-Flags für Eingabe-XML (meist c3d2web)
VFLAGS_IN=$(VFLAGS) --schema xsd/c3d2web.xsd
# VALIDATOR-Flags für Ausgabe-XML (xhtml, rss, atom, ...)
VFLAGS_OUT=$(VFLAGS)
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:
2010-11-09 23:24:21 +01:00
STYLE=xsl/xhtml5.xsl
DS_STYLE=xsl/datenspuren/xhtml5.xsl
2013-04-18 01:10:26 +02:00
DS_YEAR=2013
# 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.xml
# Calendar summary::
CALENDAR_SUMMARY=calendar-summary.xml
# Datenspuren Fahrplan
2013-08-26 01:15:54 +02:00
DS_SCHEDULE=$(patsubst content/static/datenspuren/$(DS_YEAR)/fahrplan/schedule/%.html, build/datenspuren/$(DS_YEAR)/schedule-%.xml, $(wildcard content/static/datenspuren/$(DS_YEAR)/fahrplan/schedule/?.html))
### 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) $(DS_FEEDS) $(NEWSFILES) 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/pentaradio.xml build/pentacast.xml build/pentamusic.xml build/pentamedia.xml \
build/news-archiv-rss.xml build/news-archiv-atom.xml \
build/podcast-archiv.xml build/pentaradio-archiv.xml build/pentacast-archiv.xml \
build/pentamusic-archiv.xml build/pentamedia-archiv.xml \
build/ical.ics build/xcal.xml build/reminders \
build/datenspuren/$(DS_YEAR)/news-rss.xml build/datenspuren/$(DS_YEAR)/news-atom.xml \
2013-10-29 02:42:40 +01:00
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml \
build/portal.html
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:
2011-10-06 21:39:48 +02:00
DS_PAGES:=$(patsubst content/datenspuren/%.xml, build/datenspuren/$(DS_YEAR)/%.html, $(wildcard content/datenspuren/*.xml))
2012-11-24 00:30:15 +01:00
DS_FEEDS:= \
2013-11-06 00:06:29 +01:00
build/datenspuren/2009/mitschnitte-rss.xml \
2012-11-24 00:30:15 +01:00
build/datenspuren/2010/mitschnitte-rss.xml \
build/datenspuren/2011/mitschnitte-rss.xml \
2013-09-14 00:12:42 +02:00
build/datenspuren/2012/mitschnitte-rss.xml \
build/datenspuren/2013/mitschnitte-rss.xml
# Quellen
NEWSITEMS:=$(wildcard content/news/*.xml)
CLEAN=$(CONTENT) $(NEWSFILES) $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DS_PAGES) $(DS_FEEDS)
NOINPUTVALID:=false
2010-11-09 21:16:13 +01:00
NOVALID:=false
define xml_process
$(NOINPUTVALID) || $(VALIDATOR) $(VFLAGS_IN) $<
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
2010-11-09 21:16:13 +01:00
$(NOVALID) || $(VALIDATOR) $(VFLAGS_OUT) $@ || \
{ 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/ $@
@echo
@echo
@echo 'Great!'
@echo
2010-11-09 23:24:21 +01:00
@echo 'You may now run `make -j3 xhtml5-validate` to make sure everything fits.'
@echo
.PHONY: export
export: www
$(RSYNC) $(RSYNC_FLAGS) --exclude=".git/" www/ $(DESTDIR)/
$(DATESTAMP):
mkdir -p build
rm $(wildcard build/.stamp-*)
touch $@
### Regeln für den XSLT-Prozess ###
2010-11-09 21:16:13 +01:00
build/%.html : NOVALID:=true
build/news.html: $(WWW_CCC_DE_UPDATES) $(CALENDAR_SUMMARY) $(DATESTAMP)
## Feedgrößen begrenzen
build/%.xml : MAX_ITEMS=23
build/%-archiv.xml build/news-archiv-%.xml : MAX_ITEMS=9999999
## Erscheinen regelmäßig, aber guck durch mehr als 23 Items zurück
build/pentaradio.xml build/pentamusic.xml : MAX_ITEMS=100
## Erscheint leider nicht so oft
build/pentacast.xml build/pentacast-ogg.xml : MAX_ITEMS=200
build/pentamedia.xml : MAX_ITEMS=50
build/%.xml : PFLAGS+=--param maxitems $(MAX_ITEMS)
build/news-rss.xml build/news-archiv-rss.xml : STYLE=xsl/rss.xsl
build/news-rss.xml build/news-archiv-rss.xml : PFLAGS+=--stringparam prefix ""
build/news-rss.xml build/news-archiv-rss.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
2013-04-01 19:53:22 +02:00
build/news-rss.xml : PFLAGS+=--stringparam archivefeed news-archiv-rss.xml
build/news-atom.xml build/news-archiv-atom.xml : STYLE=xsl/atom.xsl
build/news-atom.xml build/news-archiv-atom.xml : PFLAGS+=--stringparam prefix ""
build/news-atom.xml build/news-archiv-atom.xml : VFLAGS_OUT=$(VFLAGS) --relaxng xsd/atom.rng
2013-04-01 19:53:22 +02:00
build/news-atom.xml : PFLAGS+=--stringparam archivefeed news-archiv-atom.xml
build/podcast.xml build/podcast-archiv.xml : STYLE=xsl/podcast.xsl
build/podcast.xml build/podcast-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
build/podcast.xml build/podcast-archiv.xml : PFLAGS+=--stringparam format audio/mpeg,video/mp4
build/podcast.xml build/podcast-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
2013-04-01 19:53:22 +02:00
build/podcast.xml : PFLAGS+=--stringparam archivefeed podcast-archiv.xml
build/pentaradio.xml build/pentaradio-archiv.xml : STYLE=xsl/podcast.xsl
build/pentaradio.xml build/pentaradio-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
build/pentaradio.xml build/pentaradio-archiv.xml : PFLAGS+=--stringparam selection pentaradio --stringparam format audio/mpeg,video/mp4
build/pentaradio.xml build/pentaradio-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
2013-04-01 19:53:22 +02:00
build/pentaradio.xml : PFLAGS+=--stringparam archivefeed pentaradio-archiv.xml
build/pentacast.xml build/pentacast-archiv.xml : STYLE=xsl/podcast.xsl
build/pentacast.xml build/pentacast-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
build/pentacast.xml build/pentacast-archiv.xml : PFLAGS+=--stringparam selection pentacast --stringparam format audio/mpeg,video/mp4
build/pentacast.xml build/pentacast-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
2013-04-01 19:53:22 +02:00
build/pentacast.xml : PFLAGS+=--stringparam archivefeed pentacast-archiv.xml
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml : STYLE=xsl/podcast.xsl
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml : PFLAGS+=--stringparam selection pentacast --stringparam format audio/ogg,video/ogg,application/ogg,video/webm
build/pentacast-ogg.xml build/pentacast-ogg-archiv.xml : xsl/podcast.xsl # Does not work with $(STYLE) - why?
2013-04-01 19:53:22 +02:00
build/pentacast-ogg.xml : PFLAGS+=--stringparam archivefeed pentacast-ogg-archiv.xml
build/pentamusic.xml build/pentamusic-archiv.xml : STYLE=xsl/podcast.xsl
build/pentamusic.xml build/pentamusic-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
build/pentamusic.xml build/pentamusic-archiv.xml : PFLAGS+=--stringparam selection pentamusic --stringparam format audio/mpeg,video/mp4
build/pentamusic.xml build/pentamusic-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
2013-04-01 19:53:22 +02:00
build/pentamusic.xml : PFLAGS+=--stringparam archivefeed pentamusic-archiv.xml
build/pentamedia.xml build/pentamedia-archiv.xml : STYLE=xsl/podcast.xsl
build/pentamedia.xml build/pentamedia-archiv.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
build/pentamedia.xml build/pentamedia-archiv.xml : PFLAGS+=--stringparam selection pentamedia --stringparam format audio/mpeg,video/mp4
build/pentamedia.xml build/pentamedia-archiv.xml: xsl/podcast.xsl # Does not work with $(STYLE) - why?
2013-04-01 19:53:22 +02:00
build/pentamedia.xml : PFLAGS+=--stringparam archivefeed pentamedia-archiv.xml
#.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
2010-11-09 21:16:13 +01:00
$(CALENDAR_SUMMARY) : NOVALID:=true
$(CALENDAR_SUMMARY) : VFLAGS_IN=$(VFLAGS)
$(CALENDAR_SUMMARY): content/events.xml news.xml
$(call xml_process)
build/calendar.html : VFLAGS_IN=$(VFLAGS)
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=$(VFLAGS)
build/xcal.xml: $(CALENDAR_SUMMARY) $(STYLE)
$(call xml_process)
# iCal
build/ical.ics : STYLE=xsl/ical.xsl
2010-11-09 21:16:13 +01:00
build/ical.ics : NOVALID:=true
build/ical.ics : VFLAGS_IN=$(VFLAGS)
build/ical.ics : VFLAGS_OUT=$(VFLAGS)
build/ical.ics: $(CALENDAR_SUMMARY) $(STYLE)
$(call xml_process)
# Remind
build/reminders : STYLE=xsl/remind.xsl
2010-11-09 21:16:13 +01:00
build/reminders : NOVALID:=true
build/reminders : VFLAGS_IN=$(VFLAGS)
build/reminders : VFLAGS_OUT=$(VFLAGS)
build/reminders: $(CALENDAR_SUMMARY) $(STYLE)
$(call xml_process)
# Playlists
build/%.xspf : VFLAGS_OUT=$(VFLAGS) --relaxng xsd/xspf-1_0.5.rng
2010-11-09 21:16:13 +01:00
build/%.m3u : NOVALID:=true
build/%.pls : NOVALID:=true
2013-10-29 02:42:40 +01:00
# Portal
portal:
mkdir $@
2013-11-13 23:32:49 +01:00
portal/Makefile : STYLE=xsl/portal2fetch.xsl
portal/Makefile : NOINPUTVALID:=true
portal/Makefile : NOVALID:=true
portal/Makefile: content/portal-config.xml $(STYLE)
$(call xml_process)
2013-10-29 02:42:40 +01:00
portal/items.xml : STYLE=xsl/portal2items.xsl
portal/items.xml : NOINPUTVALID:=true
2013-10-29 02:42:40 +01:00
portal/items.xml : NOVALID:=true
2013-11-13 23:32:49 +01:00
portal/items.xml: content/portal-config.xml $(STYLE) portal/Makefile news.xml
$(MAKE) -C portal fetch
$(call xml_process)
portal/items-sorted.xml : STYLE=xsl/portal-sort.xsl
portal/items-sorted.xml: portal/items.xml $(STYLE)
$(call xml_process)
build/portal.html : NOINPUTVALID:=true
build/portal.html: portal/items-sorted.xml $(STYLE) $(CALENDAR_SUMMARY)
$(call xml_process)
2013-10-29 02:42:40 +01:00
# Pages:
build/%.html: content/pages/%.xml $(STYLE) $(NAVIGATION) $(DATESTAMP) news.xml
$(call xml_process)
# News:
build/news/%.html : BASEURL="../"
build/news/%.html: content/news/%.xml $(STYLE) $(NAVIGATION) $(DATESTAMP)
$(call xml_process)
2013-08-26 01:15:54 +02:00
# Datenspuren
build/datenspuren/$(DS_YEAR)/schedule-%.xml : VFLAGS_IN=$(VFLAGS) --html
build/datenspuren/$(DS_YEAR)/schedule-%.xml : PFLAGS+=--html
build/datenspuren/$(DS_YEAR)/schedule-%.xml : STYLE=xsl/datenspuren/frab2xml.xsl
build/datenspuren/$(DS_YEAR)/schedule-%.xml: content/static/datenspuren/$(DS_YEAR)/fahrplan/schedule/%.html $(STYLE)
$(call xml_process)
2011-10-06 21:39:48 +02:00
build/datenspuren/$(DS_YEAR)/%html : STYLE=$(DS_STYLE)
build/datenspuren/$(DS_YEAR)/%.html: content/datenspuren/%.xml $(DS_STYLE) news.xml $(DS_SCHEDULE)
$(call xml_process)
2011-10-06 21:39:48 +02:00
build/datenspuren/$(DS_YEAR)/news-rss.xml : STYLE=xsl/rss.xsl
build/datenspuren/$(DS_YEAR)/news-rss.xml : NOVALID:=true
2013-04-18 01:10:26 +02:00
build/datenspuren/$(DS_YEAR)/news-rss.xml : PFLAGS+=--stringparam prefix ds13-
2011-10-06 21:39:48 +02:00
build/datenspuren/$(DS_YEAR)/news-rss.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
build/datenspuren/$(DS_YEAR)/news-atom.xml : STYLE=xsl/atom.xsl
build/datenspuren/$(DS_YEAR)/news-atom.xml : NOVALID:=true
2013-04-18 01:10:26 +02:00
build/datenspuren/$(DS_YEAR)/news-atom.xml : PFLAGS+=--stringparam prefix ds13-
2011-10-06 21:39:48 +02:00
build/datenspuren/$(DS_YEAR)/news-atom.xml : VFLAGS_OUT=$(VFLAGS) --relaxng xsd/atom.rng
build/datenspuren/%/mitschnitte-rss.xml : STYLE=xsl/newsfile-to-podcast.xsl
build/datenspuren/%/mitschnitte-rss.xml : VFLAGS_OUT=$(VFLAGS) --schema xsd/rss20.xsd
2013-11-06 00:06:29 +01:00
build/datenspuren/2009/mitschnitte-rss.xml: content/news/ds09-videomitschnitte.xml $(STYLE)
$(call xml_process)
build/datenspuren/2010/mitschnitte-rss.xml: content/news/ds10-videomitschnitte-komplett.xml $(STYLE)
$(call xml_process)
build/datenspuren/2011/mitschnitte-rss.xml: content/news/ds11-mitschnitte-online.xml $(STYLE)
$(call xml_process)
2012-11-24 00:30:15 +01:00
build/datenspuren/2012/mitschnitte-rss.xml: content/news/ds12-videomitschnitte-komplett.xml $(STYLE)
$(call xml_process)
build/datenspuren/2013/mitschnitte-rss.xml: content/news/ds13-videomitschnitte-komplett.xml $(STYLE)
2013-09-14 00:12:42 +02:00
$(call xml_process)
2010-11-09 23:24:21 +01:00
xhtml5-validate: $(patsubst build/%.html, build/%.html.xhtml5-validate, $(CONTENT))
build/%.html.xhtml5-validate: build/%.html
2010-11-09 22:15:46 +01:00
./scripts/validate_xhtml5.sh $<
### Die neuesten Chaosupdates holen ###
$(WWW_CCC_DE_UPDATES).orig: $(DATESTAMP)
rm $@
$(WGET) -O $@ -4 http://www.ccc.de/de/rss/updates.rdf
$(WWW_CCC_DE_UPDATES): $(WWW_CCC_DE_UPDATES).orig
$(VALIDATOR) --recover $< > $@
### Mr. Propper ###
.PHONY: clean
clean:
rm $(CLEAN) news.xml
rm -r portal