summaryrefslogtreecommitdiff
path: root/Makefile
blob: b5524321289dc3e82396942a45720fc43989b5e8 (plain)
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
PAGES=\
	md/about.md\
	md/about/comparisons.md\
	md/about/faq.md\
	md/client.md\
	md/share.md\
	md/share/guide.md\
	md/share/man.md\
	md/hub.md\
	md/proto.md\
	md/proto/ShareApi.md\
	md/proto/HttpRequirements.md\
	md/proto/ideas/DirSharing.md\
	md/proto/ideas/PrivateCommunities.md

HTML := $(shell for i in ${PAGES}; do echo $$i | sed -E 's/^md\/(.+)\.md/pub\/\1\/index.html/'; done)

.PHONY: all clean

all: pub/index.html ${HTML}

pub/index.html: pub/about/index.html
	cp -p "$<" "$@"

md/share/man.md:
	curl -s https://code.blicky.net/chifs/chifs-share/raw/branch/master/man/chifs-share.md -o "$@"

pub/%/index.html: md/%.md template.html
	mkdir -p `dirname "$@"`
	sed -E 's/(ffprobe|file|mediainfo|mimetype|tor)\(([1-8])\)/[\1(\2)](https:\/\/manned.org\/\1.\2)/g' "$<" \
		| pandoc -f markdown -t html5 --template template.html \
		--metadata path=`echo "$*" | sed 's/\//-/'` \
		--metadata menu=`echo "$*" | sed 's/\/.\+//'` \
		- -o "$@"

clean:
	rm -rf pub/index.html ${HTML} md/share/man.md
	find pub -type d -empty -print -delete