fsfe-website/fsfe.org/events/Makefile
delliott bb45fc85ba
All checks were successful
continuous-integration/drone/push Build is passing
feat/build-improvements-2 (#4553)
Another attempt at #4516

Adds a small fix for tag map generation

#4516 introduces build failures, but testing indicates that those failures would have been resolved by a full rebuild.

Hence this pr.

Co-authored-by: Darragh Elliott <me@delliott.xyz>
Reviewed-on: #4553
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2024-10-29 14:56:41 +00: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 := $(filter $(foreach lang,$(languages),.$(lang)),$(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 "fsfe.org/events/$(dir $@)event-*:[]\nfsfe.org/events/$(dir $@).event-*:[]\nfsfe.org/events/.localmenu:[]\n" > $@