summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 21 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index d8dc0db..ede169e 100644
--- a/Makefile
+++ b/Makefile
@@ -21,19 +21,20 @@ FEED_FILES := $(patsubst content/%.md,out/%.xml,$(FEED_SRC))
21FONT_FILES := $(patsubst assets/fonts/%.ttf,out/%.woff2,$(wildcard assets/fonts/*.ttf)) 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)) 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")) 23STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -type f ! -name "*.md"))
24ASSET_FILES := $(FONT_FILES) $(CSS_FILES) out/icons.svg $(patsubst content/%,out/%,$(shell find content -maxdepth 1 -type f ! -name "*.md"))
24 25
25# 26#
26# TARGETS 27# TARGETS
27# 28#
28 29
29all: content_meta content_files feed_files static_files font_files css_files icons 30all: content_meta content_files feed_files font_files css_files static_files
30 31
31content_meta: $(CONTENT_META) 32content_meta: $(CONTENT_META)
32content_files: $(CONTENT_FILES) 33content_files: $(CONTENT_FILES)
33feed_files: $(FEED_FILES) 34feed_files: $(FEED_FILES)
34static_files: $(STATIC_FILES)
35font_files: $(FONT_FILES) 35font_files: $(FONT_FILES)
36css_files: $(CSS_FILES) 36css_files: $(CSS_FILES)
37static_files: $(STATIC_FILES)
37 38
38# 39#
39# RULES 40# RULES
@@ -65,6 +66,7 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \
65 --metadata-file "$@.pages" \ 66 --metadata-file "$@.pages" \
66 $(PANDOC_FILTERS) \ 67 $(PANDOC_FILTERS) \
67 -o "$@.meta" "$<" 68 -o "$@.meta" "$<"
69 rm "$@.pages"
68 pandoc \ 70 pandoc \
69 -f markdown-citations-implicit_figures \ 71 -f markdown-citations-implicit_figures \
70 -t html5 \ 72 -t html5 \
@@ -77,11 +79,13 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \
77 $(PANDOC_FILTERS) \ 79 $(PANDOC_FILTERS) \
78 -o "$@.content" "$<" 80 -o "$@.content" "$<"
79 jq '. + { content: $$content }' --rawfile content "$@.content" "$@.meta" > "$@" 81 jq '. + { content: $$content }' --rawfile content "$@.content" "$@.meta" > "$@"
80 rm "$@.pages"
81 rm "$@.meta" 82 rm "$@.meta"
82 rm "$@.content" 83 rm "$@.content"
83 84
84out/%.html: content/%.md .cache/meta/%.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/metadata_filter.lua out/style.css | out 85.cache/assets.json: $(ASSET_FILES) | .cache
86 sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/(.*)/{ "\2": "\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@"
87
88out/%.html: content/%.md .cache/meta/%.json .cache/assets.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/metadata_filter.lua | out
85 $(info [MARK] $< -> $@) 89 $(info [MARK] $< -> $@)
86 90
87 mkdir -p $(@D) 91 mkdir -p $(@D)
@@ -93,9 +97,9 @@ out/%.html: content/%.md .cache/meta/%.json $(CONTENT_TEMPLATES_SRC) metadata/*.
93 --template templates/base.html \ 97 --template templates/base.html \
94 --lua-filter scripts/metadata_filter.lua \ 98 --lua-filter scripts/metadata_filter.lua \
95 $(GLOBAL_METADATA) \ 99 $(GLOBAL_METADATA) \
100 --metadata-file .cache/assets.json \
96 --metadata-file "$(filter .cache/meta/%.json,$^)" \ 101 --metadata-file "$(filter .cache/meta/%.json,$^)" \
97 --metadata file_out="$@" \ 102 --metadata file_out="$@" \
98 --metadata style_hash="$(shell sha256sum out/style.css | cut -d ' ' -f 1)" \
99 $(PANDOC_FILTERS) \ 103 $(PANDOC_FILTERS) \
100 -o "$@" "$<" 104 -o "$@" "$<"
101 105
@@ -140,14 +144,8 @@ out/%.css: assets/css/%.scss $(CSS_SRC) | out
140 144
141 sass --load-path=node_modules "$<" | ./node_modules/.bin/postcss --use autoprefixer --no-map -o "$@" 145 sass --load-path=node_modules "$<" | ./node_modules/.bin/postcss --use autoprefixer --no-map -o "$@"
142 146
143out/%: content/% | out 147out/icons.svg: | out
144 $(info [COPY] $< -> $@) 148 $(info [ICON] $@)
145
146 mkdir -p $(@D)
147 cp "$<" "$@"
148
149icons: | out
150 $(info [ICON] out/icons.svg)
151 149
152 node ./node_modules/iro-icons/scripts/create_sprite.js \ 150 node ./node_modules/iro-icons/scripts/create_sprite.js \
153 asterisk \ 151 asterisk \
@@ -168,7 +166,16 @@ icons: | out
168 x \ 166 x \
169 chevron-left \ 167 chevron-left \
170 chevron-right \ 168 chevron-right \
171 "out/icons.svg" 169 "$@"
170
171out/%: content/% | out
172 $(info [COPY] $< -> $@)
173
174 mkdir -p $(@D)
175 cp "$<" "$@"
176
177.cache/hash: | .cache
178 mkdir -p .cache/hash
172 179
173.cache/meta: | .cache 180.cache/meta: | .cache
174 mkdir -p .cache/meta 181 mkdir -p .cache/meta