aboutsummaryrefslogtreecommitdiff
path: root/v2/dynamic.mk
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-06 11:28:25 -0300
committerEuAndreh <eu@euandre.org>2023-04-06 11:28:25 -0300
commit9dbe03f4fe038236d5b643872fa5ab481a792980 (patch)
tree44691e9530208be7974c9a5df4c8251e59c38890 /v2/dynamic.mk
parentv2: dynamic.mk: Remove "public-" prefix from all sentinel targets (diff)
downloadeuandre.org-9dbe03f4fe038236d5b643872fa5ab481a792980.tar.gz
euandre.org-9dbe03f4fe038236d5b643872fa5ab481a792980.tar.xz
v2: Add support for src/redirect.mappings via symlinks
Diffstat (limited to '')
-rw-r--r--v2/dynamic.mk11
1 files changed, 9 insertions, 2 deletions
diff --git a/v2/dynamic.mk b/v2/dynamic.mk
index b8fbba3..06d9bbf 100644
--- a/v2/dynamic.mk
+++ b/v2/dynamic.mk
@@ -44,13 +44,19 @@ clean:
src/content/*/*/*.sortdata src/content/**/feeds/ \
-public: $(derived-assets) copy-content.sentinel copy-code-snippets.sentinel
+public: $(derived-assets) symlink-mappings.sentinel copy-content.sentinel copy-code-snippets.sentinel
content = \
$(all-generated.html) \
$(all-generated.xml) \
$(static-content) \
+symlink-mappings.sentinel: src/redirect.mappings content-mkdir.sentinel
+ < src/redirect.mappings \
+ awk '{ printf "ln -rfs public/%s public/%s\n", $$2, $$1 }' | \
+ sh
+ touch $@
+
copy-content.sentinel: $(content) content-mkdir.sentinel
echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \
xargs -P`nproc` -I% ln -f src/content/% public/%
@@ -62,8 +68,9 @@ copy-code-snippets.sentinel: $(all-generated.snippets) content-mkdir.sentinel
xargs -P`nproc` -I% ln -f src/content/% public/%
touch $@
-content-mkdir.sentinel: $(content) $(all-generated.snippets)
+content-mkdir.sentinel: $(content) $(all-generated.snippets) src/redirect.mappings
echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \
+ printf '%s\n%s\n' "`cat -`" "`awk '{print $$2}' src/redirect.mappings`" | \
xargs dirname | \
sort | \
uniq | \