From e98158a2aa08ef0dfade513d79073e8accbc9bca Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Sat, 14 Mar 2020 16:30:20 +0100 Subject: Make path concatenation more to my liking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- repo/www/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'repo/www/Makefile') diff --git a/repo/www/Makefile b/repo/www/Makefile index b30f600..6bc53ea 100644 --- 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 -- cgit v1.2.3