-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
70 lines (54 loc) · 1.77 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
KSP_MAIN_DIR := ~/Library/Application\ Support/Steam/steamapps/common/Kerbal\ Space\ Program
KSP_SCRIPT_DIR := ${KSP_MAIN_DIR}/Ships/Script
KOS_SCRIPT_BASEDIR := ~/Projects/kos-scripts
KOS_SOURCE_DIR := ${KOS_SCRIPT_BASEDIR}/source
KOS_MINIFY_DIR := ${KOS_SCRIPT_BASEDIR}/minified
KOS_SCRIPT_DIR := ${KOS_MINIFY_DIR}
KSX_INCLUDES := -I source/
PYTHON := python3
test:
@pipenv run pytest
clean:
@cd minified && git clean -fxdq
report-size:
@echo "Before minification..."
@wc -c source/**/*.{ks,ksx}
@echo "\n----\n"
@echo "After minification..."
@wc -c minified/**/*.ks
report-size-single-file: guard-FILE
@echo "Before minification..."
@wc -c ./source/${FILE}
@echo "\n----\n"
@echo "After minification..."
@wc -c ./minified/${FILE}
transpile-only-all:
@echo "Transpiling all source files, no optimizations..."
@${PYTHON} ksx.py --nuke --transpile-only --all-files ${KSX_INCLUDES}
@make report-size
@make link
compile-all:
@echo "Compiling all source files..."
@${PYTHON} ksx.py --nuke --all-files ${KSX_INCLUDES}
@make report-size
@make link
link:
@echo "Linking minified files into Ships/Script..."
@ln -sf ${KOS_MINIFY_DIR}/boot ${KSP_SCRIPT_DIR}
@ln -sf ${KOS_MINIFY_DIR}/actions ${KSP_SCRIPT_DIR}
@ln -sf ${KOS_MINIFY_DIR}/lib ${KSP_SCRIPT_DIR}
telnet:
@telnet localhost 5410
push-action: guard-ACTION guard-TARGET
@make link
@echo "Pushing ${ACTION} to vessel(s) ${TARGET}..."
@cp ${KOS_SCRIPT_DIR}/actions/${ACTION}.ks ${KSP_SCRIPT_DIR}/${TARGET}-update.ks
push-mission: guard-MISSION guard-TARGET
@make link
@echo "Pushing ${MISSION} to vessel(s) ${TARGET}..."
@cp ${KOS_SCRIPT_DIR}/missions/${MISSION}.ks ${KSP_SCRIPT_DIR}/${TARGET}-update.ks
guard-%:
@if [ "${${*}}" = "" ]; then \
echo "Required environment variable $* not set"; \
exit 1; \
fi