forked from rolandoam/ChesterGL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
107 lines (88 loc) · 3.92 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
# NOTE
# if you want to define your own paths, copy developer.template.mk to developer.mk and modify that
# please do not modify anything in this makefile unless is really necesary
#
-include developer.mk
JAVA ?= /usr/bin/java
CLOSURE_HOME ?= /Applications/closure-compiler
CLOSURE_LIBRARY ?= /Applications/closure-library
CLOSURE_JAR = compiler.jar
OUTPUT_DIR ?= ${PWD}/html
# default name for library
OUTPUT_FILE = chester.js
EXTERNAL_SOURCES =
SOURCES = ${EXTERNAL_SOURCES} chesterGL/core.js chesterGL/block.js chesterGL/blockFrames.js chesterGL/blockGroup.js chesterGL/actions.js chesterGL/tmxBlock.js chesterGL/GPUParticleSystem.js chesterGL/primitivesBlock.js chesterGL/labelBlock.js chesterGL/bmFontLabelBlock.js
# externs should live in the same dir as the compiler.jar
EXTERNS = jquery-1.7.js webkit_console.js google_analytics_api.js json.js
COMPILE_LEVEL_RELEASE = ADVANCED_OPTIMIZATIONS
COMPILE_LEVEL_DEBUG = ${COMPILE_LEVEL_RELEASE}
# the next line just for docs
JSDOC_HOME ?= ${HOME}/Applications/jsdoc-toolkit
DOC_OUTPUT = doc
# do not modify after this line unless you know what you're doing
JS_SOURCES = $(foreach i,${SOURCES},-i $i)
EXTERNS_TMP = $(foreach i,${EXTERNS},--externs ${CLOSURE_HOME}/$i)
COMPILER_ARGUMENTS = ${EXTERNS_TMP} --language_in=ECMASCRIPT5_STRICT --warning_level=VERBOSE --jscomp_warning=checkTypes --summary_detail_level=3
compile: flags
${CLOSURE_LIBRARY}/closure/bin/build/closurebuilder.py --root ${CLOSURE_LIBRARY} \
--output_mode=compiled \
--output_file=$(OUTPUT_DIR)/$(OUTPUT_FILE) \
--compiler_jar=$(CLOSURE_HOME)/$(CLOSURE_JAR) \
--root=chesterGL/ \
--compiler_flags="--flagfile=release.flags" \
${JS_SOURCES}
deps:
${CLOSURE_LIBRARY}/closure/bin/build/closurebuilder.py --root ${CLOSURE_LIBRARY} \
--output_mode=list \
--root=chesterGL/ \
${JS_SOURCES}
flags:
echo $(COMPILER_ARGUMENTS) > release.flags
echo "--externs deps.js" >> release.flags
echo "--compilation_level $(COMPILE_LEVEL_DEBUG)" >> release.flags
echo "--create_source_map=$(OUTPUT_DIR)/$(OUTPUT_FILE).map" >> release.flags
debug_flags:
echo $(COMPILER_ARGUMENTS) > debug.flags
echo "--externs deps.js" >> debug.flags
echo "--compilation_level $(COMPILE_LEVEL_DEBUG)" >> debug.flags
echo "--formatting PRETTY_PRINT" >> debug.flags
echo "-D ENABLE_DEBUG=1" >> debug.flags
echo "--create_source_map=$(OUTPUT_DIR)/$(OUTPUT_FILE).map" >> debug.flags
echo "--source_map_format=V3" >> debug.flags
debug: debug_flags
${CLOSURE_LIBRARY}/closure/bin/build/closurebuilder.py --root ${CLOSURE_LIBRARY} \
--output_mode=compiled \
--output_file=$(OUTPUT_DIR)/$(OUTPUT_FILE) \
--compiler_jar=$(CLOSURE_HOME)/$(CLOSURE_JAR) \
--root=chesterGL/ \
--compiler_flags="--flagfile=debug.flags" \
${JS_SOURCES}
# adds source map support!
echo "//@ sourceMappingURL=chester.js.map" >> $(OUTPUT_DIR)/$(OUTPUT_FILE)
cp html/chester.js html/scripts/chester.js
release: compile
mkdir -p release
cat LICENSE > release/chester.min.js
cat html/chester.js >> release/chester.min.js
cp README.md release/README.md
zip -r chesterGL-latest.zip release
mv chesterGL-latest.zip html/
# just cat everything into chester.js (when debugging is getting hard)
debug-plain:
cat ${SOURCES} > $(OUTPUT_DIR)/$(OUTPUT_FILE)
clean:
rm -f "$(OUTPUT_DIR)/$(OUTPUT_FILE)" "$(OUTPUT_DIR)/$(OUTPUT_FILE).map"
fetch-externs:
$(foreach i,${EXTERNS},curl -o ${CLOSURE_HOME}/$i http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/$i;)
doc: ${SOURCES}
${JAVA} -jar ${JSDOC_HOME}/jsrun.jar ${JSDOC_HOME}/app/run.js -w -version 170 -v -a -t=${JSDOC_HOME}/templates/jsdoc ${SOURCES} -d=${DOC_OUTPUT}
mkdir -p doc/test
cp html/test_* doc/test/
cp html/*.css doc/test/
cp -r html/images doc/test/
cp -r html/shaders doc/test/
cp -r html/externals doc/test/
cp -r html/index.html doc/test/
cp -r html/chester.js doc/test/
server:
ruby -rwebrick -e's = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => "${OUTPUT_DIR}"); trap("INT"){ s.shutdown }; s.start'