-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
117 lines (108 loc) · 3.98 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
prefix = /usr/local
TIMEFORMAT = "\nTime elapsed: %E"
BUILD_LIBA = build_install_liba() { \
if [ ! -d $(prefix)/lib/colib ]; then \
mkdir -p $(prefix)/lib/colib; \
fi; \
if [ ! -d _tmp ]; then \
mkdir -p _tmp; \
fi; \
rm -rf $(prefix)/lib/colib/*; \
rm -rf _tmp/*; \
cd _tmp; \
echo " \
use fmt use os use string use std \
use std.map use std.atomic use std.regex \
use runtime use runtime.debug use time \
" > a.tu; \
tu -s a.tu -std; \
rm a.tu.s; \
tu -c . -c $(prefix)/lib/coasm; \
ar -rc tulang.a *.o; \
mv tulang.a ../release/; \
mv *.o $(prefix)/lib/colib; \
cd ..; \
rm -rf _tmp; \
}
CLEAN_ALL = clean_all() { \
if [ -d $(prefix)/lib/colib ]; then \
rm -rf $(prefix)/lib/colib; \
fi; \
if [ -d $(prefix)/lib/copkg ]; then \
rm -rf $(prefix)/lib/copkg; \
fi; \
if [ -d $(prefix)/lib/coasm ]; then \
rm -rf $(prefix)/lib/coasm; \
fi; \
}
INSTALL_ALL = install_all() { \
if [ ! -d $(prefix)/lib/colib ]; then \
mkdir -p $(prefix)/lib/colib; \
fi; \
if [ ! -d $(prefix)/lib/copkg ]; then \
mkdir -p $(prefix)/lib/copkg; \
fi; \
if [ ! -d $(prefix)/lib/coasm ]; then \
mkdir -p $(prefix)/lib/coasm; \
fi; \
rm -rf $(prefix)/lib/colib/*; \
rm -rf $(prefix)/lib/copkg/*; \
rm -rf $(prefix)/lib/coasm/*; \
cp release/tu $(prefix)/bin/tu; \
cp -r runtime $(prefix)/lib/copkg/; \
cp -r library/* $(prefix)/lib/copkg/; \
cp -r syscall/* $(prefix)/lib/coasm/; \
cd release; \
ar -x tulang.a; \
mv *.o $(prefix)/lib/colib/; \
}
TEST_COMPILER = test_compiler() { \
sh compiler/test.sh; \
sh asmer/test.sh; \
sh linker/test.sh; \
}
.PHONY: build-liba
build-liba:
@$(BUILD_LIBA); build_install_liba
@echo "install liba to $(prefix)/lib/colib success"
.PHONEY: release
release: install build-liba install
@echo "release tu liba success"
@echo "release bin lib success"
# NOTICE: don't use this
.PHONEY: release
dev_release: install
tuc run tulang.tu
mv a.out release/tu
cp release/tu $(prefix)/bin/tu
.PHONY: install
install:
@$(INSTALL_ALL); install_all
@echo "tu env installed"
.PHONY: clean
clean:
@$(CLEAN_ALL); clean_all
@echo "clean all fininshed"
# unused
#test_memory:
# sh tests_compiler.sh memory
# sh tests_asmer.sh memory
# sh tests_linker.sh memory
check: install test
test_dev:
@$(TEST_COMPILER); test_compiler
@echo "test compiler success"
cases = async mixed class common datastruct internalpkg memory native operator runtime statement
# make test -j9
tests_cases: $(cases)
@echo "all test cases passed"
@$(TEST_COMPILER); test_compiler
@echo "compiler tests passed"
tests_start:
@echo "tests start"
tests: tests_start
@$(TIME) $(MAKE) tests_cases
#Time elapsed: 2:16.05
%: ./tests/%
@sh tests_all.sh $@ ;
TIME = /usr/bin/time -f $(TIMEFORMAT)