forked from sagemathinc/cowasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
146 lines (105 loc) · 2.66 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
BUILT = dist/.built
CWD = $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
CORE = $(dir $(shell ls core/*/Makefile))
PYTHON = $(dir $(shell ls python/*/Makefile))
WEB = $(dir $(shell ls web/*/Makefile))
DESKTOP = $(dir $(shell ls desktop/*/Makefile))
SAGEMATH = $(dir $(shell ls sagemath/*/Makefile))
ALL = ${CORE} ${PYTHON} ${WEB} ${DESKTOP} ${SAGEMATH}
export PATH := ${CWD}/bin:${CWD}/core/zig/dist:$(PATH)
all: packages
# All
.PHONY: packages
packages:
./bin/make-all all ${ALL}
.PHONY: test-packages
test-packages: packages
./bin/make-all test ${ALL}
.PHONY: clean-packages
clean-packages:
./bin/make-all clean ${ALL}
# Core
.PHONY: core
core:
./bin/make-all all ${CORE}
.PHONY: test-core
test-core: core
./bin/make-all test ${CORE}
.PHONY: clean-core
clean-core:
./bin/make-all clean ${CORE}
# Python
.PHONY: python
python:
./bin/make-all all ${PYTHON}
.PHONY: test-python
test-python: python
./bin/make-all test ${PYTHON}
.PHONY: clean-python
clean-python:
./bin/make-all clean ${PYTHON}
# Web
.PHONY: web
web:
./bin/make-all all ${WEB}
.PHONY: test-web
test-web: web
./bin/make-all test ${WEB}
.PHONY: clean-web
clean-web:
./bin/make-all clean ${WEB}
# Desktop
.PHONY: desktop
desktop:
./bin/make-all all ${DESKTOP}
.PHONY: test-desktop
test-desktop: desktop
./bin/make-all test ${DESKTOP}
.PHONY: clean-desktop
clean-desktop:
./bin/make-all clean ${DESKTOP}
# SageMath
.PHONY: sagemath
sagemath:
./bin/make-all all ${SAGEMATH}
.PHONY: test-sagemath
test-sagemath: sagemath
./bin/make-all test ${SAGEMATH}
.PHONY: clean-sagemath
clean-sagemath:
./bin/make-all clean ${SAGEMATH}
# Test
.PHONY: test
test: all test-bin
./bin/make-all test ${ALL}
test-bin: all
# Some tests of the top level scripts
# That wasm python runs
./bin/python-wasm -c "print('hi')" | grep hi
# That native python runs
./bin/python-native -c "print('hi')" | grep hi
# That the cowasm script can run a wasm binary
./bin/cowasm core/coreutils/dist/wasm/bin/factor 2023 | grep "7 17 17"
# That cython script starts
./bin/cython --version
# That dash-wasm runs
echo "factor 2023" | ./bin/dash-wasm |grep "7 17 17"
# Wasm version of lua works:
./bin/lua-wasm -e 'print(7*17*17)' |grep 2023
# Native version of lua works:
./bin/lua-native -e 'print(7*17*17)' |grep 2023
# That sqlite3-wasm does something:
./bin/sqlite3-wasm --version
# clean up everything after each test, to prove can build and test everything
# in isolation.
.PHONY: test-clean
test-clean:
./bin/make-all-clean test ${ALL}
# Clean
.PHONY: clean
clean:
./bin/make-all clean ${ALL}
rm -f bin/zig
docker:
docker build --build-arg commit=`git rev-parse HEAD` -t cowasm .
.PHONY: docker