fsfe-website/events/Makefile
Reinhard Müller 55f58a4e07
All checks were successful
continuous-integration/drone/push Build is passing
Use default.xsl as the common XSL for all news and events lists
2020-04-27 23:38:58 +02:00

40 lines
1.5 KiB
Makefile

# -----------------------------------------------------------------------------
# Makefile for FSFE website build, preparation for events subdirectory
# -----------------------------------------------------------------------------
.PHONY: all
.SECONDEXPANSION:
# -----------------------------------------------------------------------------
# Copy event archive template to each of the years
# -----------------------------------------------------------------------------
# All years for which a subdirectory exists
ARCH_YEARS := $(sort $(wildcard [0-9][0-9][0-9][0-9]))
# No archive for the current year
ARCH_YEARS := $(filter-out $(lastword $(ARCH_YEARS)),$(ARCH_YEARS))
# ... and the year before
ARCH_YEARS := $(filter-out $(lastword $(ARCH_YEARS)),$(ARCH_YEARS))
# Languages in which the template exists
ARCH_LANGS := $(suffix $(basename $(wildcard archive-template.??.xhtml)))
# .xhtml files to generate
ARCH_XHTML := $(foreach year,$(ARCH_YEARS),$(foreach lang,$(ARCH_LANGS),$(year)/index$(lang).xhtml))
all: $(ARCH_XHTML)
$(ARCH_XHTML): %.xhtml: archive-template$$(suffix $$*).xhtml
@echo "* Creating $@"
@# $(dir $@) returns YYYY/, we abuse the slash for closing the sed command
@sed 's/:YYYY:/$(dir $@)g' $< > $@
# .sources files to generate
ARCH_SOURCES := $(foreach year,$(ARCH_YEARS),$(year)/index.sources)
all: $(ARCH_SOURCES)
$(ARCH_SOURCES): %.sources:
@echo "* Creating $@"
@echo "events/$(dir $@)event-*:[]\nevents/$(dir $@).event-*:[]\nevents/.localmenu:[]\n" > $@