aboutsummaryrefslogtreecommitdiff
path: root/v2/dynamic.mk
blob: d31be9ffb38051e15fa63f3c214c260588693fac (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.POSIX:
DOMAIN = euandre.org
EMAIL  = eu@euandre.org


default: all

include generated.mk



.SUFFIXES:
.SUFFIXES: .in .md .conf .content .html

.in:
	sed \
		-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 $< > $@


favicons = \
	public/favicon.png \
	public/favicon.ico \

derived-assets = \
	$(all-generated)                \
	$(favicons)                     \
	src/lib/base-conf               \
	src/development/security-txt.sh \


$(all-generated.conf) $(all-generated.content): $(non-content)

all: public

$(all-generated.conf): src/lib/base-conf

clean:
	rm -rf \
		public/ $(derived-assets) *.sentinel generated.mk


public: $(favicons) public-copy-content.sentinel

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

public/favicon.ico: public-mkdir.sentinel src/content/favicon.svg
	convert src/content/favicon.svg $@

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/public.asc.txt:
	gpg --armour --export '$(EMAIL)' > $@

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

run: all
	serve -d public/

upload: public
	rsync \
		--rsync-path='sudo -u deployer rsync' \
		-avzP \
		--delete \
		--exclude 's/*' \
		public/ $(DOMAIN):/srv/www/