]> git.karo-electronics.de Git - karo-tx-linux.git/blob - tools/perf/config/feature-checks/Makefile
tools/perf/build: Split out feature check: 'libbfd'
[karo-tx-linux.git] / tools / perf / config / feature-checks / Makefile
1
2 FILES=                                  \
3         test-hello                      \
4         test-stackprotector-all         \
5         test-stackprotector             \
6         test-volatile-register-var      \
7         test-fortify-source             \
8         test-bionic                     \
9         test-libelf                     \
10         test-glibc                      \
11         test-dwarf                      \
12         test-libelf-mmap                \
13         test-libelf-getphdrnum          \
14         test-libunwind                  \
15         test-libaudit                   \
16         test-libslang                   \
17         test-gtk2                       \
18         test-gtk2-infobar               \
19         test-libperl                    \
20         test-libpython                  \
21         test-libpython-version          \
22         test-libbfd                     \
23         test-libnuma
24
25 CC := $(CC) -MD
26
27 all: $(FILES)
28
29 BUILD = $(CC) -o $(OUTPUT)$@ $@.c
30
31 ###############################
32
33 test-hello:
34         $(BUILD)
35
36 test-stackprotector-all:
37         $(BUILD) -Werror -fstack-protector-all
38
39 test-stackprotector:
40         $(BUILD) -Werror -fstack-protector
41
42 test-volatile-register-var:
43         $(BUILD) -Werror -Wvolatile-register-var
44
45 test-fortify-source:
46         $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
47
48 test-bionic:
49         $(BUILD)
50
51 test-libelf:
52         $(BUILD) -lelf
53
54 test-glibc:
55         $(BUILD)
56
57 test-dwarf:
58         $(BUILD) -ldw
59
60 test-libelf-mmap:
61         $(BUILD) -lelf
62
63 test-libelf-getphdrnum:
64         $(BUILD) -lelf
65
66 test-libnuma:
67         $(BUILD) -lnuma
68
69 test-libunwind:
70         $(BUILD) -lunwind -lunwind-x86_64 -lelf
71
72 test-libaudit:
73         $(BUILD) -laudit
74
75 test-libslang:
76         $(BUILD) -I/usr/include/slang -lslang
77
78 test-gtk2:
79         $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
80
81 test-gtk2-infobar:
82         $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
83
84 grep-libs  = $(filter -l%,$(1))
85 strip-libs = $(filter-out -l%,$(1))
86
87 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
88 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
89 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
90 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
91 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
92
93 test-libperl:
94         $(BUILD) $(FLAGS_PERL_EMBED)
95
96 override PYTHON := python
97 override PYTHON_CONFIG := python-config
98
99 escape-for-shell-sq =  $(subst ','\'',$(1))
100 shell-sq = '$(escape-for-shell-sq)'
101
102 PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
103
104 PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
105 PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
106 PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
107 PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
108 FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
109
110 test-libpython:
111         $(BUILD) $(FLAGS_PYTHON_EMBED)
112
113 test-libpython-version:
114         $(BUILD) $(FLAGS_PYTHON_EMBED)
115
116 test-libbfd:
117         $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl
118
119 -include *.d */*.d
120
121 ###############################
122
123 clean:
124         rm -f $(FILES) *.d