commit e98158a2aa08ef0dfade513d79073e8accbc9bca
parent e598068b7b99002121d1646a913bebedf8df1ee3
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date: Sat, 14 Mar 2020 16:30:20 +0100
Make path concatenation more to my liking
I prefer thinking of slashes as concatenation operators, always
accompanied by operands on both sides. I don't like them hanging
there at the end of my variables, which is what $(dir …) causes.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/repo/www/Makefile b/repo/www/Makefile
@@ -2,10 +2,13 @@ TOP_DIR = ../..
OUT_DIR = $(TOP_DIR)/public
TEXT_FILES = md org
+dirname = $(patsubst %/,%,$(dir $(1)))
+
text_patterns = $(foreach ext,$(TEXT_FILES),'$(TOP_DIR)/**.$(ext)')
-text_folders = $(sort $(dir $(shell git ls-files $(text_patterns))))
-page_folders = $(patsubst $(TOP_DIR)%/,$(OUT_DIR)%,$(text_folders))
+text_folders = $(sort $(call dirname,$(shell git ls-files $(text_patterns))))
+
+page_folders = $(patsubst $(TOP_DIR)%,$(OUT_DIR)%,$(text_folders))
all: site