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