blob: 674711629ef0b2531a2e6cf7cbd291f74e55f4fd [file] [log] [blame]
Ingo Molnar3ae069c2013-09-30 13:37:10 +02001FILES= \
Chunwei Chen56560ec2013-12-21 13:48:11 +08002 test-all.bin \
3 test-backtrace.bin \
4 test-bionic.bin \
5 test-dwarf.bin \
Arnaldo Carvalho de Melobd0419e2016-04-05 11:33:41 -03006 test-dwarf_getlocations.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +08007 test-fortify-source.bin \
Adrian Hunterf6d31362014-07-14 13:02:53 +03008 test-sync-compare-and-swap.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +08009 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 \
Arnaldo Carvalho de Melo2492c462016-07-04 19:35:47 -030020 test-libelf-getshdrstrndx.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080021 test-libelf-mmap.bin \
22 test-libnuma.bin \
Arnaldo Carvalho de Melof8ac8602015-09-17 12:20:28 -030023 test-numa_num_possible_cpus.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080024 test-libperl.bin \
25 test-libpython.bin \
26 test-libpython-version.bin \
27 test-libslang.bin \
Stephane Eranian8ee46462015-11-30 10:02:21 +010028 test-libcrypto.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080029 test-libunwind.bin \
30 test-libunwind-debug-frame.bin \
He Kuangb1d96002016-05-10 07:40:31 +000031 test-libunwind-x86.bin \
32 test-libunwind-x86_64.bin \
33 test-libunwind-arm.bin \
34 test-libunwind-aarch64.bin \
He Kuangf9be7ee2016-05-10 07:40:32 +000035 test-libunwind-debug-frame-arm.bin \
36 test-libunwind-debug-frame-aarch64.bin \
Vineet Gupta459a3df2015-01-13 19:13:24 +053037 test-pthread-attr-setaffinity-np.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080038 test-stackprotector-all.bin \
Jiri Olsa45757892014-02-19 16:52:56 +010039 test-timerfd.bin \
Adrian Huntere477f3f2014-10-23 18:16:03 -030040 test-libdw-dwarf-unwind.bin \
Jiri Olsa53d0a572015-02-20 23:16:58 +010041 test-libbabeltrace.bin \
Adrian Huntere477f3f2014-10-23 18:16:03 -030042 test-compile-32.bin \
Namhyung Kime92ce122014-10-31 16:51:38 +090043 test-compile-x32.bin \
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010044 test-zlib.bin \
Wang Nan1b76c132015-07-01 02:13:51 +000045 test-lzma.bin \
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -030046 test-bpf.bin \
47 test-get_cpuid.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020048
Josh Poimboeuf19254592015-12-15 09:39:32 -060049FILES := $(addprefix $(OUTPUT),$(FILES))
50
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000051CC := $(CROSS_COMPILE)gcc -MD
52PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020053
Ingo Molnarb6aa9972013-09-30 10:08:24 +020054all: $(FILES)
55
Josh Poimboeuf19254592015-12-15 09:39:32 -060056__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
57 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
Ingo Molnarb6aa9972013-09-30 10:08:24 +020058
59###############################
60
Josh Poimboeuf19254592015-12-15 09:39:32 -060061$(OUTPUT)test-all.bin:
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010062 $(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
Ingo Molnarbaa9c302013-10-01 14:14:31 +020063
Josh Poimboeuf19254592015-12-15 09:39:32 -060064$(OUTPUT)test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020065 $(BUILD)
66
Josh Poimboeuf19254592015-12-15 09:39:32 -060067$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010068 $(BUILD) -D_GNU_SOURCE -lpthread
Vineet Gupta459a3df2015-01-13 19:13:24 +053069
Josh Poimboeuf19254592015-12-15 09:39:32 -060070$(OUTPUT)test-stackprotector-all.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010071 $(BUILD) -fstack-protector-all
Ingo Molnar90ac5422013-09-30 13:48:44 +020072
Josh Poimboeuf19254592015-12-15 09:39:32 -060073$(OUTPUT)test-fortify-source.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010074 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
Ingo Molnar1ea6f992013-10-07 09:38:28 +020075
Josh Poimboeuf19254592015-12-15 09:39:32 -060076$(OUTPUT)test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020077 $(BUILD)
78
Josh Poimboeuf19254592015-12-15 09:39:32 -060079$(OUTPUT)test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020080 $(BUILD) -lelf
81
Josh Poimboeuf19254592015-12-15 09:39:32 -060082$(OUTPUT)test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020083 $(BUILD)
84
Andi Kleen7aec51c2015-08-12 15:48:37 -070085DWARFLIBS := -ldw
86ifeq ($(findstring -static,${LDFLAGS}),-static)
87DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
88endif
89
Josh Poimboeuf19254592015-12-15 09:39:32 -060090$(OUTPUT)test-dwarf.bin:
Andi Kleen7aec51c2015-08-12 15:48:37 -070091 $(BUILD) $(DWARFLIBS)
Ingo Molnar8295d4e2013-10-07 10:35:39 +020092
Arnaldo Carvalho de Melobd0419e2016-04-05 11:33:41 -030093$(OUTPUT)test-dwarf_getlocations.bin:
94 $(BUILD) $(DWARFLIBS)
95
Josh Poimboeuf19254592015-12-15 09:39:32 -060096$(OUTPUT)test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020097 $(BUILD) -lelf
98
Josh Poimboeuf19254592015-12-15 09:39:32 -060099$(OUTPUT)test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +0200100 $(BUILD) -lelf
101
Arnaldo Carvalho de Melo2492c462016-07-04 19:35:47 -0300102$(OUTPUT)test-libelf-getshdrstrndx.bin:
103 $(BUILD) -lelf
104
Josh Poimboeuf19254592015-12-15 09:39:32 -0600105$(OUTPUT)test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +0200106 $(BUILD) -lnuma
107
Josh Poimboeuf19254592015-12-15 09:39:32 -0600108$(OUTPUT)test-numa_num_possible_cpus.bin:
Arnaldo Carvalho de Melof8ac8602015-09-17 12:20:28 -0300109 $(BUILD) -lnuma
110
Josh Poimboeuf19254592015-12-15 09:39:32 -0600111$(OUTPUT)test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +0100112 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +0200113
Josh Poimboeuf19254592015-12-15 09:39:32 -0600114$(OUTPUT)test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +0100115 $(BUILD) -lelf
He Kuangb1d96002016-05-10 07:40:31 +0000116$(OUTPUT)test-libunwind-x86.bin:
117 $(BUILD) -lelf -lunwind-x86
118
119$(OUTPUT)test-libunwind-x86_64.bin:
120 $(BUILD) -lelf -lunwind-x86_64
121
122$(OUTPUT)test-libunwind-arm.bin:
123 $(BUILD) -lelf -lunwind-arm
124
125$(OUTPUT)test-libunwind-aarch64.bin:
126 $(BUILD) -lelf -lunwind-aarch64
127
He Kuangf9be7ee2016-05-10 07:40:32 +0000128$(OUTPUT)test-libunwind-debug-frame-arm.bin:
129 $(BUILD) -lelf -lunwind-arm
130
131$(OUTPUT)test-libunwind-debug-frame-aarch64.bin:
132 $(BUILD) -lelf -lunwind-aarch64
Ingo Molnare3107182013-11-14 08:25:24 +0100133
Josh Poimboeuf19254592015-12-15 09:39:32 -0600134$(OUTPUT)test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +0200135 $(BUILD) -laudit
136
Josh Poimboeuf19254592015-12-15 09:39:32 -0600137$(OUTPUT)test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +0200138 $(BUILD) -I/usr/include/slang -lslang
139
Stephane Eranian8ee46462015-11-30 10:02:21 +0100140$(OUTPUT)test-libcrypto.bin:
141 $(BUILD) -lcrypto
142
Josh Poimboeuf19254592015-12-15 09:39:32 -0600143$(OUTPUT)test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000144 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +0200145
Josh Poimboeuf19254592015-12-15 09:39:32 -0600146$(OUTPUT)test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000147 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +0200148
Ingo Molnar7181a672013-09-30 15:15:36 +0200149grep-libs = $(filter -l%,$(1))
150strip-libs = $(filter-out -l%,$(1))
151
152PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
153PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
154PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
155PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
156FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
157
Josh Poimboeuf19254592015-12-15 09:39:32 -0600158$(OUTPUT)test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200159 $(BUILD) $(FLAGS_PERL_EMBED)
160
Josh Poimboeuf19254592015-12-15 09:39:32 -0600161$(OUTPUT)test-libpython.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900162 $(BUILD)
Ingo Molnar97341632013-09-30 15:18:37 +0200163
Josh Poimboeuf19254592015-12-15 09:39:32 -0600164$(OUTPUT)test-libpython-version.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900165 $(BUILD)
Ingo Molnar95d061c2013-09-30 15:40:04 +0200166
Josh Poimboeuf19254592015-12-15 09:39:32 -0600167$(OUTPUT)test-libbfd.bin:
Andi Kleen280e7c42014-01-11 11:42:51 -0800168 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200169
Josh Poimboeuf19254592015-12-15 09:39:32 -0600170$(OUTPUT)test-liberty.bin:
171 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200172
Josh Poimboeuf19254592015-12-15 09:39:32 -0600173$(OUTPUT)test-liberty-z.bin:
174 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200175
Josh Poimboeuf19254592015-12-15 09:39:32 -0600176$(OUTPUT)test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200177 $(BUILD) -liberty
178
Josh Poimboeuf19254592015-12-15 09:39:32 -0600179$(OUTPUT)test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200180 $(BUILD)
181
Josh Poimboeuf19254592015-12-15 09:39:32 -0600182$(OUTPUT)test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600183 $(BUILD)
184
Josh Poimboeuf19254592015-12-15 09:39:32 -0600185$(OUTPUT)test-libdw-dwarf-unwind.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100186 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
187
Josh Poimboeuf19254592015-12-15 09:39:32 -0600188$(OUTPUT)test-libbabeltrace.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100189 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
Jiri Olsa45757892014-02-19 16:52:56 +0100190
Josh Poimboeuf19254592015-12-15 09:39:32 -0600191$(OUTPUT)test-sync-compare-and-swap.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +0100192 $(BUILD)
Adrian Hunterf6d31362014-07-14 13:02:53 +0300193
Josh Poimboeuf19254592015-12-15 09:39:32 -0600194$(OUTPUT)test-compile-32.bin:
195 $(CC) -m32 -o $@ test-compile.c
Adrian Huntere477f3f2014-10-23 18:16:03 -0300196
Josh Poimboeuf19254592015-12-15 09:39:32 -0600197$(OUTPUT)test-compile-x32.bin:
198 $(CC) -mx32 -o $@ test-compile.c
Adrian Huntere477f3f2014-10-23 18:16:03 -0300199
Josh Poimboeuf19254592015-12-15 09:39:32 -0600200$(OUTPUT)test-zlib.bin:
Namhyung Kime92ce122014-10-31 16:51:38 +0900201 $(BUILD) -lz
202
Josh Poimboeuf19254592015-12-15 09:39:32 -0600203$(OUTPUT)test-lzma.bin:
Jiri Olsa6c6f0f62015-03-04 11:35:47 +0100204 $(BUILD) -llzma
205
Josh Poimboeuf19254592015-12-15 09:39:32 -0600206$(OUTPUT)test-get_cpuid.bin:
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -0300207 $(BUILD)
208
Josh Poimboeuf19254592015-12-15 09:39:32 -0600209$(OUTPUT)test-bpf.bin:
Wang Nan1b76c132015-07-01 02:13:51 +0000210 $(BUILD)
211
Josh Poimboeuf19254592015-12-15 09:39:32 -0600212-include $(OUTPUT)*.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200213
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200214###############################
215
216clean:
Josh Poimboeuf19254592015-12-15 09:39:32 -0600217 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)