-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
171 lines (138 loc) · 4.28 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Copyright (C) 2010-2016 Cesar Rodriguez <cesar.rodriguez@lipn.fr>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
include defs.mk
.PHONY: fake all g test clean distclean prof dist compile tags run
all : compile
compile: $(TARGETS)
unittest ut : compile input.ll
./tests/unit/main
regression : dist
make -f tests/regression/Makefile R=.
r run: compile input.ll
#./tools/pta-dump/pta-dump tests/pta/alloca1.ll
./tests/unit/main
input.ll : program.ll rt/rt.bc
llvm-link-$(LLVMVERS) -S $^ -o $@
#program.ll : /tmp/cunf3.ll
program.ll : tests/unit/input/hello.ll
#opt-6.0 -S -O3 -mem2reg $< > $@
opt-6.0 -S -verify $< > $@
test.pta : $(TOOLS_PTADUMP_TARGETS) $(patsubst %.c,%.ll,$(wildcard tests/pta/*.c))
export PATH=$$PWD/tools/pta-dump:$$PATH; cd ./tests/pta; ./run.sh
src/libsteroids.a : $(LIB_OBJS) $(LIB_MOBJS)
@echo "AR $@"
@$(AR) r $@ $^
src/libsteroids.so : $(LIB_OBJS) $(LIB_MOBJS)
@echo "LD $@"
@$(CXX) -shared $(CXXFLAGS) -o $@ $^
$(UNIT_TARGETS) : $(UNIT_OBJS) $(UNIT_MOBJS) src/libsteroids.a
@echo "LD $@"
@$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(TOOLS_STID_TARGETS) : $(TOOLS_STID_OBJS) $(TOOLS_STID_MOBJS) src/libsteroids.a
@echo "LD $@"
@$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(TOOLS_PTADUMP_TARGETS) : $(TOOLS_PTADUMP_OBJS) $(TOOLS_PTADUMP_MOBJS) src/libsteroids.a
@echo "LD $@"
@$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(RT_TARGETS) : $(RT_OBJS) $(RT_MOBJS)
@echo "LD $@"
@llvm-link-$(LLVMVERS) $(if $(findstring .ll, $@), -S, ) -o $@ $^
$R/rt/start.c : $R/rt/start.s
./scripts/as2c.py < $< > $@
prof : $(TARGETS)
rm gmon.out.*
src/main /tmp/ele4.ll_net
tags : $(SRCS)
ctags -R --c++-kinds=+p --fields=+K --extra=+q include/ src/ tools/ rt/ $(shell llvm-config-$(LLVMVERS) --includedir)
g gdb : $(TARGETS)
gdb ./tools/test/main
c cgdb : $(TARGETS)
cgdb ./tools/test/main
vars :
@echo xxxxxxxxxxxx
@echo $(patsubst %.c,%.ll,$(wildcard tests/pta/*.c))
@echo xxxxxxxxxxxx
@echo "CC $(CC)"
@echo "CXX $(CXX)"
@echo "CFLAGS $(CFLAGS)"
@echo "CPPFLAGS $(CPPFLAGS)"
@echo "CXXFLAGS $(CXXFLAGS)"
@echo "TARGETS $(TARGETS)"
@echo "MOBJS $(MOBJS)"
@echo "OBJS $(OBJS)"
@echo "DEPS $(DEPS)"
@echo ""
@echo "Library:"
@echo "SRCS $(LIB_SRCS)"
@echo "MSRCS $(LIB_MSRCS)"
@echo "OBJS $(LIB_OBJS)"
@echo "MOBJS $(LIB_MOBJS)"
@echo "TARGETS $(LIB_TARGETS)"
@echo ""
@echo "tests/unit:"
@echo "SRCS $(UNIT_SRCS)"
@echo "MSRCS $(UNIT_MSRCS)"
@echo "OBJS $(UNIT_OBJS)"
@echo "MOBJS $(UNIT_MOBJS)"
@echo "TARGETS $(UNIT_TARGETS)"
@echo ""
@echo "rt:"
@echo "SRCS $(RT_SRCS)"
@echo "MSRCS $(RT_MSRCS)"
@echo "OBJS $(RT_OBJS)"
@echo "MOBJS $(RT_MOBJS)"
@echo "TARGETS $(RT_TARGETS)"
dist : compile
rm -Rf dist/
mkdir dist
mkdir dist/bin
mkdir dist/lib
mkdir dist/doc
cp tools/stid/main dist/bin/stid
cp tools/pta-dump/pta-dump dist/bin/pta-dump
cp src/*.a dist/lib/
cp src/libsteroids.so dist/lib/libsteroids-0.2.0.so
cp -Rv include dist/
cp -Rv doc/example dist/doc/
cp rt/rt.bc dist/lib/
-find dist | grep .swp$$ | xargs rm -f
CONFIG_VERSION=0.2.0
REL:=steroids-$(shell uname -p)-$(CONFIG_VERSION)
release : dist
rm -Rf $(REL)
cp -Rv dist $(REL)
cp LICENSE $(REL)
cp README.rst $(REL)
tar czvf $(REL).tar.gz $(REL)
clean :
rm -f $(TARGETS) $(MOBJS) $(OBJS)
rm -f $(RT_OBJS) $(RT_MOBJS)
rm -f $(TOOLS_PTADUMP_OBJS) $(TOOLS_PTADUMP_MOBJS)
rm -f $(TOOLS_STID_OBJS) $(TOOLS_STID_MOBJS)
rm -f $(UNIT_OBJS) $(UNIT_MOBJS)
rm -f rt/*.ll rt/start.c input.ll
rm -f regression.log*
make -f tests/regression/Makefile R=. clean
distclean : clean
rm -f $(DEPS)
rm -Rf dist/ $(REL)
rm -Rf $(REL).tar.gz
PREFIX = ~/x/local
install : dist
cd dist; cp -Rv * $(PREFIX)
uninstall :
cd $(PREFIX)
rm bin/stid
rm -R lib/stid
-include $(DEPS)