aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: fd63df5480a2f32043f00d803e936ff94f0e8259 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
.POSIX:
FQDN = euandre.org

.SUFFIXES:
.SUFFIXES: .ly .flac .midi .ogg .pdf

.ly.midi:
	lilypond -o $* $<

.midi.ogg:
	timidity -Ov $<

.flac.ogg:
	ffmpeg -y -i $< -ar 48000 -vn -c:a libvorbis -b:a 320k $@


lilypond.ly = \
	music/choro-da-saudade.ly \
	music/dengoso.ly          \
	music/marcha-dos-marinheiros.ly
lilypond.pdf  = $(lilypond.ly:.ly=.pdf)
lilypond.midi = $(lilypond.ly:.ly=.midi)
lilypond.ogg  = $(lilypond.midi:.midi=.ogg)
lilypond = \
	$(lilypond.pdf)  \
	$(lilypond.midi) \
	$(lilypond.ogg)

favicons = static/lord-favicon.png static/lord-favicon.ico favicon.ico

podcasts.flac = \
	resources/podcasts/2020-12-19-a-test-entry.flac
podcasts.ogg = $(podcasts.flac:.flac=.ogg)

screencasts.webm = \
	resources/screencasts/2021-02-07-autoqemu-automate-installation-and-ssh-setup-of-iso-os-images.webm

torrents-in = \
	$(podcasts.flac) \
	$(podcasts.ogg)  \
	$(screencasts.webm)

torrents = $(torrents-in:=.torrent)

derived-assets = \
	$(pastebins)    \
	$(lilypond)     \
	$(favicons)     \
	$(podcasts.ogg) \
	$(torrents)     \
	TODOs.html      \



all: public dynamic

dynamic: generated.mk
	$(MAKE) -f dynamic.mk all

JEKYLL_COMPAT: deps.mk files.mk
	sh src/development/JEKYLL_COMPAT/copy-content.sh

generated.mk: ALWAYS JEKYLL_COMPAT
	sh src/development/dynmake.sh > $@

# NOOP rule to assert that the targets that depend on it are
# always considered stale.
ALWAYS:

$(lilypond.pdf): $(lilypond.midi)


torrent-files.txt: $(torrents-in)
	echo $(torrents-in) | tr ' ' '\n' > $@

files.mk: torrent-files.txt
	printf '' > $@
	printf 'torrent-files = \\\n' >> $@
	sed -e 's/^/\t/' -e 's/$$/.torrent \\/' < torrent-files.txt >> $@
	printf '\n\n' >> $@

deps.mk: torrent-files.txt
	printf '' > $@
	awk '{ printf "%s.torrent: %s\n", $$1, $$1 }' torrent-files.txt >> $@

$(torrents): files.mk deps.mk
	$(MAKE) generated.mk
	$(MAKE) -f dynamic.mk torrents

static/lord-favicon.png: static/lord-favicon.svg
	inkscape -o $@ -w 2048 -h 2048 -b white static/lord-favicon.svg

static/lord-favicon.ico: static/lord-favicon.svg
	convert static/lord-favicon.svg $@

favicon.ico: static/lord-favicon.ico
	ln -fs static/lord-favicon.ico $@

TODOs.html: TODOs.md
	sh aux/workflow/TODOs.sh -n website -m public-inbox -o .




check:
	sh aux/assert-shellcheck.sh
	sh aux/workflow/assert-todos.sh
	sh scripts/assert-spelling.sh
	sh scripts/extract-translations.sh
	sh scripts/apply-translations.sh

dev-check: check

clean:
	rm -rf \
		public/ .jekyll-cache \
		$(derived-assets) \
		torrent-files.txt files.mk deps.mk \
		src/content/ generated.mk \


JEKYLL = JEKYLL_ENV=production jekyll
public: $(derived-assets)
	$(JEKYLL) build

run: all
	open 'http://localhost:4000'
	$(JEKYLL) serve

deploy: all
	rm -rf public
	$(MAKE) public
	rsync -avzP public/ $(FQDN):/home/user-data/www/default/ --delete

fqdn:
	printf '$(FQDN)'