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