perf config: Fix build with older toolchain.
[linux-2.6-block.git] / tools / build / feature / Makefile
CommitLineData
3ae069cf 1FILES= \
56560ec6
CC
2 test-all.bin \
3 test-backtrace.bin \
4 test-bionic.bin \
5 test-dwarf.bin \
6 test-fortify-source.bin \
f6d31369 7 test-sync-compare-and-swap.bin \
56560ec6
CC
8 test-glibc.bin \
9 test-gtk2.bin \
10 test-gtk2-infobar.bin \
11 test-hello.bin \
12 test-libaudit.bin \
13 test-libbfd.bin \
14 test-liberty.bin \
15 test-liberty-z.bin \
16 test-cplus-demangle.bin \
17 test-libelf.bin \
18 test-libelf-getphdrnum.bin \
19 test-libelf-mmap.bin \
20 test-libnuma.bin \
f8ac8606 21 test-numa_num_possible_cpus.bin \
56560ec6
CC
22 test-libperl.bin \
23 test-libpython.bin \
24 test-libpython-version.bin \
25 test-libslang.bin \
8ee46460 26 test-libcrypto.bin \
56560ec6
CC
27 test-libunwind.bin \
28 test-libunwind-debug-frame.bin \
459a3df7 29 test-pthread-attr-setaffinity-np.bin \
56560ec6 30 test-stackprotector-all.bin \
45757895 31 test-timerfd.bin \
e477f3f0 32 test-libdw-dwarf-unwind.bin \
53d0a573 33 test-libbabeltrace.bin \
e477f3f0 34 test-compile-32.bin \
e92ce12e 35 test-compile-x32.bin \
6c6f0f61 36 test-zlib.bin \
1b76c13e 37 test-lzma.bin \
b0063dbf
ACM
38 test-bpf.bin \
39 test-get_cpuid.bin
b6aa9979 40
1925459b
JP
41FILES := $(addprefix $(OUTPUT),$(FILES))
42
a8a5cd8b
MR
43CC := $(CROSS_COMPILE)gcc -MD
44PKG_CONFIG := $(CROSS_COMPILE)pkg-config
8b6eb56a 45
b6aa9979
IM
46all: $(FILES)
47
1925459b
JP
48__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
49 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
b6aa9979
IM
50
51###############################
52
1925459b 53$(OUTPUT)test-all.bin:
6c6f0f61 54 $(BUILD) -fstack-protector-all -O2 -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 -llzma
baa9c30e 55
1925459b 56$(OUTPUT)test-hello.bin:
b6aa9979
IM
57 $(BUILD)
58
1925459b 59$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
b49f1a4b 60 $(BUILD) -D_GNU_SOURCE -lpthread
459a3df7 61
1925459b 62$(OUTPUT)test-stackprotector-all.bin:
b49f1a4b 63 $(BUILD) -fstack-protector-all
90ac5422 64
1925459b 65$(OUTPUT)test-fortify-source.bin:
b49f1a4b 66 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
1ea6f99e 67
1925459b 68$(OUTPUT)test-bionic.bin:
78e9d655
IM
69 $(BUILD)
70
1925459b 71$(OUTPUT)test-libelf.bin:
8f7f8005
IM
72 $(BUILD) -lelf
73
1925459b 74$(OUTPUT)test-glibc.bin:
e12762cf
IM
75 $(BUILD)
76
7aec51cb
AK
77DWARFLIBS := -ldw
78ifeq ($(findstring -static,${LDFLAGS}),-static)
79DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
80endif
81
1925459b 82$(OUTPUT)test-dwarf.bin:
7aec51cb 83 $(BUILD) $(DWARFLIBS)
8295d4e2 84
1925459b 85$(OUTPUT)test-libelf-mmap.bin:
8869b17e
IM
86 $(BUILD) -lelf
87
1925459b 88$(OUTPUT)test-libelf-getphdrnum.bin:
b7bcef6f
IM
89 $(BUILD) -lelf
90
1925459b 91$(OUTPUT)test-libnuma.bin:
3ae069cf
IM
92 $(BUILD) -lnuma
93
1925459b 94$(OUTPUT)test-numa_num_possible_cpus.bin:
f8ac8606
ACM
95 $(BUILD) -lnuma
96
1925459b 97$(OUTPUT)test-libunwind.bin:
1448fef4 98 $(BUILD) -lelf
058f952d 99
1925459b 100$(OUTPUT)test-libunwind-debug-frame.bin:
1448fef4 101 $(BUILD) -lelf
e310718d 102
1925459b 103$(OUTPUT)test-libaudit.bin:
d795a658
IM
104 $(BUILD) -laudit
105
1925459b 106$(OUTPUT)test-libslang.bin:
b9498b50
IM
107 $(BUILD) -I/usr/include/slang -lslang
108
8ee46460
SE
109$(OUTPUT)test-libcrypto.bin:
110 $(BUILD) -lcrypto
111
1925459b 112$(OUTPUT)test-gtk2.bin:
a8a5cd8b 113 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
7ef9e055 114
1925459b 115$(OUTPUT)test-gtk2-infobar.bin:
a8a5cd8b 116 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
c7a79e96 117
7181a671
IM
118grep-libs = $(filter -l%,$(1))
119strip-libs = $(filter-out -l%,$(1))
120
121PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
122PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
123PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
124PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
125FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
126
1925459b 127$(OUTPUT)test-libperl.bin:
7181a671
IM
128 $(BUILD) $(FLAGS_PERL_EMBED)
129
1925459b 130$(OUTPUT)test-libpython.bin:
56c7d79e 131 $(BUILD)
9734163b 132
1925459b 133$(OUTPUT)test-libpython-version.bin:
56c7d79e 134 $(BUILD)
95d061c8 135
1925459b 136$(OUTPUT)test-libbfd.bin:
280e7c48 137 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
3b7646e4 138
1925459b
JP
139$(OUTPUT)test-liberty.bin:
140 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
1c47661a 141
1925459b
JP
142$(OUTPUT)test-liberty-z.bin:
143 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
1c47661a 144
1925459b 145$(OUTPUT)test-cplus-demangle.bin:
1c47661a
IM
146 $(BUILD) -liberty
147
1925459b 148$(OUTPUT)test-backtrace.bin:
4cc9117a
IM
149 $(BUILD)
150
1925459b 151$(OUTPUT)test-timerfd.bin:
87419c9a
DA
152 $(BUILD)
153
1925459b 154$(OUTPUT)test-libdw-dwarf-unwind.bin:
53d0a573
JO
155 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
156
1925459b 157$(OUTPUT)test-libbabeltrace.bin:
53d0a573 158 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
45757895 159
1925459b 160$(OUTPUT)test-sync-compare-and-swap.bin:
b49f1a4b 161 $(BUILD)
f6d31369 162
1925459b
JP
163$(OUTPUT)test-compile-32.bin:
164 $(CC) -m32 -o $@ test-compile.c
e477f3f0 165
1925459b
JP
166$(OUTPUT)test-compile-x32.bin:
167 $(CC) -mx32 -o $@ test-compile.c
e477f3f0 168
1925459b 169$(OUTPUT)test-zlib.bin:
e92ce12e
NK
170 $(BUILD) -lz
171
1925459b 172$(OUTPUT)test-lzma.bin:
6c6f0f61
JO
173 $(BUILD) -llzma
174
1925459b 175$(OUTPUT)test-get_cpuid.bin:
b0063dbf
ACM
176 $(BUILD)
177
1925459b 178$(OUTPUT)test-bpf.bin:
1b76c13e
WN
179 $(BUILD)
180
1925459b 181-include $(OUTPUT)*.d
8b6eb56a 182
b6aa9979
IM
183###############################
184
185clean:
1925459b 186 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)