forked from littlstar/axis360
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (92 loc) · 1.61 KB
/
Makefile
File metadata and controls
111 lines (92 loc) · 1.61 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
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
109
110
##
# Current working build directory
#
CWD := $(shell pwd)
##
# Node modules bin directory
#
BIN := node_modules/.bin
##
# Path to `duo' bin file
#
DUO := $(BIN)/duo
##
# CSS source files
#
CSS := *.css
##
# Module source (js, html, json)
#
SRC := $(wildcard *.js)
SRC += $(wildcard projection/*.js)
SRC += $(wildcard geometry/*.js)
SRC += $(wildcard controls/*.js)
SRC += component.json
##
# Main javascript entry
#
MAIN = index.js
##
# Global namespace target
#
GLOBAL_NAMESPACE = Axis
##
# Ensures parent directory is built
#
define BUILD_PARENT_DIRECTORY
mkdir -p $(dir $@)
endef
##
# Builds everything
#
all: build dist doc
##
# Builds all files
#
build: build/build.js build/build.css
##
# Builds javascript and html templates
#
build/build.js: node_modules $(SRC)
$(BUILD_PARENT_DIRECTORY)
$(DUO) -s $(GLOBAL_NAMESPACE) --type js --development < $(MAIN) > $@
##
# Builds CSS source files
#
build/build.css: node_modules $(CSS)
$(BUILD_PARENT_DIRECTORY)
cat $(CSS) | $(DUO) --type css > $@
##
# Builds all dist files
#
dist: dist/axis.js dist/axis.css
##
# Builds javascript dist file
#
dist/axis.js: node_modules $(SRC)
$(BUILD_PARENT_DIRECTORY)
$(DUO) -C --type js -s $(GLOBAL_NAMESPACE) < $(MAIN) > $@
##
# Builds CSS dist file
#
dist/axis.css: node_modules $(CSS)
$(BUILD_PARENT_DIRECTORY)
cat $(CSS) | $(DUO) -C --type css > $@
##
# Builds node modules
#
node_modules: package.json
npm install
##
# Builds documentation
#
doc: node_modules $(SRC)
./scripts/generate_documentation.sh $(CWD) public/doc
##
# Cleans all built files
#
.PHONY: clean
clean:
rm -rf build
rm -rf components
rm -rf node_modules