/
makefile
82 lines (74 loc) · 3 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
# To run this makefile, you must do the following.
#
# 1.) Download http://closure-compiler.googlecode.com/files/compiler-latest.zip
# and place compiler.jar within the tools directory.
#
# 2.) Install closure-linter tool at by following
# http://code.google.com/closure/utilities/docs/linter_howto.html
#
# 3.) Download the JSDoc toolkit found at
# http://code.google.com/p/jsdoc-toolkit and place the jsdoc-toolkit
# directory within the tools directory.
# Create the list of files
files = src/minplayer.compatibility.js\
src/minplayer.async.js\
src/minplayer.flags.js\
src/minplayer.plugin.js\
src/minplayer.display.js\
src/minplayer.js\
src/minplayer.image.js\
src/minplayer.file.js\
src/minplayer.playLoader.js\
src/minplayer.players.base.js\
src/minplayer.players.dailymotion.js\
src/minplayer.players.html5.js\
src/minplayer.players.flash.js\
src/minplayer.players.minplayer.js\
src/minplayer.players.youtube.js\
src/minplayer.players.vimeo.js\
src/minplayer.players.limelight.js\
src/minplayer.players.kaltura.js\
src/minplayer.controller.js
.DEFAULT_GOAL := all
all: jslint js jsdoc
# Perform a jsLint on all the files.
jslint: ${files}
jshint $^
# Create an aggregated js file and a compressed js file.
js: ${files}
@curl https://raw.github.com/sindresorhus/screenfull.js/v1.1.1/dist/screenfull.min.js > bin/screenfull.min.js
@echo "Creating minplayer.display.js"
@mv src/minplayer.display.js src/minplayer.display.tmp.js
@echo "minplayer = minplayer || {};" > src/minplayer.display.js
@echo "(function(exports) {" >> src/minplayer.display.js
@cat bin/screenfull.min.js >> src/minplayer.display.js
@echo "exports.screenfull = screenfull;" >> src/minplayer.display.js
@echo "})(minplayer);" >> src/minplayer.display.js
@cat src/minplayer.display.tmp.js >> src/minplayer.display.js
@rm src/minplayer.display.tmp.js
@rm bin/screenfull.min.js
@echo "Generating aggregated bin/minplayer.js file"
@cat > bin/minplayer.js $^
@echo "Generating compressed bin/minplayer.compressed file"
curl -s \
-d compilation_level=SIMPLE_OPTIMIZATIONS \
-d output_format=text \
-d output_info=compiled_code \
--data-urlencode "js_code@bin/minplayer.js" \
http://closure-compiler.appspot.com/compile \
> bin/minplayer.compressed.js
# Create the documentation from source code.
jsdoc: ${files}
@echo "Generating documetation."
@java -jar tools/jsdoc-toolkit/jsrun.jar tools/jsdoc-toolkit/app/run.js -a -t=tools/jsdoc-toolkit/templates/jsdoc -d=doc $^
# Fix the js style on all the files.
fixjsstyle: ${files}
fixjsstyle $^
# Install the necessary tools.
tools:
wget http://jsdoc-toolkit.googlecode.com/files/jsdoc_toolkit-2.4.0.zip -P tools
unzip tools/jsdoc_toolkit-2.4.0.zip -d tools
mv tools/jsdoc_toolkit-2.4.0/jsdoc-toolkit tools/jsdoc-toolkit
rm -rd tools/jsdoc_toolkit-2.4.0
rm tools/jsdoc_toolkit-2.4.0.zip
npm install jshint