Commit | Line | Data |
---|---|---|
b6aa9979 | 1 | |
3ae069cf | 2 | FILES= \ |
f1138ec6 IM |
3 | test-all \ |
4 | test-backtrace \ | |
78e9d655 | 5 | test-bionic \ |
8295d4e2 | 6 | test-dwarf \ |
f1138ec6 IM |
7 | test-fortify-source \ |
8 | test-glibc \ | |
7ef9e055 | 9 | test-gtk2 \ |
c7a79e96 | 10 | test-gtk2-infobar \ |
f1138ec6 IM |
11 | test-hello \ |
12 | test-libaudit \ | |
13 | test-libbfd \ | |
1c47661a IM |
14 | test-liberty \ |
15 | test-liberty-z \ | |
16 | test-cplus-demangle \ | |
f1138ec6 IM |
17 | test-libelf \ |
18 | test-libelf-getphdrnum \ | |
19 | test-libelf-mmap \ | |
20 | test-libnuma \ | |
7181a671 | 21 | test-libperl \ |
9734163b | 22 | test-libpython \ |
95d061c8 | 23 | test-libpython-version \ |
f1138ec6 IM |
24 | test-libslang \ |
25 | test-libunwind \ | |
f47671e2 | 26 | test-libunwind-debug-frame \ |
34ef2162 | 27 | test-on-exit \ |
f1138ec6 | 28 | test-stackprotector-all \ |
87419c9a DA |
29 | test-stackprotector \ |
30 | test-timerfd | |
b6aa9979 | 31 | |
8b6eb56a IM |
32 | CC := $(CC) -MD |
33 | ||
b6aa9979 IM |
34 | all: $(FILES) |
35 | ||
28e962b9 | 36 | BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c |
b6aa9979 IM |
37 | |
38 | ############################### | |
39 | ||
baa9c30e | 40 | test-all: |
8a0c4c28 | 41 | $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl |
baa9c30e | 42 | |
8b6eb56a | 43 | test-hello: |
b6aa9979 IM |
44 | $(BUILD) |
45 | ||
90ac5422 IM |
46 | test-stackprotector-all: |
47 | $(BUILD) -Werror -fstack-protector-all | |
48 | ||
430be5ab | 49 | test-stackprotector: |
046fa7ae | 50 | $(BUILD) -Werror -fstack-protector -Wstack-protector |
430be5ab | 51 | |
1ea6f99e IM |
52 | test-fortify-source: |
53 | $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2 | |
54 | ||
78e9d655 IM |
55 | test-bionic: |
56 | $(BUILD) | |
57 | ||
8f7f8005 IM |
58 | test-libelf: |
59 | $(BUILD) -lelf | |
60 | ||
e12762cf IM |
61 | test-glibc: |
62 | $(BUILD) | |
63 | ||
8295d4e2 IM |
64 | test-dwarf: |
65 | $(BUILD) -ldw | |
66 | ||
8869b17e IM |
67 | test-libelf-mmap: |
68 | $(BUILD) -lelf | |
69 | ||
b7bcef6f IM |
70 | test-libelf-getphdrnum: |
71 | $(BUILD) -lelf | |
72 | ||
3ae069cf IM |
73 | test-libnuma: |
74 | $(BUILD) -lnuma | |
75 | ||
058f952d | 76 | test-libunwind: |
8a0c4c28 | 77 | $(BUILD) $(LIBUNWIND_LIBS) -lelf |
058f952d | 78 | |
d795a658 IM |
79 | test-libaudit: |
80 | $(BUILD) -laudit | |
81 | ||
b9498b50 IM |
82 | test-libslang: |
83 | $(BUILD) -I/usr/include/slang -lslang | |
84 | ||
7ef9e055 IM |
85 | test-gtk2: |
86 | $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) | |
87 | ||
c7a79e96 IM |
88 | test-gtk2-infobar: |
89 | $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) | |
90 | ||
7181a671 IM |
91 | grep-libs = $(filter -l%,$(1)) |
92 | strip-libs = $(filter-out -l%,$(1)) | |
93 | ||
94 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) | |
95 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) | |
96 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) | |
97 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` | |
98 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) | |
99 | ||
100 | test-libperl: | |
101 | $(BUILD) $(FLAGS_PERL_EMBED) | |
102 | ||
9734163b IM |
103 | override PYTHON := python |
104 | override PYTHON_CONFIG := python-config | |
105 | ||
106 | escape-for-shell-sq = $(subst ','\'',$(1)) | |
107 | shell-sq = '$(escape-for-shell-sq)' | |
108 | ||
109 | PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG)) | |
110 | ||
111 | PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) | |
112 | PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) | |
113 | PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) | |
114 | PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) | |
115 | FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) | |
116 | ||
117 | test-libpython: | |
118 | $(BUILD) $(FLAGS_PYTHON_EMBED) | |
119 | ||
95d061c8 IM |
120 | test-libpython-version: |
121 | $(BUILD) $(FLAGS_PYTHON_EMBED) | |
122 | ||
3b7646e4 | 123 | test-libbfd: |
0dc09742 | 124 | $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl |
3b7646e4 | 125 | |
1c47661a | 126 | test-liberty: |
0dc09742 | 127 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty |
1c47661a IM |
128 | |
129 | test-liberty-z: | |
0dc09742 | 130 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz |
1c47661a IM |
131 | |
132 | test-cplus-demangle: | |
133 | $(BUILD) -liberty | |
134 | ||
34ef2162 IM |
135 | test-on-exit: |
136 | $(BUILD) | |
137 | ||
4cc9117a IM |
138 | test-backtrace: |
139 | $(BUILD) | |
140 | ||
87419c9a DA |
141 | test-timerfd: |
142 | $(BUILD) | |
143 | ||
231486a5 | 144 | -include *.d |
8b6eb56a | 145 | |
b6aa9979 IM |
146 | ############################### |
147 | ||
148 | clean: | |
8b6eb56a | 149 | rm -f $(FILES) *.d |