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