ctucx.git: website

ctucx' website

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 
PREFIX ?= ./public
tmpdir ?= /tmp
all = $(addprefix ${PREFIX}/, $(addsuffix .html, $(basename $(wildcard *.md))))
files = $(addprefix ${PREFIX}/, gpg_pubkey.asc gpg_pubkey_leah.asc ssh_pubkey.asc ssh_pubkey_leah.asc $(wildcard assets/*))

install: ${all} ${files}

show:
	@echo ${all}
	@echo ${static}

${PREFIX}:
	mkdir -p ${PREFIX}

${PREFIX}/assets:
	mkdir -p ${PREFIX}/assets

${PREFIX}/%.html: %.md template.html ${PREFIX}
	pandoc --standalone --template template.html $< -o $@

${PREFIX}/gpg_pubkey.asc: files/gpg_pubkey.asc
	cp files/gpg_pubkey.asc ${PREFIX}/gpg_pubkey.asc

${PREFIX}/gpg_pubkey_leah.asc: files/gpg_pubkey_leah.asc
	cp files/gpg_pubkey_leah.asc ${PREFIX}/gpg_pubkey_leah.asc

${PREFIX}/ssh_pubkey.asc: files/ssh_pubkey.asc
	cp files/ssh_pubkey.asc ${PREFIX}/ssh_pubkey.asc

${PREFIX}/ssh_pubkey_leah.asc: files/ssh_pubkey_leah.asc
	cp files/ssh_pubkey_leah.asc ${PREFIX}/ssh_pubkey_leah.asc

${PREFIX}/assets/%: assets/% ${PREFIX}/assets
	cp $< $@

${PREFIX}/%: ${tmpdir}/% ${PREFIX}
	cp $< $@

clean:
	rm -r ${PREFIX} ${tmpdir}

start: ${all}
	{ php -S 127.0.0.1:8123 -t ${PREFIX} & \
		echo $$! > ${tmpdir}/php.pid; }

stop:
	kill `cat ${tmpdir}/php.pid`