aboutsummaryrefslogtreecommitdiff
path: root/v2/dynamic.mk
blob: 0c163ac5b9a7130eb0dd0473413b926388020f1c (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
100
101
102
103
104
105
106
.POSIX:


default: all

include generated.mk


.SUFFIXES:
.SUFFIXES: .md .content .conf .html .xmlentry


.md.content:
	awk 'sep >= 2; /^---$$/ {sep++}' < $< > $@

.md.conf:
	conf $< > $@

.md.html:
	html $< > $@

.md.xmlentry:
	xmlentry $< > $@


derived-assets = \
	$(all-generated)                \
	$(feeds)                        \


all: public


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

$(all-generated.xml):
	feed $@

clean:
	rm -rf \
		public/ $(derived-assets) *.sentinel generated.mk po/po4a.cfg  \
		src/content/*/*.html.*.txt src/content/*/*/*.html.*.txt        \
		src/content/*/*/*.sortdata src/content/**/feeds/               \


public: $(derived-assets) public-copy-content.sentinel public-copy-code-snippets.sentinel

content = \
	$(all-generated.html)                \
	$(all-generated.xml)                 \
	$(static-content)                    \

public-copy-content.sentinel: $(content) public-content-mkdir.sentinel
	echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \
		xargs -P`nproc` -I% ln -f src/content/% public/%
	touch $@

public-copy-code-snippets.sentinel: $(all-generated.snippets) public-content-mkdir.sentinel
	echo $? | tr ' ' '\n' | grep '^src/content/' | \
		xargs sed 's|^src/content/||' | \
		xargs -P`nproc` -I% ln -f src/content/% public/%
	touch $@

public-content-mkdir.sentinel: $(content) $(all-generated.snippets)
	echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \
		xargs dirname | \
		sort |          \
		uniq |          \
		xargs -P`nproc` -I% mkdir -p public/%
	touch $@


src/content/favicon.ico: src/content/favicon.svg
	convert src/content/favicon.svg $@

src/content/public.asc.txt:
	gpg --armour --export '$(EMAIL)' > $@

src/content/.well-known/security.txt: src/content/public.asc.txt src/bin/security-txt
	security-txt > $@



test-files = \
	aux/checks/shellcheck.sh \
	aux/checks/todos.sh      \

$(test-files): ALWAYS
	sh $@

check: $(test-files)
dev: all check

run: all
	serve -d public/

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

ALWAYS: