forked from gladiusjs/gladius-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (55 loc) · 2.17 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
#############################################################################################
# NOTES:
#
# This Makefile assumes that you have the following installed, setup:
#
# * node: http://nodejs.org
# * Unixy shell (use msys on Windows)
#
#############################################################################################
PALADIN := paladin
SRC_DIR := ./src
DIST_DIR := ./dist
EXTERNAL_DIR := ./external
PALADIN_SRC := $(SRC_DIR)/$(PALADIN).js
PALADIN_DIST := $(DIST_DIR)/$(PALADIN).js
PALADIN_MIN := $(DIST_DIR)/$(PALADIN).min.js
TOOLS_DIR := ./tools
TESTS_DIR := $(DIST_DIR)/test
CUBICVR_LIB := $(EXTERNAL_DIR)/CubicVR.js/dist/CubicVR.js
CORE_FILES := $(SRC_DIR)/paladin.js $(wildcard $(SRC_DIR)/core/*.js) $(wildcard $(SRC_DIR)/input/*.js)
SUBSYSTEM_FILES := \
$(SRC_DIR)/dummy.js \
$(SRC_DIR)/graphics/cubicvr.js \
$(SRC_DIR)/sound/default.js \
$(SRC_DIR)/physics/default.js
compile = node $(TOOLS_DIR)/node_modules/uglify-js/bin/uglifyjs -o $(1) $(PALADIN_DIST)
complete = cat $(PALADIN_MIN) $(CUBICVR_LIB) > $(1)
jshint = echo "Linting $(1)" ; node $(TOOLS_DIR)/jshint-cmdline.js $(1)
all: $(DIST_DIR) $(PALADIN_DIST) $(PALADIN_MIN)
@@echo "Finished, see $(DIST_DIR)"
$(CUBICVR_LIB):
@@echo "Creating $(CUBICVR_LIB)"
@@cd $(EXTERNAL_DIR)/CubicVR.js && make
$(DIST_DIR):
@@echo "Creating $(DIST_DIR)"
@@mkdir $(DIST_DIR)
$(PALADIN_DIST): $(DIST_DIR) $(PALADIN_SRC) $(CUBICVR_LIB)
@@echo "Building $(PALADIN_DIST)"
@@cd $(TOOLS_DIR) && node r.js -o build.js
$(PALADIN_MIN): $(DIST_DIR) $(PALADIN_SRC)
@@echo "Building $(PALADIN_MIN)"
@@$(call compile,$(PALADIN_MIN))
tests: $(DIST_DIR) $(PALADIN_MIN)
@@echo "Creating tests in $(TESTS_DIR)"
@@mv $(PALADIN_MIN) $(PALADIN_DIST)
@@cp -R $(SRC_DIR)/tests $(TESTS_DIR)
@@echo "Starting web server in $(TESTS_DIR), browse to http://localhost:9914/ (ctrl+c to stop)..."
@@cd $(DIST_DIR) && python ../$(TOOLS_DIR)/test_server.py
clean:
@@rm -fr $(DIST_DIR)
check-lint: check-lint-core check-lint-subsystems
check-lint-core:
@@$(foreach corefile,$(CORE_FILES),echo "-----" ; $(call jshint,$(corefile)) ; )
check-lint-subsystems:
@@$(foreach subsystem,$(SUBSYSTEM_FILES),echo "-----" ; $(call jshint,$(subsystem)) ; )