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