blob: f4fe3bc59b60bb5addd3a7f365d5747d7c7a8245 [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 \
20 test-libelf-mmap.bin \
21 test-libnuma.bin \
Arnaldo Carvalho de Melof8ac8602015-09-17 12:20:28 -030022 test-numa_num_possible_cpus.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080023 test-libperl.bin \
24 test-libpython.bin \
25 test-libpython-version.bin \
26 test-libslang.bin \
Stephane Eranian8ee46462015-11-30 10:02:21 +010027 test-libcrypto.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080028 test-libunwind.bin \
29 test-libunwind-debug-frame.bin \
He Kuangb1d96002016-05-10 07:40:31 +000030 test-libunwind-x86.bin \
31 test-libunwind-x86_64.bin \
32 test-libunwind-arm.bin \
33 test-libunwind-aarch64.bin \
Vineet Gupta459a3df2015-01-13 19:13:24 +053034 test-pthread-attr-setaffinity-np.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080035 test-stackprotector-all.bin \
Jiri Olsa45757892014-02-19 16:52:56 +010036 test-timerfd.bin \
Adrian Huntere477f3f2014-10-23 18:16:03 -030037 test-libdw-dwarf-unwind.bin \
Jiri Olsa53d0a572015-02-20 23:16:58 +010038 test-libbabeltrace.bin \
Adrian Huntere477f3f2014-10-23 18:16:03 -030039 test-compile-32.bin \
Namhyung Kime92ce122014-10-31 16:51:38 +090040 test-compile-x32.bin \
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010041 test-zlib.bin \
Wang Nan1b76c132015-07-01 02:13:51 +000042 test-lzma.bin \
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -030043 test-bpf.bin \
44 test-get_cpuid.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020045
Josh Poimboeuf19254592015-12-15 09:39:32 -060046FILES := $(addprefix $(OUTPUT),$(FILES))
47
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000048CC := $(CROSS_COMPILE)gcc -MD
49PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020050
Ingo Molnarb6aa9972013-09-30 10:08:24 +020051all: $(FILES)
52
Josh Poimboeuf19254592015-12-15 09:39:32 -060053__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
54 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
Ingo Molnarb6aa9972013-09-30 10:08:24 +020055
56###############################
57
Josh Poimboeuf19254592015-12-15 09:39:32 -060058$(OUTPUT)test-all.bin:
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010059 $(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 +020060
Josh Poimboeuf19254592015-12-15 09:39:32 -060061$(OUTPUT)test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020062 $(BUILD)
63
Josh Poimboeuf19254592015-12-15 09:39:32 -060064$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010065 $(BUILD) -D_GNU_SOURCE -lpthread
Vineet Gupta459a3df2015-01-13 19:13:24 +053066
Josh Poimboeuf19254592015-12-15 09:39:32 -060067$(OUTPUT)test-stackprotector-all.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010068 $(BUILD) -fstack-protector-all
Ingo Molnar90ac5422013-09-30 13:48:44 +020069
Josh Poimboeuf19254592015-12-15 09:39:32 -060070$(OUTPUT)test-fortify-source.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010071 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
Ingo Molnar1ea6f992013-10-07 09:38:28 +020072
Josh Poimboeuf19254592015-12-15 09:39:32 -060073$(OUTPUT)test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020074 $(BUILD)
75
Josh Poimboeuf19254592015-12-15 09:39:32 -060076$(OUTPUT)test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020077 $(BUILD) -lelf
78
Josh Poimboeuf19254592015-12-15 09:39:32 -060079$(OUTPUT)test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020080 $(BUILD)
81
Andi Kleen7aec51c2015-08-12 15:48:37 -070082DWARFLIBS := -ldw
83ifeq ($(findstring -static,${LDFLAGS}),-static)
84DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
85endif
86
Josh Poimboeuf19254592015-12-15 09:39:32 -060087$(OUTPUT)test-dwarf.bin:
Andi Kleen7aec51c2015-08-12 15:48:37 -070088 $(BUILD) $(DWARFLIBS)
Ingo Molnar8295d4e2013-10-07 10:35:39 +020089
Arnaldo Carvalho de Melobd0419e2016-04-05 11:33:41 -030090$(OUTPUT)test-dwarf_getlocations.bin:
91 $(BUILD) $(DWARFLIBS)
92
Josh Poimboeuf19254592015-12-15 09:39:32 -060093$(OUTPUT)test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020094 $(BUILD) -lelf
95
Josh Poimboeuf19254592015-12-15 09:39:32 -060096$(OUTPUT)test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020097 $(BUILD) -lelf
98
Josh Poimboeuf19254592015-12-15 09:39:32 -060099$(OUTPUT)test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +0200100 $(BUILD) -lnuma
101
Josh Poimboeuf19254592015-12-15 09:39:32 -0600102$(OUTPUT)test-numa_num_possible_cpus.bin:
Arnaldo Carvalho de Melof8ac8602015-09-17 12:20:28 -0300103 $(BUILD) -lnuma
104
Josh Poimboeuf19254592015-12-15 09:39:32 -0600105$(OUTPUT)test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +0100106 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +0200107
Josh Poimboeuf19254592015-12-15 09:39:32 -0600108$(OUTPUT)test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +0100109 $(BUILD) -lelf
He Kuangb1d96002016-05-10 07:40:31 +0000110$(OUTPUT)test-libunwind-x86.bin:
111 $(BUILD) -lelf -lunwind-x86
112
113$(OUTPUT)test-libunwind-x86_64.bin:
114 $(BUILD) -lelf -lunwind-x86_64
115
116$(OUTPUT)test-libunwind-arm.bin:
117 $(BUILD) -lelf -lunwind-arm
118
119$(OUTPUT)test-libunwind-aarch64.bin:
120 $(BUILD) -lelf -lunwind-aarch64
121
Ingo Molnare3107182013-11-14 08:25:24 +0100122
Josh Poimboeuf19254592015-12-15 09:39:32 -0600123$(OUTPUT)test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +0200124 $(BUILD) -laudit
125
Josh Poimboeuf19254592015-12-15 09:39:32 -0600126$(OUTPUT)test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +0200127 $(BUILD) -I/usr/include/slang -lslang
128
Stephane Eranian8ee46462015-11-30 10:02:21 +0100129$(OUTPUT)test-libcrypto.bin:
130 $(BUILD) -lcrypto
131
Josh Poimboeuf19254592015-12-15 09:39:32 -0600132$(OUTPUT)test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000133 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +0200134
Josh Poimboeuf19254592015-12-15 09:39:32 -0600135$(OUTPUT)test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000136 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +0200137
Ingo Molnar7181a672013-09-30 15:15:36 +0200138grep-libs = $(filter -l%,$(1))
139strip-libs = $(filter-out -l%,$(1))
140
141PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
142PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
143PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
144PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
145FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
146
Josh Poimboeuf19254592015-12-15 09:39:32 -0600147$(OUTPUT)test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200148 $(BUILD) $(FLAGS_PERL_EMBED)
149
Josh Poimboeuf19254592015-12-15 09:39:32 -0600150$(OUTPUT)test-libpython.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900151 $(BUILD)
Ingo Molnar97341632013-09-30 15:18:37 +0200152
Josh Poimboeuf19254592015-12-15 09:39:32 -0600153$(OUTPUT)test-libpython-version.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900154 $(BUILD)
Ingo Molnar95d061c2013-09-30 15:40:04 +0200155
Josh Poimboeuf19254592015-12-15 09:39:32 -0600156$(OUTPUT)test-libbfd.bin:
Andi Kleen280e7c42014-01-11 11:42:51 -0800157 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200158
Josh Poimboeuf19254592015-12-15 09:39:32 -0600159$(OUTPUT)test-liberty.bin:
160 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200161
Josh Poimboeuf19254592015-12-15 09:39:32 -0600162$(OUTPUT)test-liberty-z.bin:
163 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200164
Josh Poimboeuf19254592015-12-15 09:39:32 -0600165$(OUTPUT)test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200166 $(BUILD) -liberty
167
Josh Poimboeuf19254592015-12-15 09:39:32 -0600168$(OUTPUT)test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200169 $(BUILD)
170
Josh Poimboeuf19254592015-12-15 09:39:32 -0600171$(OUTPUT)test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600172 $(BUILD)
173
Josh Poimboeuf19254592015-12-15 09:39:32 -0600174$(OUTPUT)test-libdw-dwarf-unwind.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100175 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
176
Josh Poimboeuf19254592015-12-15 09:39:32 -0600177$(OUTPUT)test-libbabeltrace.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100178 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
Jiri Olsa45757892014-02-19 16:52:56 +0100179
Josh Poimboeuf19254592015-12-15 09:39:32 -0600180$(OUTPUT)test-sync-compare-and-swap.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +0100181 $(BUILD)
Adrian Hunterf6d31362014-07-14 13:02:53 +0300182
Josh Poimboeuf19254592015-12-15 09:39:32 -0600183$(OUTPUT)test-compile-32.bin:
184 $(CC) -m32 -o $@ test-compile.c
Adrian Huntere477f3f2014-10-23 18:16:03 -0300185
Josh Poimboeuf19254592015-12-15 09:39:32 -0600186$(OUTPUT)test-compile-x32.bin:
187 $(CC) -mx32 -o $@ test-compile.c
Adrian Huntere477f3f2014-10-23 18:16:03 -0300188
Josh Poimboeuf19254592015-12-15 09:39:32 -0600189$(OUTPUT)test-zlib.bin:
Namhyung Kime92ce122014-10-31 16:51:38 +0900190 $(BUILD) -lz
191
Josh Poimboeuf19254592015-12-15 09:39:32 -0600192$(OUTPUT)test-lzma.bin:
Jiri Olsa6c6f0f62015-03-04 11:35:47 +0100193 $(BUILD) -llzma
194
Josh Poimboeuf19254592015-12-15 09:39:32 -0600195$(OUTPUT)test-get_cpuid.bin:
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -0300196 $(BUILD)
197
Josh Poimboeuf19254592015-12-15 09:39:32 -0600198$(OUTPUT)test-bpf.bin:
Wang Nan1b76c132015-07-01 02:13:51 +0000199 $(BUILD)
200
Josh Poimboeuf19254592015-12-15 09:39:32 -0600201-include $(OUTPUT)*.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200202
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200203###############################
204
205clean:
Josh Poimboeuf19254592015-12-15 09:39:32 -0600206 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)