This repository has been archived by the owner on Sep 25, 2018. It is now read-only.
/
Makefile
154 lines (103 loc) · 6.36 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
build = build
csdir = src/main/coffeescript
coffee := $(shell find $(csdir) -name "*.coffee")
coffeejs = $(patsubst $(csdir)/%.coffee,$(build)/%.js, $(coffee))
#TODO: generate these conditionally so we can compare the overhead induced by this version
extraModelXSLArgs = --param genDepth "true()" --param genAncestors "true()" --param genDescendants "true()" --param genLCA "true()"
testdir = src/test
buildtestdir = $(build)/test
scxmltests := $(shell find $(testdir) -name "*.scxml")
nonTransformedScxmlJson = $(patsubst $(testdir)/%.scxml,$(buildtestdir)/%.scxml.json, $(scxmltests))
buildtransformdir = $(build)/transform
buildFlattenedTransitionsDir = $(buildtransformdir)/flattened-transitions
flattenedSCXMLTests = $(patsubst $(testdir)/%.scxml,$(buildFlattenedTransitionsDir)/%.scxml, $(scxmltests))
flattenedTransitionsSCXMLJson = $(patsubst $(buildFlattenedTransitionsDir)/%.scxml,$(buildtestdir)/%.flattened-transitions.scxml.json, $(flattenedSCXMLTests))
#all scxmljson files (both flattened and non-flattened)
scxmljson = $(sort $(nonTransformedScxmlJson) $(flattenedTransitionsSCXMLJson))
scxmljsontuple = $(patsubst $(buildtestdir)/%.scxml.json,$(buildtestdir)/%.js, $(scxmljson))
#optimization variables
buildopt = $(build)/opt
tsel = $(buildopt)/transition-selection
tsel_class = $(patsubst $(buildtestdir)/%.scxml.json,$(tsel)/%.class.js, $(scxmljson))
tsel_switch = $(patsubst $(buildtestdir)/%.scxml.json,$(tsel)/%.switch.js, $(scxmljson))
tsel_table = $(patsubst $(buildtestdir)/%.scxml.json,$(tsel)/%.table.js, $(scxmljson))
spartanLoader = $(build)/spartanLoaderForAllTests.js
#paths to some scripts
scxmltojson = src/main/bash/util/scxml-to-json.sh
generatetesttuple = src/main/bash/build/generate-requirejs-json-test-tuples.sh
generatetestloadermodule = src/main/bash/build/generate-requirejs-test-loader-module.sh
generateArrayTestLoaderModule = src/main/bash/build/generate-requirejs-array-test-loader-module.sh
.PHONY: clean coffee scxml2json copy-others combine-json-and-scxml-tests gen-spartan-loader gen-class-transition-lookup-optimization gen-table-transition-lookup-optimization gen-switch-transition-lookup-optimization gen-transition-lookup-optimization gen-state-configuration-set-optimization gen-transition-configuration-set-optimization gen-model-caching-optimization gen-transformed-statecharts gen-ahead-of-time-optimizations gen-top-level-optimized-requirejs-modules
coffee : $(coffeejs)
all : all-tests scion gen-top-level-optimized-requirejs-modules gen-transition-lookup-optimization gen-optimization-loaders gen-optimization-array-loaders gen-spartan-loader
clean:
rm -rf $(build)
build:
mkdir $(build)
$(build)/%.js : $(csdir)/%.coffee
coffee -o $(dir $@) $<
flatten-transitions-scxml-tests: $(flattenedSCXMLTests)
$(buildFlattenedTransitionsDir)/%.scxml : $(testdir)/%.scxml
mkdir -p $(dir $@)
xsltproc src/main/xslt/flattenTransitions.xsl $< > $@
scxml2json : $(scxmljson)
$(buildtestdir)/%.flattened-transitions.scxml.json : $(buildFlattenedTransitionsDir)/%.scxml
mkdir -p $(dir $@)
$(scxmltojson) $< $(extraModelXSLArgs) > $@
$(buildtestdir)/%.scxml.json : $(testdir)/%.scxml
mkdir -p $(dir $@)
$(scxmltojson) $< $(extraModelXSLArgs) > $@
copy-others : build
cp -r lib/js/ $(build)/lib/
cp -r src/main/javascript/* $(build)
cp -r src/main/xslt $(build)
combine-json-and-scxml-tests : $(scxmljsontuple)
$(buildtestdir)/%.flattened-transitions.js : $(buildtestdir)/%.flattened-transitions.scxml.json $(testdir)/%.json
$(generatetesttuple) $^ "$(basename $(basename $(notdir $<)))" "$(shell basename $(shell dirname $<))" > $@
$(buildtestdir)/%.js : $(buildtestdir)/%.scxml.json $(testdir)/%.json
$(generatetesttuple) $^ "$(basename $(basename $(notdir $<)))" "$(shell basename $(shell dirname $<))" > $@
gen-spartan-loader : $(spartanLoader)
$(spartanLoader) :
$(generatetestloadermodule) $@ $(scxmljsontuple)
$(tsel)/%.class.js : $(buildtestdir)/%.scxml.json coffee copy-others
mkdir -p $(dir $@)
./bin/run-module-node.sh scxml/optimization/transition-optimizer $< class true true > $@
$(tsel)/%.switch.js : $(buildtestdir)/%.scxml.json coffee copy-others
mkdir -p $(dir $@)
./bin/run-module-node.sh scxml/optimization/transition-optimizer $< switch true true > $@
$(tsel)/%.table.js : $(buildtestdir)/%.scxml.json coffee copy-others
mkdir -p $(dir $@)
./bin/run-module-node.sh scxml/optimization/transition-optimizer $< table true true > $@
gen-class-transition-lookup-optimization : $(tsel_class)
gen-table-transition-lookup-optimization : $(tsel_table)
gen-switch-transition-lookup-optimization : $(tsel_switch)
$(build)/class-transition-lookup-optimization-loader.js :
$(generatetestloadermodule) $@ $(tsel_class)
$(build)/table-transition-lookup-optimization-loader.js :
$(generatetestloadermodule) $@ $(tsel_table)
$(build)/switch-transition-lookup-optimization-loader.js :
$(generatetestloadermodule) $@ $(tsel_switch)
$(build)/class-transition-lookup-optimization-array-loader.js :
$(generateArrayTestLoaderModule) $@ $(tsel_class)
$(build)/table-transition-lookup-optimization-array-loader.js :
$(generateArrayTestLoaderModule) $@ $(tsel_table)
$(build)/switch-transition-lookup-optimization-array-loader.js :
$(generateArrayTestLoaderModule) $@ $(tsel_switch)
gen-optimization-array-loaders : $(build)/switch-transition-lookup-optimization-array-loader.js $(build)/table-transition-lookup-optimization-array-loader.js $(build)/class-transition-lookup-optimization-array-loader.js
gen-optimization-loaders : $(build)/class-transition-lookup-optimization-loader.js $(build)/table-transition-lookup-optimization-loader.js $(build)/switch-transition-lookup-optimization-loader.js
gen-transition-lookup-optimization : gen-class-transition-lookup-optimization gen-table-transition-lookup-optimization gen-switch-transition-lookup-optimization
gen-state-configuration-set-optimization :
#bit-vector-set
#binary-array-set
gen-transition-configuration-set-optimization :
#bit-vector-set
#binary-array-set
gen-model-caching-optimization :
gen-transformed-statecharts :
#flatten transitions
#flatten orthogonal states
gen-ahead-of-time-optimizations : gen-transformed-statecharts gen-model-caching-optimization gen-transition-configuration-set-optimization gen-transition-lookup-optimization
gen-top-level-optimized-requirejs-modules : gen-ahead-of-time-optimizations
#call script to make the module
scion : copy-others coffee
all-tests : $(scxmljsontuple)