Files
fsfe-website/Makefile
T

67 lines
2.9 KiB
Makefile
Raw Normal View History

2019-03-07 23:34:10 +01:00
# -----------------------------------------------------------------------------
# Makefile for "premake" step
# -----------------------------------------------------------------------------
# This Makefile creates some .xml and xhtml files which serve as source files
# in the main build run. It is executed in the source directory, before the
# Makefile for the main build run is constructed and executed.
# -----------------------------------------------------------------------------
2017-03-06 17:59:11 +00:00
.PHONY: all .FORCE
.FORCE:
2008-12-08 17:54:36 +00:00
# -----------------------------------------------------------------------------
# Dive into subdirectories
# -----------------------------------------------------------------------------
SUBDIRS := $(shell find */* -name "Makefile" | xargs dirname)
2019-03-10 16:18:02 +01:00
all: $(SUBDIRS)
2017-03-06 17:59:11 +00:00
$(SUBDIRS): .FORCE
$(MAKE) -j -k -C $@ || true
2008-12-08 17:54:36 +00:00
# -----------------------------------------------------------------------------
# Handle local menus
# -----------------------------------------------------------------------------
2019-03-07 23:34:10 +01:00
MENUSOURCES := $(shell find -name '*.xhtml' | xargs grep -l '<localmenu.*</localmenu>' )
2008-12-08 17:54:36 +00:00
2019-03-10 16:18:02 +01:00
all: localmenuinfo.en.xml
2017-03-06 17:59:11 +00:00
localmenuinfo.en.xml: ./tools/buildmenu.xsl $(MENUSOURCES)
{ printf '<localmenuset>'; \
grep -E '<localmenu.*</localmenu>' $^ \
| sed -r 's;(.*/)?(.+)\.([a-z][a-z])\.xhtml:(.+);\
<menuitem language="\3"><dir>/\1</dir><link>\2.html</link>\4</menuitem>;'; \
printf '</localmenuset>'; \
} | xsltproc -o $@ $< -
2008-12-08 17:54:36 +00:00
2017-03-06 17:59:11 +00:00
# -----------------------------------------------------------------------------
# Timestamp files for regular jobs and XML inclusion in various places
# -----------------------------------------------------------------------------
2017-03-06 17:59:11 +00:00
YEAR := <?xml version="1.0" encoding="utf-8"?><dateset><date year="$(shell date +%Y)" /></dateset>
MONTH := <?xml version="1.0" encoding="utf-8"?><dateset><date month="$(shell date +%Y-%m)" /></dateset>
2017-03-06 17:59:11 +00:00
DAY := <?xml version="1.0" encoding="utf-8"?><dateset><date day="$(shell date +%Y-%m-%d)" /></dateset>
2019-03-10 16:18:02 +01:00
all: d_year.en.xml d_month.en.xml d_day.en.xml
2017-03-06 17:59:11 +00:00
d_day.en.xml: $(if $(findstring $(DAY),$(shell cat d_day.en.xml)),,.FORCE)
printf %s\\n '$(DAY)' >$@
d_month.en.xml: $(if $(findstring $(MONTH),$(shell cat d_month.en.xml)),,.FORCE)
printf %s\\n '$(MONTH)' >$@
d_year.en.xml: $(if $(findstring $(YEAR),$(shell cat d_year.en.xml)),,.FORCE)
printf %s\\n '$(YEAR)' >$@
2017-03-06 17:59:11 +00:00
# -----------------------------------------------------------------------------
# Generate XML filelists
2017-03-06 17:59:11 +00:00
# -----------------------------------------------------------------------------
2017-02-16 16:18:57 +00:00
# Generation of XML filelists is handled in an external script which generates
# all .xmllist and the tags/tagged-*.en.xhtml files. These files cannot be
# targets in this Makefile, because the list of tags is not known when the
# Makefile starts - some new tags might be created when generating the .xml
# files in the news/* subdirectories.
2017-03-06 17:59:11 +00:00
.PHONY: xmllists
all: xmllists
xmllists: $(SUBDIRS)
@build/make_xmllists.sh