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