Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (57 loc) · 1.98 KB
/
Copy pathMakefile
File metadata and controls
71 lines (57 loc) · 1.98 KB
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
# A simple make file for Peasant Simulator
#
# This make file depends on two environment variables for locating the Closure
# installation. The first is ${CLOSURE_ROOT} which should point to the base of
# the closure library. The base of the closure library contains both a closure/
# and a third_party/ folder.
#
# The second required environment variable is ${CLOSURE_COMPILER} which points
# to a copy of Closure's compiler.jar file.
NAMESPACE=rl
SRC_DIR=src
OUT_DIR=build
GEN_DIR=gen
THIRD_PARTY=third_party
CSS_DIR=${SRC_DIR}/css
HTML_DIR=${SRC_DIR}/html
JS_DIR=${SRC_DIR}/js
EXTERN_DIR=externs/
SRCS_JS=${JS_DIR}/*.js
SRCS_CSS=${CSS_DIR}/*.less
SRCS_HTML=${HTML_DIR}/*.html
EXTERNS_FLAGS=`echo ${EXTERN_DIR}/*.js | sed -r 's/(^| )/\1--compiler_flags=--externs=/g'`
DEPLOY_JS=${GEN_DIR}/deploy.js
DEPLOY_CSS=${GEN_DIR}/styles.css
CLOSURE_BUILDER=python ${CLOSURE_ROOT}/closure/bin/build/closurebuilder.py
# If the ${DEBUG} environment variable is set, then build in script mode.
# Otherwise, build in optimized mode.
COMPILE_MODE=`if [ "${DEBUG}" ]; then echo 'script'; else echo 'compiled'; fi`
deploy : ${OUT_DIR}
# Generates a directory structure in ${OUT_DIR} that can be deployed to the HTTP
# server that hosts the App.
${OUT_DIR} : ${DEPLOY_JS} ${DEPLOY_CSS} ${SRCS_HTML}
mkdir -p ${OUT_DIR}
cp ${DEPLOY_JS} ${OUT_DIR}
cp ${DEPLOY_CSS} ${OUT_DIR}
cp -R ${HTML_DIR}/* ${OUT_DIR}
cp ${THIRD_PARTY}/* ${OUT_DIR}
${DEPLOY_JS} : ${SRCS_JS}
mkdir -p ${GEN_DIR}
${CLOSURE_BUILDER} \
--root=${CLOSURE_ROOT} \
--root=${JS_DIR} \
--namespace=${NAMESPACE} \
--output_mode=${COMPILE_MODE} \
--compiler_flags=--warning_level=VERBOSE \
--compiler_flags=--compilation_level=ADVANCED_OPTIMIZATIONS \
${EXTERNS_FLAGS} \
--compiler_jar=${CLOSURE_COMPILER} > ${DEPLOY_JS}
# || rm ${DEPLOY_JS}
${DEPLOY_CSS} : ${SRCS_CSS}
mkdir -p ${GEN_DIR}
lessc -x ${SRCS_CSS} > ${DEPLOY_CSS}
clean-gen :
rm -Rf ${GEN_DIR}
clean-out :
rm -Rf ${OUT_DIR}
clean : clean-gen clean-out