Slightly change makefile layout
All checks were successful
the build was successful

This commit is contained in:
Reinhard Müller 2019-03-10 16:18:02 +01:00
parent 9537759d6a
commit 26b6286b1d

View File

@ -13,7 +13,6 @@
.PHONY: all .FORCE
.FORCE:
all:
# -----------------------------------------------------------------------------
# Dive into subdirectories
@ -21,17 +20,17 @@ all:
SUBDIRS := $(shell find */* -name "Makefile" | xargs dirname)
all: $(SUBDIRS)
$(SUBDIRS): .FORCE
$(MAKE) -j -k -C $@ || true
all: $(SUBDIRS)
# -----------------------------------------------------------------------------
# Handle local menus
# -----------------------------------------------------------------------------
MENUSOURCES := $(shell find -name '*.xhtml' | xargs grep -l '<localmenu.*</localmenu>' )
all: localmenuinfo.en.xml
localmenuinfo.en.xml: ./tools/buildmenu.xsl $(MENUSOURCES)
{ printf '<localmenuset>'; \
grep -E '<localmenu.*</localmenu>' $^ \
@ -40,8 +39,6 @@ localmenuinfo.en.xml: ./tools/buildmenu.xsl $(MENUSOURCES)
printf '</localmenuset>'; \
} | xsltproc -o $@ $< -
all: localmenuinfo.en.xml
# -----------------------------------------------------------------------------
# Timestamp files for regular jobs and XML inclusion in various places
# -----------------------------------------------------------------------------
@ -50,6 +47,7 @@ YEAR := <?xml version="1.0" encoding="utf-8"?><dateset><date year="$(shell date
MONTH := <?xml version="1.0" encoding="utf-8"?><dateset><date month="$(shell date +%Y-%m)" /></dateset>
DAY := <?xml version="1.0" encoding="utf-8"?><dateset><date day="$(shell date +%Y-%m-%d)" /></dateset>
all: d_year.en.xml d_month.en.xml d_day.en.xml
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)
@ -57,8 +55,6 @@ d_month.en.xml: $(if $(findstring $(MONTH),$(shell cat d_month.en.xml)),,.FORCE)
d_year.en.xml: $(if $(findstring $(YEAR),$(shell cat d_year.en.xml)),,.FORCE)
printf %s\\n '$(YEAR)' >$@
all: d_year.en.xml d_month.en.xml d_day.en.xml
# -----------------------------------------------------------------------------
# Generate tag maps
# -----------------------------------------------------------------------------
@ -68,17 +64,21 @@ all: d_year.en.xml d_month.en.xml d_day.en.xml
# tag map files cannot be targets in this Makefile, because the list of map
# files is not known when the Makefile starts - some new tags might be created
# when generating the .xml files in the news/* subdirectories.
.PHONY: tagmaps
all: tagmaps
tagmaps: $(SUBDIRS)
@build/make_tagmaps.sh
all: tagmaps
.PHONY: tagmaps
# -----------------------------------------------------------------------------
# Touch .sources files for which the web pages must be rebuilt
# -----------------------------------------------------------------------------
# The .sources files in the tags directory are already handled by
# make_tagmaps.sh
SOURCES_FILES := $(shell find * -name '*.sources' -not -path 'tags/*')
# Secondary expansion means that the SOURCEDIRS and SOURCEREQS variables will
# be executed once for each target, and it allows us to use the variable $@
# within the expression.
@ -89,19 +89,16 @@ all: tagmaps
# directory also triggers a rebuild of the web pages which have included the
# now removed file. However, we explicitly exclude "." (the root source
# directory) because that also contains a lot of other files.
SOURCEDIRS = $(shell ls -d `sed -rn 's;^(.*/)[^/]*:(\[.*\])$$;\1;gp' $@` | grep -v '^\.$$')
SOURCES_DIRS = $(shell ls -d `sed -rn 's;^(.*/)[^/]*:(\[.*\])$$;\1;gp' $@` | grep -v '^\.$$')
# This variable contains all the actual .xml files covered by the .sources
# file. It obviously is a prerequisite because a page has to be rebuilt if any
# of the .xml files included into it has changed.
SOURCEREQS = $(shell ./build/source_globber.sh sourceglobs $@ | sed 's;$$;.??.xml;g' )
SOURCES_REQS = $(shell ./build/source_globber.sh sourceglobs $@ | sed 's;$$;.??.xml;g' )
# We simply touch the .sources file. The corresponding .xhtml files in all
# languages depend on the .sources file, so all languages will be rebuilt in
# the main build run.
%.sources: $$(SOURCEDIRS) $$(SOURCEREQS) | tagmaps
all: $(SOURCES_FILES)
%.sources: $$(SOURCES_DIRS) $$(SOURCES_REQS) | tagmaps
touch $@
# The .sources files in the tags directory are already handled by
# make_tagmaps.sh
all: $(shell find * -name '*.sources' -not -path 'tags/*')