summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile27
1 files changed, 15 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index df13e15..1a7fae7 100644
--- a/Makefile
+++ b/Makefile
@@ -14,16 +14,19 @@ CONTENT_SRC := $(shell find content -type f -name "*.md")
14FEED_SRC := $(shell grep -l "^feed: *true$$" $(CONTENT_SRC)) 14FEED_SRC := $(shell grep -l "^feed: *true$$" $(CONTENT_SRC))
15CONTENT_TEMPLATES_SRC := $(shell find templates -type f -name "*.html") 15CONTENT_TEMPLATES_SRC := $(shell find templates -type f -name "*.html")
16FEED_TEMPLATES_SRC := $(shell find templates -type f -name "*.xml") 16FEED_TEMPLATES_SRC := $(shell find templates -type f -name "*.xml")
17FONT_SRC := $(wildcard assets/fonts/*.ttf)
17CSS_SRC := $(shell find assets/css -type f -name "*.scss") 18CSS_SRC := $(shell find assets/css -type f -name "*.scss")
19ASSET_SRC := $(shell find content/assets -type f)
20STATIC_SRC := $(shell find content -type f ! -name "*.md")
18 21
19CONTENT_META := $(patsubst content/%.md,.cache/meta/%.json,$(CONTENT_SRC)) 22CONTENT_META := $(patsubst content/%.md,.cache/meta/%.json,$(CONTENT_SRC))
20CONTENT_FILES := $(patsubst content/%.md,out/%.html,$(CONTENT_SRC)) 23CONTENT_FILES := $(patsubst content/%.md,out/%.html,$(CONTENT_SRC))
21FEED_FILES := $(patsubst content/%.md,out/%.xml,$(FEED_SRC)) 24FEED_FILES := $(patsubst content/%.md,out/%.xml,$(FEED_SRC))
22FONT_FILES := $(patsubst assets/fonts/%.ttf,out/%.woff2,$(wildcard assets/fonts/*.ttf)) 25FONT_FILES := $(patsubst assets/fonts/%.ttf,out/assets/%.woff2,$(FONT_SRC))
23CSS_FILES := $(patsubst assets/css/%.scss,out/%.css,$(wildcard assets/css/style.scss)) 26CSS_FILES := out/assets/style.css
24STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -type f ! -name "*.md")) 27ICON_FILES := out/assets/icons.svg
25TOP_STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -maxdepth 1 -type f ! -name "*.md")) 28ASSET_FILES := $(FONT_FILES) $(CSS_FILES) $(ICON_FILES) $(patsubst content/assets/%,out/assets/%,$(ASSET_SRC))
26ASSET_FILES := $(FONT_FILES) $(CSS_FILES) out/icons.svg $(TOP_STATIC_FILES) 29STATIC_FILES := $(patsubst content/%,out/%,$(STATIC_SRC))
27 30
28# 31#
29# TARGETS 32# TARGETS
@@ -103,7 +106,7 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \
103.cache/assets.json: $(ASSET_FILES) | .cache 106.cache/assets.json: $(ASSET_FILES) | .cache
104 $(info [ASET] $@) 107 $(info [ASET] $@)
105 108
106 sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/(.*)/{ "\2": "\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@" 109 sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/assets\/(.*)/{ "\2": "\/assets\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@"
107 110
108out/%.html: content/%.md .cache/meta.json .cache/assets.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/page.lua | out 111out/%.html: content/%.md .cache/meta.json .cache/assets.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/page.lua | out
109 $(info [MARK] $< -> $@) 112 $(info [MARK] $< -> $@)
@@ -156,7 +159,7 @@ out/%/thumbnail.jpg: content/%/thumbnail.jpg | out
156 mkdir -p $(@D) 159 mkdir -p $(@D)
157 convert -thumbnail 550x280^ -gravity center -extent 550x280 "$<" ppm:- | cjpeg -quality 80 > "$@" 160 convert -thumbnail 550x280^ -gravity center -extent 550x280 "$<" ppm:- | cjpeg -quality 80 > "$@"
158 161
159out/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out 162out/assets/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out/assets
160 $(info [FONT] $< -> $@) 163 $(info [FONT] $< -> $@)
161 164
162 pyftsubset "$<" \ 165 pyftsubset "$<" \
@@ -165,12 +168,12 @@ out/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out
165 --flavor="woff2" \ 168 --flavor="woff2" \
166 --output-file="$@" 169 --output-file="$@"
167 170
168out/%.css: assets/css/%.scss $(CSS_SRC) | out 171out/assets/%.css: assets/css/%.scss $(CSS_SRC) | out/assets
169 $(info [SCSS] $< -> $@) 172 $(info [SCSS] $< -> $@)
170 173
171 sass --load-path=node_modules "$<" | ./node_modules/.bin/postcss --use autoprefixer --use postcss-csso --no-map -o "$@" 174 sass --load-path=node_modules "$<" | ./node_modules/.bin/postcss --use autoprefixer --use postcss-csso --no-map -o "$@"
172 175
173out/icons.svg: | out 176out/assets/icons.svg: | out/assets
174 $(info [ICON] $@) 177 $(info [ICON] $@)
175 178
176 node ./node_modules/iro-icons/scripts/create_sprite.js \ 179 node ./node_modules/iro-icons/scripts/create_sprite.js \
@@ -200,15 +203,15 @@ out/%: content/% | out
200 mkdir -p $(@D) 203 mkdir -p $(@D)
201 cp "$<" "$@" 204 cp "$<" "$@"
202 205
203.cache/hash: | .cache
204 mkdir -p .cache/hash
205
206.cache/meta: | .cache 206.cache/meta: | .cache
207 mkdir -p .cache/meta 207 mkdir -p .cache/meta
208 208
209.cache: 209.cache:
210 mkdir -p .cache 210 mkdir -p .cache
211 211
212out/assets: | out
213 mkdir -p out/assets
214
212out: 215out:
213 mkdir -p out 216 mkdir -p out
214 217