aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: cc002c540dba6bdf136830bd5cb75b2e19036d79 (plain)
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
VERSION = $(shell cat package.json | sed -n 's/.*"version": "\([^"]*\)",/\1/p')

define BANNER
/*
 * SystemJS v$(VERSION)
 */
endef
export BANNER

define POLYFILLS_BANNER
/*
 * SystemJS Promise Polyfill
 */
endef
export POLYFILLS_BANNER

define STANDARD_VERSION

System.version = '$(VERSION) Standard';
endef
export STANDARD_VERSION

define REGISTER_VERSION

System.version = '$(VERSION) Register Only';
endef
export REGISTER_VERSION

define CSP_VERSION

System.version = '$(VERSION) CSP';
endef
export CSP_VERSION

compile: clean-compile dist/system.src.js dist/system.perf.js dist/system-csp-production.src.js dist/system-register-only.src.js
build: clean dist/system.js dist/system-csp-production.js dist/system-register-only.js dist/system-polyfills.js

version:
	@echo $(VERSION)

footprint: build
	@cat dist/system.js | gzip -9f | wc -c
	@cat dist/system-csp-production.js | gzip -9f | wc -c
	@cat dist/system-register-only.js | gzip -9f | wc -c
	@cat dist/system-polyfills.js | gzip -9f | wc -c

clean-compile:
	@rm -f dist/system.src.js dist/system.perf.js dist/system-csp-production.src.js

clean:
	@rm -f dist/*

test: compile
	open test/test-traceur.html test/test-traceur-runtime.html
	sleep 0.1
	open test/test-babel.html test/test-babel-runtime.html
	sleep 0.1
	open test/test-typescript.html
	sleep 0.1
	open test/test-csp.html test/test-tracer.html

dist/system-polyfills.js: dist/system-polyfills.src.js
	cd dist && ../node_modules/.bin/uglifyjs $(subst dist/,,$<) --compress drop_console --preamble "$$POLYFILLS_BANNER" --mangle --source-map system-polyfills.js.map >> $(subst dist/,,$@) || rm $(subst dist/,,$@)

dist/%.js: dist/%.src.js
	cd dist && ../node_modules/.bin/uglifyjs $(subst dist/,,$<) --compress drop_console --preamble "$$BANNER" --mangle --source-map $*.js.map >> $(subst dist/,,$@) || rm $(subst dist/,,$@)

dist/system.src.js: lib/*.js
	( echo "$$BANNER"; \
		cat \
			lib/wrapper-start.js \
			lib/url-polyfill.js \
			lib/loader-wrapper-start.js \
				lib/system-fetch.js \
				lib/legacy-transpiler.js \
				lib/proto.js \
				lib/global-eval.js \
				lib/core.js \
				lib/package.js \
				lib/scriptLoader.js \
				lib/register.js \
				lib/esm.js \
				lib/global.js \
				lib/global-helpers.js \
				lib/cjs.js \
				lib/cjs-helpers.js \
				lib/amd-helpers.js \
				lib/amd.js \
				lib/plugins.js \
				lib/conditionals.js \
				lib/alias.js \
				lib/meta.js \
				lib/bundles.js \
				lib/depCache.js \
				lib/createSystem.js \
				; echo "$$STANDARD_VERSION" ; cat \
			lib/loader-wrapper-end.js \
			lib/wrapper-end.js \
	) > $@;

dist/system.perf.js: lib/*.js
	( echo "$$BANNER"; \
		cat \
			lib/wrapper-start.js \
			lib/url-polyfill.js \
			lib/loader-wrapper-start.js \
				lib/legacy-transpiler.js \
				lib/proto.js \
				lib/perf.js \
				lib/global-eval.js \
				lib/core.js \
				lib/package.js \
				lib/scriptLoader.js \
				lib/register.js \
				lib/esm.js \
				lib/global.js \
				lib/global-helpers.js \
				lib/cjs.js \
				lib/cjs-helpers.js \
				lib/amd-helpers.js \
				lib/amd.js \
				lib/plugins.js \
				lib/conditionals.js \
				lib/alias.js \
				lib/meta.js \
				lib/bundles.js \
				lib/depCache.js \
				lib/createSystem.js \
				; echo "$$STANDARD_VERSION" ; cat \
			lib/loader-wrapper-end.js \
			lib/wrapper-end.js \
	) > $@;

dist/system-csp-production.src.js: lib/*.js
	( echo "$$BANNER"; \
		cat \
			lib/wrapper-start.js \
			lib/url-polyfill.js \
			lib/loader-wrapper-start.js \
				lib/proto.js \
				lib/system-fetch.js \
				lib/core.js \
				lib/package.js \
				lib/scriptLoader.js \
				lib/register.js \
				lib/global-helpers.js \
				lib/cjs-helpers.js \
				lib/amd-helpers.js \
				lib/plugins.js \
				lib/conditionals.js \
				lib/alias.js \
				lib/meta.js \
				lib/bundles.js \
				lib/depCache.js \
				lib/scriptOnly.js \
				lib/createSystem.js \
				; echo "$$CSP_VERSION" ; cat \
			lib/loader-wrapper-end.js \
			lib/wrapper-end.js \
	) > $@;

dist/system-register-only.src.js: lib/*.js
	( echo "$$BANNER"; \
		cat \
			lib/url-polyfill.js \
			lib/loader-wrapper-start.js \
				lib/proto.js \
				lib/system-only-resolve.js \
				lib/scriptLoader.js \
				lib/register.js \
				lib/bundles.js \
				lib/scriptOnly.js \
				lib/createSystem.js \
				; echo "$$REGISTER_VERSION" ; cat \
			lib/loader-wrapper-end.js \
	) > $@;

dist/system-polyfills.src.js: lib/*.js
	( echo "$$POLYFILLS_BANNER"; \
		echo "(function(define) {"; \
		echo ""; \
		cat \
			node_modules/when/es6-shim/Promise.js \
			lib/polyfills-bootstrap.js; \
		echo "})();" \
	) > $@;