-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
120 lines (87 loc) · 2.71 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
###############################################################################################
# Olives http://flams.github.com/olives
# The MIT License (MIT)
# Copyright (c) 2012-2013 Olivier Scherrer <pode.fr@gmail.com>
#
# Targets:
#
# make tests: runs the JsTestDriver tests
#
# make docs: generates the documentation into docs/latest
# make build: generates Olives.js and Olives.min.js as they appear in the release
#
# make all: tests + docs + build
#
# make release VERSION=x.x.x: make all, then creates the package and pushes to github
#
# make gh-pages VERSION=x.x.x: generates the web site with latest version and pushes to github
#
################################################################################################
SRC := $(wildcard src/*.js)
JsTestDriver = $(shell find tools -name "JsTestDriver-*.jar" -type f)
all: tests docs build
clean-docs:
-rm -rf docs/latest/
clean-build:
-rm -rf build/
clean-temp:
rm -f temp.js
docs: clean-docs
java -jar tools/JsDoc/jsrun.jar \
tools/JsDoc/app/run.js src \
-r=2 \
-d=docs/latest/ \
-t=tools/JsDoc/templates/jsdoc
tests: temp.js
java -jar $(JsTestDriver) \
--tests all \
--reset
jshint:
jshint src/*.js specs/*.js
build: clean-build Olives.js
cp LICENSE build/
cp -rf src/ build/src/
release: all
ifndef VERSION
@echo "You must give a VERSION number to make release"
@exit 2
endif
mkdir -p release/tmp/Olives-$(VERSION)
cp -rf build/* release/tmp/Olives-$(VERSION)
cd release/tmp/Olives-$(VERSION); \
sed -i .bak 's#<VERSION>#'$(VERSION)'#' Olives.js Olives.min.js; \
rm Olives.js.bak Olives.min.js.bak
cd release/tmp/; \
tar czf ../Olives-$(VERSION).tgz Olives-$(VERSION)
rm -rf release/tmp/
cp -rf docs/latest/ docs/$(VERSION)/
git add build docs release
git commit -am "released version $(VERSION)"
git push
git tag $(VERSION)
git push --tags
temp.js: clean-temp
r.js -o tools/build.js
Olives.js: temp.js
mkdir -p build
cat LICENSE-MINI temp.js > build/$@
java -jar tools/GoogleCompiler/compiler.jar \
--js build/Olives.js \
--js_output_file build/Olives.min.js \
--create_source_map build/Olives-map
clean: clean-build clean-docs clean-temp
gh-pages:
ifndef VERSION
@echo "You must give a VERSION number to make gh-pages"
@exit 2
endif
git checkout gh-pages
git checkout master build Makefile docs src specs tools lib release
git add build docs src specs tools lib release
sed -i .bak 's#version">.*<#version">'${VERSION}'<#g' index.html
sed -i .bak 's#<a href="release/Olives.*\.tgz">#<a href="release/Olives-'${VERSION}'.tgz">#' index.html
rm index.html.bak
git commit -am "updated to $(VERSION)"
git push
git checkout master
.PHONY: docs clean-docs clean-build build tests release clean gh-pages jshint