summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile67
1 files changed, 47 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index aa4ecf3..b4a58e8 100644
--- a/Makefile
+++ b/Makefile
@@ -6,27 +6,31 @@ export DEPLOY_TARGET = vulpes@94.130.78.123:/srv/http/volpeon.ink/
6# FILE GROUPS 6# FILE GROUPS
7# 7#
8 8
9PANDOC_FILTERS := $(patsubst %,--lua-filter %,$(wildcard filters/*.lua)) 9PANDOC_FILTERS := $(patsubst %,--lua-filter %,$(wildcard filters/*.lua))
10GLOBAL_METADATA := $(patsubst %,--metadata-file %,$(wildcard metadata/*.yaml)) 10GLOBAL_METADATA := $(patsubst %,--metadata-file %,$(wildcard metadata/*.yaml))
11 11
12CONTENT_SRC := $(shell find content -type f -name "*.md") 12CONTENT_SRC := $(shell find content -type f -name "*.md")
13TEMPLATES_SRC := $(shell find templates -type f -name "*.html") 13FEED_SRC := $(shell grep -l "^create_feed: *true$$" $(CONTENT_SRC))
14CSS_SRC := $(shell find assets/css -type f -name "*.scss") 14CONTENT_TEMPLATES_SRC := $(shell find templates -type f -name "*.html")
15 15FEED_TEMPLATES_SRC := $(shell find templates -type f -name "*.xml")
16CONTENT_META := $(patsubst content/%.md,.cache/meta/%.json,$(CONTENT_SRC)) 16CSS_SRC := $(shell find assets/css -type f -name "*.scss")
17CONTENT_FILES := $(patsubst content/%.md,out/%.html,$(CONTENT_SRC)) 17
18FONT_FILES := $(patsubst assets/fonts/%.ttf,out/%.woff2,$(wildcard assets/fonts/*.ttf)) 18CONTENT_META := $(patsubst content/%.md,.cache/meta/%.json,$(CONTENT_SRC))
19CSS_FILES := $(patsubst assets/css/%.scss,out/%.css,$(wildcard assets/css/style.scss)) 19CONTENT_FILES := $(patsubst content/%.md,out/%.html,$(CONTENT_SRC))
20STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -type f ! -name "*.md")) 20FEED_FILES := $(patsubst content/%.md,out/%.xml,$(FEED_SRC))
21FONT_FILES := $(patsubst assets/fonts/%.ttf,out/%.woff2,$(wildcard assets/fonts/*.ttf))
22CSS_FILES := $(patsubst assets/css/%.scss,out/%.css,$(wildcard assets/css/style.scss))
23STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -type f ! -name "*.md"))
21 24
22# 25#
23# TARGETS 26# TARGETS
24# 27#
25 28
26all: content_meta content_files static_files font_files css_files 29all: content_meta content_files feed_files static_files font_files css_files
27 30
28content_meta: $(CONTENT_META) 31content_meta: $(CONTENT_META)
29content_files: $(CONTENT_FILES) 32content_files: $(CONTENT_FILES)
33feed_files: $(FEED_FILES)
30static_files: $(STATIC_FILES) 34static_files: $(STATIC_FILES)
31font_files: $(FONT_FILES) 35font_files: $(FONT_FILES)
32css_files: $(CSS_FILES) 36css_files: $(CSS_FILES)
@@ -43,14 +47,13 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \
43 $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -maxdepth 1 -type f -name "*.md" ! -name "index.md") \ 47 $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -maxdepth 1 -type f -name "*.md" ! -name "index.md") \
44 $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -mindepth 2 -maxdepth 2 -type f -name "index.md")) 48 $(shell test -d $(patsubst .cache/meta%,content%,$(1)) && find $(patsubst .cache/meta%,content%,$(1)) -mindepth 2 -maxdepth 2 -type f -name "index.md"))
45 49
46.cache/meta/%.json: content/%.md $$(call subpages,$$(call namespace,$$@,)) scripts/subpages.jq | .cache/meta 50.cache/meta/%.json: content/%.md $$(call subpages,$$(call namespace,$$@,)) scripts/subpages.jq scripts/metadata_tpl.json | .cache/meta
47 $(info [META] $< -> $@) 51 $(info [META] $< -> $@)
48 52
49 mkdir -p $(@D) 53 mkdir -p $(@D)
50 $(eval PAGES_FILES = $(filter .cache/meta/%.json,$^)) 54 $(eval PAGES_FILES = $(filter .cache/meta/%.json,$^))
51 $(eval PAGES = $(shell mktemp))
52 $(eval NAMESPACE = $(call namespace,$@,.cache/meta)) 55 $(eval NAMESPACE = $(call namespace,$@,.cache/meta))
53 $(file >$(PAGES),$(if $(PAGES_FILES),$(shell jq -s --arg namespace "$(NAMESPACE)" -f scripts/subpages.jq $(PAGES_FILES)),)) 56 $(if $(PAGES_FILES),jq -s --arg namespace "$(NAMESPACE)" -f scripts/subpages.jq $(PAGES_FILES) > "$@.pages",touch "$@.pages")
54 pandoc \ 57 pandoc \
55 -f markdown-citations \ 58 -f markdown-citations \
56 -t plain \ 59 -t plain \
@@ -58,11 +61,18 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \
58 --template scripts/metadata_tpl.json \ 61 --template scripts/metadata_tpl.json \
59 --metadata namespace="$(NAMESPACE)" \ 62 --metadata namespace="$(NAMESPACE)" \
60 --metadata file_out="$(patsubst .cache/meta/%.json,out/%.html,$@)" \ 63 --metadata file_out="$(patsubst .cache/meta/%.json,out/%.html,$@)" \
61 --metadata-file "$(PAGES)" \ 64 --metadata-file "$@.pages" \
62 -o "$@" "$<" 65 -o "$@" "$<"
63 rm "$(PAGES)" 66# pandoc \
64 67 -f markdown-citations \
65out/%.html: content/%.md .cache/meta/%.json $(TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/metadata_filter.lua out/style.css | out 68 -t markdown \
69 -o "$@.content" "$<"
70# jq '. + { content: $$content }' --rawfile content "$@.content" "$@.meta" > "$@"
71 rm "$@.pages"
72# rm "$@.meta"
73# rm "$@.content"
74
75out/%.html: content/%.md .cache/meta/%.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/metadata_filter.lua out/style.css | out
66 $(info [MARK] $< -> $@) 76 $(info [MARK] $< -> $@)
67 77
68 mkdir -p $(@D) 78 mkdir -p $(@D)
@@ -74,10 +84,27 @@ out/%.html: content/%.md .cache/meta/%.json $(TEMPLATES_SRC) metadata/*.yaml fil
74 --lua-filter scripts/metadata_filter.lua \ 84 --lua-filter scripts/metadata_filter.lua \
75 $(GLOBAL_METADATA) \ 85 $(GLOBAL_METADATA) \
76 --metadata-file "$(filter .cache/meta/%.json,$^)" \ 86 --metadata-file "$(filter .cache/meta/%.json,$^)" \
87 --metadata file_out="$@" \
77 --metadata style_hash="$(shell sha256sum out/style.css | cut -d ' ' -f 1)" \ 88 --metadata style_hash="$(shell sha256sum out/style.css | cut -d ' ' -f 1)" \
78 $(PANDOC_FILTERS) \ 89 $(PANDOC_FILTERS) \
79 -o "$@" "$<" 90 -o "$@" "$<"
80 91
92out/%.xml: content/%.md .cache/meta/%.json $(FEED_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/metadata_filter.lua | out
93 $(info [FEED] $< -> $@)
94
95 mkdir -p $(@D)
96 pandoc \
97 -f markdown-citations \
98 -t html5 \
99 --no-highlight \
100 --template templates/feed.xml \
101 --lua-filter scripts/metadata_filter.lua \
102 $(GLOBAL_METADATA) \
103 --metadata-file "$(filter .cache/meta/%.json,$^)" \
104 --metadata file_out="$@" \
105 $(PANDOC_FILTERS) \
106 -o "$@" "$<"
107
81out/%: content/% | out 108out/%: content/% | out
82 $(info [COPY] $< -> $@) 109 $(info [COPY] $< -> $@)
83 110