forked from mprat/Terminus
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
executable file
·108 lines (86 loc) · 3.13 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
NODEJS=nodejs
PYTHON=python3
BUILD_TOOLS=$(realpath ./tools/build)
GAMEDEV_TOOLS=$(realpath ./tools/gamedev)
NODEBIN=${TOOLS}/node_modules/.bin
LANG_REGEX=\(.*\.dialog\.\).*\(\.js\)
LANGS=fr en
SRC=./engine
default: help
# COMPILE #
clean_dist:
rm -r _build
all: build ## Generate all html files in all languages
devenv: ## Source .bash_profile in order to use dev tools
./devenv.sh ${GAME}
lint:
find tools -name '*.py' | xargs pylint3
server:
./tools/start_game_server.sh ${GAME}
build: ## Fully build
for _GAME in $$(ls -d game/$${GAME}*);do \
echo "BUILD $${_GAME}"; \
echo "------------------------------"; \
${BUILD_TOOLS}/build $${_GAME} _build/$$(basename $${_GAME}) -html; \
done
assemble: ## Transform game file into an usable script
for _GAME in $$(ls -d game/$${GAME}*);do \
echo "ASSEMBLE $${_GAME}"; \
echo "------------------------------"; \
DEBUG_SKIP="${DEBUG_SKIP:-nodejs}" ${BUILD_TOOLS}/build $${_GAME} _build/$$(basename $${_GAME}); \
done
update_submodules:
git submodule update --init --recursive
fetch_resources: update_submodules ## Fetch resources
${GAMEDEV_TOOLS}/ogaget --recursive ./game_art -dl
# js: ${TOOLS}/.npm po ## Compress javascript files
# for _LANG in ${LANGS};do \
# _LANG=$${_LANG} make _js; \
# done
#
# _js_transpile: _ensure_dir_js_build
# ${NODEJS} ${NODEBIN}/babel \
# -o ./_build/js/all.${_LANG}.js --presets env \
# `grep '<script ' ./engine/index.html | grep 'src=' | egrep -v 'tests/|<!--|-->' | sed 's/.*src="\([^"]*.js\)".*/.\/src\/\1/;s/${LANG_REGEX}/\1${_LANG}\2/'`
#
# _js: _ensure_build_dir _js_transpile
# ${NODEJS} ${NODEBIN}/uglifyjs \
# ./_build/js/all.${_LANG}.js \
# -o ./_build/js/min.${_LANG}.js -c -m;
#
# _check_polib:
# ${PYTHON} -c "import polib" || pip install polib
_ensure_build_dir:
mkdir -p ./_build
css:
${NODEJS} ${TOOLS}/postcss.js
# html: ## Generate minimal html [usage: _LANG=xx make html]
# ${PYTHON} ${BUILD_TOOLS}/inject ./src/index.html \
# ./_build/min.css ./_build/min.${_LANG}.js \
# ./webroot/terminus.${_LANG}.html
# EXTRA #
# pot: _ensure_build_dir _check_polib ## Generate a pot file from a pofile [usage: _LANG=xx make pot]
# ${PYTHON} ${TOOLS}/potgenfromlang $(or ${_LANG}, fr)
# translatorguide: ## A little guide for new translators
# less src/lang/README
# to_dokuwiki: ## Convert markdown files in wiki_md to wiki_dokuwiki
# find ./wiki_md -name '*.md' | \
# while read i; do \
# TGTDIR="`dirname $${i} | sed 's/_md/_dokuwiki/'`"; \
# mkdir -p $${TGTDIR}; \
# TGT="`basename $${i%\.md}`.txt"; \
# pandoc --from=markdown_github --to=dokuwiki $${i} \
# --output="$${TGTDIR}/$${TGT}";\
# done
testfs: assemble
firefox --jsconsole --safe-mode game/${GAME}/webroot/testing.html?filesystem
test_game:
./tools/run_game_cli.sh ${GAME}
test_game_server: assemble
OPEN_URL_WITH=firefox ./tools/start_game_server.sh ${GAME}
help: ## Show this help
@sed -n \
's/^\(\([a-zA-Z_-]\+\):.*\)\?#\(#\s*\([^#]*\)$$\|\s*\(.*\)\s*#$$\)/\2=====\4=====\5/p' \
$(MAKEFILE_LIST) | \
awk 'BEGIN {FS = "====="}; {printf "\033[1m%-4s\033[4m\033[36m%-14s\033[0m %s\n", $$3, $$1, $$2 }' | \
sed 's/\s\{14\}//'