]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - tools/perf/config/feature-checks/Makefile
0d694a94cda2613d25268927956bed7b1d010484
[karo-tx-linux.git] / tools / perf / config / feature-checks / Makefile
1
2 FILES=                                  \
3         test-all.bin                    \
4         test-backtrace.bin              \
5         test-bionic.bin                 \
6         test-dwarf.bin                  \
7         test-fortify-source.bin         \
8         test-sync-compare-and-swap.bin  \
9         test-glibc.bin                  \
10         test-gtk2.bin                   \
11         test-gtk2-infobar.bin           \
12         test-hello.bin                  \
13         test-libaudit.bin               \
14         test-libbfd.bin                 \
15         test-liberty.bin                \
16         test-liberty-z.bin              \
17         test-cplus-demangle.bin         \
18         test-libelf.bin                 \
19         test-libelf-getphdrnum.bin      \
20         test-libelf-mmap.bin            \
21         test-libnuma.bin                \
22         test-libperl.bin                \
23         test-libpython.bin              \
24         test-libpython-version.bin      \
25         test-libslang.bin               \
26         test-libunwind.bin              \
27         test-libunwind-debug-frame.bin  \
28         test-pthread-attr-setaffinity-np.bin    \
29         test-stackprotector-all.bin     \
30         test-timerfd.bin                \
31         test-libdw-dwarf-unwind.bin     \
32         test-libbabeltrace.bin          \
33         test-compile-32.bin             \
34         test-compile-x32.bin            \
35         test-zlib.bin
36
37 CC := $(CROSS_COMPILE)gcc -MD
38 PKG_CONFIG := $(CROSS_COMPILE)pkg-config
39
40 all: $(FILES)
41
42 __BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
43   BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
44
45 ###############################
46
47 test-all.bin:
48         $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -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 -lz
49
50 test-hello.bin:
51         $(BUILD)
52
53 test-pthread-attr-setaffinity-np.bin:
54         $(BUILD) -D_GNU_SOURCE -lpthread
55
56 test-stackprotector-all.bin:
57         $(BUILD) -fstack-protector-all
58
59 test-fortify-source.bin:
60         $(BUILD) -O2 -D_FORTIFY_SOURCE=2
61
62 test-bionic.bin:
63         $(BUILD)
64
65 test-libelf.bin:
66         $(BUILD) -lelf
67
68 test-glibc.bin:
69         $(BUILD)
70
71 test-dwarf.bin:
72         $(BUILD) -ldw
73
74 test-libelf-mmap.bin:
75         $(BUILD) -lelf
76
77 test-libelf-getphdrnum.bin:
78         $(BUILD) -lelf
79
80 test-libnuma.bin:
81         $(BUILD) -lnuma
82
83 test-libunwind.bin:
84         $(BUILD) -lelf
85
86 test-libunwind-debug-frame.bin:
87         $(BUILD) -lelf
88
89 test-libaudit.bin:
90         $(BUILD) -laudit
91
92 test-libslang.bin:
93         $(BUILD) -I/usr/include/slang -lslang
94
95 test-gtk2.bin:
96         $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
97
98 test-gtk2-infobar.bin:
99         $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
100
101 grep-libs  = $(filter -l%,$(1))
102 strip-libs = $(filter-out -l%,$(1))
103
104 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
105 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
106 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
107 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
108 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
109
110 test-libperl.bin:
111         $(BUILD) $(FLAGS_PERL_EMBED)
112
113 test-libpython.bin:
114         $(BUILD)
115
116 test-libpython-version.bin:
117         $(BUILD)
118
119 test-libbfd.bin:
120         $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
121
122 test-liberty.bin:
123         $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
124
125 test-liberty-z.bin:
126         $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
127
128 test-cplus-demangle.bin:
129         $(BUILD) -liberty
130
131 test-backtrace.bin:
132         $(BUILD)
133
134 test-timerfd.bin:
135         $(BUILD)
136
137 test-libdw-dwarf-unwind.bin:
138         $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
139
140 test-libbabeltrace.bin:
141         $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
142
143 test-sync-compare-and-swap.bin:
144         $(BUILD)
145
146 test-compile-32.bin:
147         $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
148
149 test-compile-x32.bin:
150         $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
151
152 test-zlib.bin:
153         $(BUILD) -lz
154
155 -include *.d
156
157 ###############################
158
159 clean:
160         rm -f $(FILES) *.d $(FILES:.bin=.make.output)