-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
77 lines (64 loc) · 1.72 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
66
67
68
69
70
71
72
73
74
75
76
77
JSMIN = jsmin
VBB_MINJS = view-bookmarklets-bookmarklet.min.js
ALL_MINJS = $(VBB_MINJS)
ALL_HTML = view-bookmarklets-bookmarklet.html
GHP_INDEX = view-bookmarklets-bookmarklet.html
OUTPUTS = $(ALL_HTML) $(ALL_MINJS)
all: $(ALL_HTML)
%.html: %.html.in $(ALL_MINJS)
<$< >[email protected] \
sed "s/@VBB_MINJS@/$$( \
sed -e '/^$$/d' \
-e 's/\"/\"/g' \
-e 's|\([&\/]\)|\\\1|g' \
-e '$$q' \
-e 's/$$/\\/' \
"$(VBB_MINJS)")/" && \
mv "[email protected]" "$@"
%.min.js: %.js
<$< >[email protected] \
$(JSMIN) && \
mv "[email protected]" "$@"
clean:
rm -f $(OUTPUTS) $(patsubst %,%.tmp,$(OUTPUTS))
gh-pages:
git clone --shared --branch gh-pages . gh-pages
dirty-check-ghp: gh-pages
@assert_not_dirty() { \
cd "$$1"; \
pf="$${1+($$1)}"; \
git update-index -q --refresh; \
git diff-files --quiet || \
{ echo "$$pf"'Working tree is dirty.'; return 1; }; \
git diff-index --quiet --cached HEAD || \
{ echo "$$pf"'Index is dirty.'; return 1; }; \
return 0; \
}; \
assert_not_dirty && assert_not_dirty gh-pages
update-ghp: dirty-check-ghp $(ALL_HTML)
rev=$$(git rev-parse HEAD) && \
set -- $^ && shift && \
cp "$$@" gh-pages && \
cd gh-pages && \
cp $(GHP_INDEX) index.html && \
git add --update && \
git commit -m 'generated by '"$$rev" && \
git push
lint: do-jslint do-jslint-html
jslint-submods: JSLint jshint
# If you do not want one of these, just mkdir the unwanted one
# beforehand.
#
# If you do not want either of these, then there is no point using
# the lint targets.
JSLint:
git submodule update --init JSLint
jshint:
git submodule update --init jshint
JSHINT=
#JSHINT= --jshint
JSLINT=./jslint-jsc $(JSHINT)
do-jslint: jslint-submods
$(JSLINT) *.js
do-jslint-html: jslint-submods
$(JSLINT) *.html*