85 lines
2.9 KiB
Makefile
85 lines
2.9 KiB
Makefile
|
|
PROCESSOR=xsltproc
|
|
PFLAGS=--novalid
|
|
# The root directory of every transformation
|
|
# used in the following makefile
|
|
TRANSFORMATION_ROOT=transformation
|
|
|
|
# TODO: Define a transformation procedure for each transformation
|
|
# within $(TRANSFORMATION_ROOT) and its subdirectories.
|
|
|
|
HTML_OUTPUT=output/html
|
|
PAGE_OUTPUT=output/page
|
|
NEWS_OUTPUT=output/news
|
|
|
|
#
|
|
# C3D2-specific configuration
|
|
#
|
|
TITLE_PREFIX="C3D2 Blub"
|
|
BASEURL=""
|
|
|
|
#
|
|
# Predefined functions
|
|
#
|
|
|
|
# news2page (target, pathinclude) where
|
|
# "target" - the path of the xml file to be transformed
|
|
# "pathinclude" - additional paths (separated by whitespace) for inclusion of news items
|
|
news2page = $(PROCESSOR) $(PFLAGS) --path "$(NEWS_OUTPUT) $(2)" $(TRANSFORMATION_ROOT)/news2page/news.xsl $(1)
|
|
|
|
# page2html (target, pathincluce) where
|
|
# "target" - the path of the xml file to be transformed
|
|
# "pathinclude" - additional paths (separated by whitespace) for inclusion of news items
|
|
page2html = $(PROCESSOR) $(PFLAGS) --path "$(PAGE_OUTPUT) $(TRANSFORMATION_ROOT)/page2html $(2)" --stringparam baseurl $(BASEURL) --stringparam common_title_prefix $(TITLE_PREFIX) $(TRANSFORMATION_ROOT)/page2html/page2html.xsl $(1)
|
|
|
|
all: prepare_output $(HTML_OUTPUT)/news.html $(HTML_OUTPUT)/unterstuetzen.html $(HTML_OUTPUT)/schule.html
|
|
|
|
prepare_output:
|
|
mkdir -p $(HTML_OUTPUT) $(PAGE_OUTPUT) $(NEWS_OUTPUT)
|
|
cp -rf content/c3d2/static/* $(HTML_OUTPUT)
|
|
|
|
#
|
|
# Static pages
|
|
#
|
|
|
|
$(HTML_OUTPUT)/schule.html:
|
|
$(call page2html, content/c3d2/pages/schule.xml , content/c3d2 content/c3d2/pages) > $(HTML_OUTPUT)/schule.html
|
|
|
|
$(HTML_OUTPUT)/unterstuetzen.html:
|
|
$(call page2html, content/c3d2/pages/unterstuetzen.xml , content/c3d2 content/c3d2/pages) > $(HTML_OUTPUT)/unterstuetzen.html
|
|
|
|
|
|
#
|
|
# NEWS
|
|
#
|
|
|
|
ITEMS_DIR=content/c3d2/items
|
|
NEWS_ITEMS:=$(patsubst $(ITEMS_DIR)/%.xml, $(HTML_OUTPUT)/%.html, $(wildcard $(ITEMS_DIR)/*.xml))
|
|
|
|
# Points to a script or executable, which takes
|
|
# the directory containing the newsitems in xml-format
|
|
# as parameter and passes a corresponding list in xml-format
|
|
# to STDOUT
|
|
LIST_GENERATOR=scripts/generate-news-list.sh
|
|
|
|
# Transform all news files
|
|
$(NEWS_ITEMS):
|
|
$(call news2page, $(ITEMS_DIR)/$*.xml) > $(HTML_OUTPUT)/$@.html
|
|
|
|
# Generate a list of all news items
|
|
# stored within $(ITEMS_DIR).
|
|
$(NEWS_OUTPUT)/news-list.xml: $(NEWS_ITEMS)
|
|
$(LIST_GENERATOR) $(ITEMS_DIR) > $(NEWS_OUTPUT)/news-list.xml
|
|
|
|
# Transform the news.xml-file into a page
|
|
# TODO: Replace PROCESSOR-call with a predefined procedure for news2page-transformation.
|
|
$(PAGE_OUTPUT)/news.xml: $(NEWS_OUTPUT)/news-list.xml
|
|
$(call news2page, content/c3d2/news/overview.xml, content/c3d2/items) > $(PAGE_OUTPUT)/news.xml
|
|
|
|
# Transform the news page into HTML
|
|
$(HTML_OUTPUT)/news.html: $(PAGE_OUTPUT)/news.xml
|
|
$(call page2html, output/page/news.xml , $(PAGE_OUTPUT) content/c3d2 content/c3d2/pages) > $(HTML_OUTPUT)/news.html
|
|
|
|
clean:
|
|
rm -rf $(NEWS_OUTPUT)/* $(PAGE_OUTPUT)/* $(HTML_OUTPUT)/*
|