diff options
Diffstat (limited to 'v2/dynamic.mk')
-rw-r--r-- | v2/dynamic.mk | 104 |
1 files changed, 60 insertions, 44 deletions
diff --git a/v2/dynamic.mk b/v2/dynamic.mk index 8abb62e..d31be9f 100644 --- a/v2/dynamic.mk +++ b/v2/dynamic.mk @@ -1,7 +1,6 @@ .POSIX: -FQDN = euandre.org -PORT = 4444 -BASE_URL = +DOMAIN = euandre.org +EMAIL = eu@euandre.org default: all @@ -11,73 +10,90 @@ include generated.mk .SUFFIXES: -.SUFFIXES: .md .html .in .entry-content .entry-env - +.SUFFIXES: .in .md .conf .content .html .in: sed \ - -e 's|@FQDN@|$(FQDN)|g' \ - -e 's|@BASE_URL@|$(BASE_URL)|g' \ + -e 's|@DOMAIN@|$(DOMAIN)|g' \ + -e 's|@EMAIL@|$(EMAIL)|g' \ < $< > $@ if [ -x $< ]; then chmod +x $@; fi +.md.conf: + sh src/development/getconf.sh $< > $@ + +.md.content: + awk 'sep >= 2; /^---$$/ {sep++}' < $< > $@ + .md.html: sh src/development/genhtml.sh $< > $@ -.md.entry-content: - extract -t content $? > $@ -.md.entry-env: - extract -t env $? > $@ +favicons = \ + public/favicon.png \ + public/favicon.ico \ +derived-assets = \ + $(all-generated) \ + $(favicons) \ + src/lib/base-conf \ + src/development/security-txt.sh \ -pastebins.html = $(pastebins.md:.md=.html) +$(all-generated.conf) $(all-generated.content): $(non-content) -html = \ - $(pastebins.html) \ +all: public +$(all-generated.conf): src/lib/base-conf -ALL = \ - src/content/TODOs.html \ - $(html) \ - +clean: + rm -rf \ + public/ $(derived-assets) *.sentinel generated.mk -all: $(ALL) +public: $(favicons) public-copy-content.sentinel -$(html) src/bin/absolute src/bin/extract src/bin/url-for: src/development/config.env -$(html): src/development/genhtml.sh +public-mkdir.sentinel: + mkdir -p public + touch $@ +public/favicon.png: public-mkdir.sentinel src/content/favicon.svg + inkscape -o $@ -w 2048 -h 2048 -b white src/content/favicon.svg -collections = pastebins +public/favicon.ico: public-mkdir.sentinel src/content/favicon.svg + convert src/content/favicon.svg $@ -clean: - for c in $(collections); do \ - rm -f \ - src/content/$$c/*.entry-* \ - src/content/$$c/*.txt; \ - done - rm -rf \ - $(ALL) generated.mk src/development/config.env \ +public-copy-content.sentinel: $(all-generated.html) $(static-content) \ + src/content/public.asc.txt src/content/.well-known/security.txt + echo $? | \ + tr ' ' '\n' | \ + sed 's|^src/content/||' | \ + tee $@-tmp | \ + xargs dirname | \ + sort | \ + uniq | \ + xargs -P`nproc` -I% mkdir -p public/% + xargs -P`nproc` -I% cp src/content/% public/% < $@-tmp + rm -f $@-tmp + touch $@ -src/content/TODOs.html: TODOs.md - sh aux/workflow/TODOs.sh -n website -m public-inbox > $@ +src/content/public.asc.txt: + gpg --armour --export '$(EMAIL)' > $@ -public: all +src/content/.well-known/security.txt: src/content/public.asc.txt src/development/security-txt.sh + sh src/development/security-txt.sh > $@ check: -dev-check: check - -fqdn: - printf '$(FQDN)' - - +dev: check run: all - open 'http://localhost:$(PORT)' - serve -d src/content/ -p $(PORT) - -deploy: all - rsync -avzP src/content/ $(FQDN):/home/user-data/www/default/v2/ --delete + serve -d public/ + +upload: public + rsync \ + --rsync-path='sudo -u deployer rsync' \ + -avzP \ + --delete \ + --exclude 's/*' \ + public/ $(DOMAIN):/srv/www/ |