2021-06-27 18:22:40 +02:00
|
|
|
BASE_URL_WWW ?= https://monotremata.xyz
|
|
|
|
BASE_URL_ONION ?= http://zswm576cm7wgmgcwluy4l4ixkfasj25taqbn2r5pnrrj552l263ff2qd.onion
|
|
|
|
|
|
|
|
SASS_FILES=$(shell find sass -name \*.scss)
|
2022-08-25 16:09:27 +02:00
|
|
|
FEATHER_ICONS=$(shell find icons/feather/icons -name \*.svg)
|
2021-06-27 18:22:40 +02:00
|
|
|
PAGES=$(shell find pages -maxdepth 1 -mindepth 1 -type d -printf "%f\n")
|
|
|
|
ASSETS=$(shell find assets -mindepth 1)
|
|
|
|
|
|
|
|
WWW_UNTIDY=$(PAGES:%=untidy_www_%.html)
|
|
|
|
WWW_ASSETS=$(ASSETS:assets/%=html/www/%)
|
|
|
|
WWW_HTML=$(PAGES:%=html/www/%.html)
|
|
|
|
|
|
|
|
ONION_UNTIDY=$(PAGES:%=untidy_onion_%.html)
|
|
|
|
ONION_ASSETS=$(ASSETS:assets/%=html/onion/%)
|
|
|
|
ONION_HTML=$(PAGES:%=html/onion/%.html)
|
|
|
|
|
|
|
|
.PHONY: all clean deploy onion www
|
|
|
|
.INTERMEDIATE: style.css
|
|
|
|
|
|
|
|
all: www onion
|
|
|
|
|
|
|
|
deploy: all
|
|
|
|
rsync --recursive --human-readable --delete --info=progress2 html/* caladan:/srv/sites/frontpage
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -fr html
|
|
|
|
|
|
|
|
onion: $(ONION_HTML) $(ONION_ASSETS)
|
|
|
|
www: $(WWW_HTML) $(WWW_ASSETS)
|
|
|
|
|
|
|
|
style.css: $(SASS_FILES)
|
|
|
|
sassc sass/main.scss style.css
|
|
|
|
|
|
|
|
define build_html
|
2022-08-25 16:16:29 +02:00
|
|
|
j2 -f yaml -o $@ pages/$*/main.j2 config.yaml
|
2021-06-27 18:22:40 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define cp_asset
|
2022-08-25 16:16:29 +02:00
|
|
|
@mkdir -p $(@D)
|
2021-06-27 18:22:40 +02:00
|
|
|
cp $? $@
|
|
|
|
endef
|
|
|
|
|
|
|
|
define tidy_html
|
2022-08-25 16:16:29 +02:00
|
|
|
@mkdir -p $(@D)
|
2021-06-27 18:22:40 +02:00
|
|
|
tidy --show-info no -output $@ $<
|
|
|
|
endef
|
|
|
|
|
2022-08-25 16:09:27 +02:00
|
|
|
page_deps = pages/%/*.j2 config.yaml header.j2 footer.j2 style.css $(FEATHER_ICONS)
|
2021-06-27 18:22:40 +02:00
|
|
|
|
|
|
|
untidy_www_%.html: $(page_deps)
|
2022-08-25 16:16:29 +02:00
|
|
|
BASE_URL=$(BASE_URL_WWW) $(build_html)
|
2021-06-27 18:22:40 +02:00
|
|
|
|
|
|
|
untidy_onion_%.html: $(page_deps)
|
2022-08-25 16:16:29 +02:00
|
|
|
BASE_URL=$(BASE_URL_ONION) $(build_html)
|
2021-06-27 18:22:40 +02:00
|
|
|
|
|
|
|
html/www/%.html: untidy_www_%.html
|
|
|
|
$(tidy_html)
|
|
|
|
|
|
|
|
html/onion/%.html: untidy_onion_%.html
|
|
|
|
$(tidy_html)
|
|
|
|
|
|
|
|
html/www/%: assets/%
|
|
|
|
$(cp_asset)
|
|
|
|
|
|
|
|
html/onion/%: assets/%
|
|
|
|
$(cp_asset)
|