From a964682f3a3b9ab238e8e78574115645b58f0c93 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 7 Mar 2021 10:56:54 +0100 Subject: [html] fix rules creation --- html/Makefile | 23 +++++++++++++++-------- html/rules | 1 - 2 files changed, 15 insertions(+), 9 deletions(-) delete mode 120000 html/rules (limited to 'html') diff --git a/html/Makefile b/html/Makefile index 6afc7ead..6d1a75ed 100644 --- a/html/Makefile +++ b/html/Makefile @@ -1,6 +1,6 @@ VERBOSE ?= @ -PANDOC_FLAGS = -f markdown -s --template=./template.html +PANDOC_FLAGS := -f markdown -s --template=./template.html # The full path to the Makefile MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) @@ -28,11 +28,13 @@ RULE_FILES := rules.md tiles.md ai.md DE_RULES := $(addprefix $(RULES_ROOT)/de/,$(RULE_FILES)) EN_RULES := $(addprefix $(RULES_ROOT)/en/,$(RULE_FILES)) RULES := $(DE_RULES) $(EN_RULES) -RULES_HTML := $(addprefix $(BUILDDIR)/,$(RULES:.md=.html)) +RULES_HTML := $(subst $(RULES_ROOT), $(BUILDDIR)/rules, $(RULES:.md=.html)) SITES := index.md rules.md cards.md maps.md HTML := $(addprefix $(BUILDDIR)/,$(SITES:.md=.html)) +VPATH := $(RULES_ROOT) + # Create a list of yaml card definitions CARDS_YAML := $(foreach dir,$(SETS_SOURCEDIRS),$(wildcard $(dir)/*.yml)) @@ -49,12 +51,17 @@ maps: $(VERBOSE) ln -sf $(MAPS_ROOT) $(BUILDDIR)/maps $(VERBOSE) make -C $(MAPS_ROOT) -$(BUILDDIR)/%.html: %.md $(MAKEFILE_LIST) - @echo "building $@" - @if test \( ! \( -d $(@D) \) \) ;then mkdir -p $(@D);fi - $(VERBOSE) if [[ $$(cat $< | wc -l) -gt 80 ]]; \ - then pandoc --toc $(PANDOC_FLAGS) $< -o $@; \ - else pandoc $(PANDOC_FLAGS) $< -o $@; fi +define generateHtml +$(1)/%.html: %.md $(MAKEFILE_LIST) + @echo "building $$@" + @if test \( ! \( -d $$(@D) \) \) ;then mkdir -p $$(@D);fi + $(VERBOSE) if [[ $$$$(cat $$< | wc -l) -gt 80 ]]; \ + then pandoc --toc $(PANDOC_FLAGS) $$< -o $$@; \ + else pandoc $(PANDOC_FLAGS) $$< -o $$@; fi +endef + +$(eval $(call generateHtml, $(BUILDDIR))) +$(eval $(call generateHtml, $(BUILDDIR)/rules)) cards.md: $(CARDS_YAML) $(GENERATE_CARD) $(MAKEFILE_LIST) @echo "render cards $@" diff --git a/html/rules b/html/rules deleted file mode 120000 index c6a39ed7..00000000 --- a/html/rules +++ /dev/null @@ -1 +0,0 @@ -../rules/ \ No newline at end of file -- cgit v1.2.3