-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (78 loc) · 2.62 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
ROOT?=/usr
BUILDVARIANT?=release
ifeq ($(BUILDVARIANT),release)
$(info "Release Build......")
VARIANT=release
VARIANT_OPTION=--release
else
$(info "Debug Build......")
VARIANT=debug
VARIANT_OPTION=
endif
SRCS:=src/lib.rs src/tracker.rs src/utils.rs
GO_SRCS:=*.go **/*.go
.PHONY: basics
basics:
echo "Basics..."
ln -sf target/i686-unknown-linux-gnu/$(VARIANT) lib
ln -sf target/i686-unknown-linux-gnu/$(VARIANT) lib32
ln -sf target/$(VARIANT) lib64
rm -f wisk
ln -sf ./ wisk
tests/testprog64: tests/test.c
echo "tests/testprog64"
cc -Werror -o tests/testprog64 tests/test.c
tests/testprog32: tests/test.c
echo "tests/testprog32"
cc -Werror -m32 -o tests/testprog32 tests/test.c
target/$(VARIANT)/libwisktrack.so: $(SRCS)
echo "cargo build 64bit $(VARIANT)"
cargo build $(VARIANT_OPTION)
.PHONY: cargo-tests
cargo-tests:
echo "cargo test 64bit"
cargo test || true
target/i686-unknown-linux-gnu/$(VARIANT)/libwisktrack.so: $(SRCS)
echo "cargo build 32bit $(VARIANT)"
cargo build --target=i686-unknown-linux-gnu $(VARIANT_OPTION)
$(ROOT)/lib/libwisktrack.so: target/$(VARIANT)/libwisktrack.so
echo "install 64bit"
mkdir -p $(ROOT)/lib64/
install -D -m a+rwx target/$(VARIANT)/libwisktrack.so $(ROOT)/lib64/
$(ROOT)/lib32/libwisktrack.so: target/i686-unknown-linux-gnu/$(VARIANT)/libwisktrack.so
echo "install 32bit"
mkdir -p $(ROOT)/lib32/
install -D -m a+rwx target/i686-unknown-linux-gnu/$(VARIANT)/libwisktrack.so $(ROOT)/lib32/
ln -sf lib32 $(ROOT)/lib
$(ROOT)/bin/cleanenv.sh: scripts/cleanenv.sh
echo "install scripts"
mkdir -p $(ROOT)/bin
mkdir -p $(ROOT)/config
mkdir -p $(ROOT)/stap
install -D scripts/cleanenv.sh $(ROOT)/bin/
install -D scripts/discover64bitapps $(ROOT)/bin/
install -D config/default.ini* $(ROOT)/config/
install -D config/wisktrack.ini* $(ROOT)/config/
install -D stap/*.stp $(ROOT)/stap/
$(ROOT)/bin/wiskdeps: ./wiskdeps
echo "install wiskdeps"
mkdir -p $(ROOT)/bin
install -D ./wiskdeps $(ROOT)/bin/
./bin/wiskdeps: $(GO_SRCS)
mkdir -p bin/
go build -o ./bin/wiskdeps
# mv ./wiskdeps ./bin/wiskdeps
.PHONY: tests
tests: tests/testprog64 tests/testprog32 basics | cargo-tests
.PHONY: buildonly
buildonly: target/i686-unknown-linux-gnu/$(VARIANT)/libwisktrack.so target/$(VARIANT)/libwisktrack.so basics ./bin/wiskdeps
.PHONY: all
all: target/i686-unknown-linux-gnu/$(VARIANT)/libwisktrack.so target/$(VARIANT)/libwisktrack.so basics ./bin/wiskdeps | cargo-tests
.PHONY: install
install: $(ROOT)/lib32/libwisktrack.so $(ROOT)/lib/libwisktrack.so $(ROOT)/bin/cleanenv.sh $(ROOT)/bin/wiskdeps
install -D ./bin/wiskdeps $(ROOT)/bin/
.PHONY: clean
clean:
cargo clean
go clean
rm -rf bin/wiskdeps