Merge branches 'pm-cpufreq' and 'pm-cpuidle'
[linux-drm-fsl-dcu.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         test-compile-32.bin             \
32         test-compile-x32.bin            \
33         test-zlib.bin
34
35 CC := $(CROSS_COMPILE)gcc -MD
36 PKG_CONFIG := $(CROSS_COMPILE)pkg-config
37
38 all: $(FILES)
39
40 BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
41
42 ###############################
43
44 test-all.bin:
45         $(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 -lz
46
47 test-hello.bin:
48         $(BUILD)
49
50 test-stackprotector-all.bin:
51         $(BUILD) -Werror -fstack-protector-all
52
53 test-fortify-source.bin:
54         $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
55
56 test-bionic.bin:
57         $(BUILD)
58
59 test-libelf.bin:
60         $(BUILD) -lelf
61
62 test-glibc.bin:
63         $(BUILD)
64
65 test-dwarf.bin:
66         $(BUILD) -ldw
67
68 test-libelf-mmap.bin:
69         $(BUILD) -lelf
70
71 test-libelf-getphdrnum.bin:
72         $(BUILD) -lelf
73
74 test-libnuma.bin:
75         $(BUILD) -lnuma
76
77 test-libunwind.bin:
78         $(BUILD) -lelf
79
80 test-libunwind-debug-frame.bin:
81         $(BUILD) -lelf
82
83 test-libaudit.bin:
84         $(BUILD) -laudit
85
86 test-libslang.bin:
87         $(BUILD) -I/usr/include/slang -lslang
88
89 test-gtk2.bin:
90         $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
91
92 test-gtk2-infobar.bin:
93         $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
94
95 grep-libs  = $(filter -l%,$(1))
96 strip-libs = $(filter-out -l%,$(1))
97
98 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
99 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
100 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
101 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
102 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
103
104 test-libperl.bin:
105         $(BUILD) $(FLAGS_PERL_EMBED)
106
107 test-libpython.bin:
108         $(BUILD)
109
110 test-libpython-version.bin:
111         $(BUILD)
112
113 test-libbfd.bin:
114         $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
115
116 test-liberty.bin:
117         $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
118
119 test-liberty-z.bin:
120         $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
121
122 test-cplus-demangle.bin:
123         $(BUILD) -liberty
124
125 test-backtrace.bin:
126         $(BUILD)
127
128 test-timerfd.bin:
129         $(BUILD)
130
131 test-libdw-dwarf-unwind.bin:
132         $(BUILD)
133
134 test-sync-compare-and-swap.bin:
135         $(BUILD) -Werror
136
137 test-compile-32.bin:
138         $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
139
140 test-compile-x32.bin:
141         $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
142
143 test-zlib.bin:
144         $(BUILD) -lz
145
146 -include *.d
147
148 ###############################
149
150 clean:
151         rm -f $(FILES) *.d