forked from ether/etherpad-lite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
32 lines (25 loc) · 849 Bytes
/
Makefile
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
doc_sources = $(wildcard doc/*/*.md) $(wildcard doc/*.md)
outdoc_files = $(addprefix out/,$(doc_sources:.md=.html))
docassets = $(addprefix out/,$(wildcard doc/assets/*))
VERSION = $(shell node -e "console.log( require('./src/package.json').version )")
UNAME := $(shell uname -s)
ensure_marked_is_installed:
set -eu; \
hash npm; \
if [ $(shell npm list --prefix src/bin/doc >/dev/null 2>/dev/null; echo $$?) -ne "0" ]; then \
npm ci --prefix=src/bin/doc; \
fi
docs: ensure_marked_is_installed $(outdoc_files) $(docassets)
out/doc/assets/%: doc/assets/%
mkdir -p $(@D)
cp $< $@
out/doc/%.html: doc/%.md
mkdir -p $(@D)
node src/bin/doc/generate.js --format=html --template=doc/template.html $< > $@
ifeq ($(UNAME),Darwin)
sed -i '' 's/__VERSION__/${VERSION}/' $@
else
sed -i 's/__VERSION__/${VERSION}/' $@
endif
clean:
rm -rf out/