forked from openannotation/annotator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
65 lines (48 loc) · 1.53 KB
/
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
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
BROWSERIFY := node_modules/.bin/browserify
UGLIFYJS := node_modules/.bin/uglifyjs
# Check that the user has run 'npm install'
ifeq ($(shell which $(BROWSERIFY) >/dev/null 2>&1; echo $$?), 1)
$(error The 'browserify' command was not found. Please ensure you have run 'npm install' before running make.)
endif
# These are the plugins which are built separately and included in the
# annotator-full build. Not all of the plugins in src/plugin are suited for this
# at the moment.
PLUGINS := \
document \
filter \
unsupported
PLUGINS_PKG := $(patsubst %,pkg/annotator.%.js,$(PLUGINS))
SRC := $(shell find src -type f -name '*.js')
all: annotator plugins annotator-full
annotator: pkg/annotator.min.js
plugins: $(patsubst %.js,%.min.js,$(PLUGINS_PKG))
annotator-full: pkg/annotator-full.min.js
clean:
rm -rf .deps pkg
test:
npm test
develop:
npm start
doc:
cd doc && $(MAKE) html
apidoc: $(patsubst src/%.js,doc/api/%.rst,$(SRC))
doc/api/%.rst: src/%.js
@mkdir -p $(@D)
tools/apidoc $< $@
pkg/%.min.js: pkg/%.js
@echo Writing $@
@$(UGLIFYJS) --preamble "$$(tools/preamble)" $< >$@
pkg/annotator.js: browser.js
@mkdir -p pkg/ .deps/
@$(BROWSERIFY) -s annotator $< >$@
@$(BROWSERIFY) --list $< | \
sed 's#^#$@: #' >.deps/annotator.d
pkg/annotator.%.js: src/plugin/%.js
@mkdir -p pkg/ .deps/
@$(BROWSERIFY) $< >$@
@$(BROWSERIFY) --list $< | \
sed 's#^#$@: #' >.deps/annotator.$*.d
pkg/annotator-full.js: pkg/annotator.js $(PLUGINS_PKG)
@cat $^ > $@
-include .deps/*.d
.PHONY: all annotator plugins annotator-full clean test develop doc