forked from gladiusjs/gladius-core
/
Makefile
71 lines (55 loc) · 2.23 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
#############################################################################################
# NOTES:
#
# This Makefile assumes that you have the following installed, setup:
#
# * node: http://nodejs.org
# * Unixy shell (use msys on Windows)
#
#############################################################################################
GLADIUS := gladius
SRC_DIR := ./src
TEST_DIR := ./test
DIST_DIR := ./dist
EXTERNAL_DIR := ./external
GLADIUS_SRC := $(SRC_DIR)/$(GLADIUS).js
GLADIUS_DIST := $(DIST_DIR)/$(GLADIUS).js
GLADIUS_MIN := $(DIST_DIR)/$(GLADIUS).min.js
TOOLS_DIR := ./tools
DIST_TEST_DIR := $(DIST_DIR)/test
DIST_TOOLS_DIR := $(DIST_DIR)/tools
CORE_FILES := $(SRC_DIR)/gladius.js $(wildcard $(SRC_DIR)/common/*.js) $(wildcard $(SRC_DIR)/core/*.js) $(wildcard $(SRC_DIR)/core/component/*.js)
SUBSYSTEM_FILES := \
compile = node $(TOOLS_DIR)/node_modules/uglify-js/bin/uglifyjs -o $(1) $(GLADIUS_DIST)
complete = cat $(GLADIUS_MIN) > $(1)
jshint = echo "Linting $(1)" ; node $(TOOLS_DIR)/jshint-cmdline.js $(1)
all: $(DIST_DIR) $(GLADIUS_DIST) $(GLADIUS_MIN)
@@echo "Finished, see $(DIST_DIR)"
$(DIST_DIR):
@@echo "Creating $(DIST_DIR)"
@@mkdir $(DIST_DIR)
$(GLADIUS_DIST): $(DIST_DIR) $(GLADIUS_SRC) $(CUBICVR_LIB)
@@echo "Building $(GLADIUS_DIST)"
@@cd $(TOOLS_DIR) && node r.js -o build.js
$(GLADIUS_MIN): $(DIST_DIR) $(GLADIUS_SRC)
@@echo "Building $(GLADIUS_MIN)"
@@$(call compile,$(GLADIUS_MIN))
test: $(DIST_DIR) $(GLADIUS_MIN)
@@echo "Creating tests in $(DIST_TEST_DIR)"
@@mv $(GLADIUS_MIN) $(GLADIUS_DIST)
@@cp -R $(TEST_DIR) $(DIST_DIR)
@@mv $(DIST_TEST_DIR)/index.html.dist $(DIST_TEST_DIR)/index.html
@@mkdir -p $(DIST_TOOLS_DIR)/qunit
@@cp -R $(TOOLS_DIR)/qunit/qunit $(DIST_TOOLS_DIR)/qunit
@@echo "Starting web server in $(DIST_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)) ; )
submodule:
@@git submodule update --init --recursive
@@git submodule status --recursive