blob: bf8f0352264dcc8a5a1286bc4add2ca9de481357 [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 \
6 test-fortify-source.bin \
Adrian Hunterf6d31362014-07-14 13:02:53 +03007 test-sync-compare-and-swap.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +08008 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 \
Arnaldo Carvalho de Melof8ac8602015-09-17 12:20:28 -030021 test-numa_num_possible_cpus.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080022 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 \
Vineet Gupta459a3df2015-01-13 19:13:24 +053028 test-pthread-attr-setaffinity-np.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080029 test-stackprotector-all.bin \
Jiri Olsa45757892014-02-19 16:52:56 +010030 test-timerfd.bin \
Adrian Huntere477f3f2014-10-23 18:16:03 -030031 test-libdw-dwarf-unwind.bin \
Jiri Olsa53d0a572015-02-20 23:16:58 +010032 test-libbabeltrace.bin \
Adrian Huntere477f3f2014-10-23 18:16:03 -030033 test-compile-32.bin \
Namhyung Kime92ce122014-10-31 16:51:38 +090034 test-compile-x32.bin \
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010035 test-zlib.bin \
Wang Nan1b76c132015-07-01 02:13:51 +000036 test-lzma.bin \
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -030037 test-bpf.bin \
38 test-get_cpuid.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020039
Josh Poimboeuf19254592015-12-15 09:39:32 -060040FILES := $(addprefix $(OUTPUT),$(FILES))
41
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000042CC := $(CROSS_COMPILE)gcc -MD
43PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020044
Ingo Molnarb6aa9972013-09-30 10:08:24 +020045all: $(FILES)
46
Josh Poimboeuf19254592015-12-15 09:39:32 -060047__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
48 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
Ingo Molnarb6aa9972013-09-30 10:08:24 +020049
50###############################
51
Josh Poimboeuf19254592015-12-15 09:39:32 -060052$(OUTPUT)test-all.bin:
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010053 $(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 +020054
Josh Poimboeuf19254592015-12-15 09:39:32 -060055$(OUTPUT)test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020056 $(BUILD)
57
Josh Poimboeuf19254592015-12-15 09:39:32 -060058$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010059 $(BUILD) -D_GNU_SOURCE -lpthread
Vineet Gupta459a3df2015-01-13 19:13:24 +053060
Josh Poimboeuf19254592015-12-15 09:39:32 -060061$(OUTPUT)test-stackprotector-all.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010062 $(BUILD) -fstack-protector-all
Ingo Molnar90ac5422013-09-30 13:48:44 +020063
Josh Poimboeuf19254592015-12-15 09:39:32 -060064$(OUTPUT)test-fortify-source.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010065 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
Ingo Molnar1ea6f992013-10-07 09:38:28 +020066
Josh Poimboeuf19254592015-12-15 09:39:32 -060067$(OUTPUT)test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020068 $(BUILD)
69
Josh Poimboeuf19254592015-12-15 09:39:32 -060070$(OUTPUT)test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020071 $(BUILD) -lelf
72
Josh Poimboeuf19254592015-12-15 09:39:32 -060073$(OUTPUT)test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020074 $(BUILD)
75
Andi Kleen7aec51c2015-08-12 15:48:37 -070076DWARFLIBS := -ldw
77ifeq ($(findstring -static,${LDFLAGS}),-static)
78DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
79endif
80
Josh Poimboeuf19254592015-12-15 09:39:32 -060081$(OUTPUT)test-dwarf.bin:
Andi Kleen7aec51c2015-08-12 15:48:37 -070082 $(BUILD) $(DWARFLIBS)
Ingo Molnar8295d4e2013-10-07 10:35:39 +020083
Josh Poimboeuf19254592015-12-15 09:39:32 -060084$(OUTPUT)test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020085 $(BUILD) -lelf
86
Josh Poimboeuf19254592015-12-15 09:39:32 -060087$(OUTPUT)test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020088 $(BUILD) -lelf
89
Josh Poimboeuf19254592015-12-15 09:39:32 -060090$(OUTPUT)test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +020091 $(BUILD) -lnuma
92
Josh Poimboeuf19254592015-12-15 09:39:32 -060093$(OUTPUT)test-numa_num_possible_cpus.bin:
Arnaldo Carvalho de Melof8ac8602015-09-17 12:20:28 -030094 $(BUILD) -lnuma
95
Josh Poimboeuf19254592015-12-15 09:39:32 -060096$(OUTPUT)test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010097 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020098
Josh Poimboeuf19254592015-12-15 09:39:32 -060099$(OUTPUT)test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +0100100 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +0100101
Josh Poimboeuf19254592015-12-15 09:39:32 -0600102$(OUTPUT)test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +0200103 $(BUILD) -laudit
104
Josh Poimboeuf19254592015-12-15 09:39:32 -0600105$(OUTPUT)test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +0200106 $(BUILD) -I/usr/include/slang -lslang
107
Josh Poimboeuf19254592015-12-15 09:39:32 -0600108$(OUTPUT)test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000109 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +0200110
Josh Poimboeuf19254592015-12-15 09:39:32 -0600111$(OUTPUT)test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000112 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +0200113
Ingo Molnar7181a672013-09-30 15:15:36 +0200114grep-libs = $(filter -l%,$(1))
115strip-libs = $(filter-out -l%,$(1))
116
117PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
118PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
119PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
120PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
121FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
122
Josh Poimboeuf19254592015-12-15 09:39:32 -0600123$(OUTPUT)test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200124 $(BUILD) $(FLAGS_PERL_EMBED)
125
Josh Poimboeuf19254592015-12-15 09:39:32 -0600126$(OUTPUT)test-libpython.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900127 $(BUILD)
Ingo Molnar97341632013-09-30 15:18:37 +0200128
Josh Poimboeuf19254592015-12-15 09:39:32 -0600129$(OUTPUT)test-libpython-version.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900130 $(BUILD)
Ingo Molnar95d061c2013-09-30 15:40:04 +0200131
Josh Poimboeuf19254592015-12-15 09:39:32 -0600132$(OUTPUT)test-libbfd.bin:
Andi Kleen280e7c42014-01-11 11:42:51 -0800133 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200134
Josh Poimboeuf19254592015-12-15 09:39:32 -0600135$(OUTPUT)test-liberty.bin:
136 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200137
Josh Poimboeuf19254592015-12-15 09:39:32 -0600138$(OUTPUT)test-liberty-z.bin:
139 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200140
Josh Poimboeuf19254592015-12-15 09:39:32 -0600141$(OUTPUT)test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200142 $(BUILD) -liberty
143
Josh Poimboeuf19254592015-12-15 09:39:32 -0600144$(OUTPUT)test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200145 $(BUILD)
146
Josh Poimboeuf19254592015-12-15 09:39:32 -0600147$(OUTPUT)test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600148 $(BUILD)
149
Josh Poimboeuf19254592015-12-15 09:39:32 -0600150$(OUTPUT)test-libdw-dwarf-unwind.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100151 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
152
Josh Poimboeuf19254592015-12-15 09:39:32 -0600153$(OUTPUT)test-libbabeltrace.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100154 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
Jiri Olsa45757892014-02-19 16:52:56 +0100155
Josh Poimboeuf19254592015-12-15 09:39:32 -0600156$(OUTPUT)test-sync-compare-and-swap.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +0100157 $(BUILD)
Adrian Hunterf6d31362014-07-14 13:02:53 +0300158
Josh Poimboeuf19254592015-12-15 09:39:32 -0600159$(OUTPUT)test-compile-32.bin:
160 $(CC) -m32 -o $@ test-compile.c
Adrian Huntere477f3f2014-10-23 18:16:03 -0300161
Josh Poimboeuf19254592015-12-15 09:39:32 -0600162$(OUTPUT)test-compile-x32.bin:
163 $(CC) -mx32 -o $@ test-compile.c
Adrian Huntere477f3f2014-10-23 18:16:03 -0300164
Josh Poimboeuf19254592015-12-15 09:39:32 -0600165$(OUTPUT)test-zlib.bin:
Namhyung Kime92ce122014-10-31 16:51:38 +0900166 $(BUILD) -lz
167
Josh Poimboeuf19254592015-12-15 09:39:32 -0600168$(OUTPUT)test-lzma.bin:
Jiri Olsa6c6f0f62015-03-04 11:35:47 +0100169 $(BUILD) -llzma
170
Josh Poimboeuf19254592015-12-15 09:39:32 -0600171$(OUTPUT)test-get_cpuid.bin:
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -0300172 $(BUILD)
173
Josh Poimboeuf19254592015-12-15 09:39:32 -0600174$(OUTPUT)test-bpf.bin:
Wang Nan1b76c132015-07-01 02:13:51 +0000175 $(BUILD)
176
Josh Poimboeuf19254592015-12-15 09:39:32 -0600177-include $(OUTPUT)*.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200178
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200179###############################
180
181clean:
Josh Poimboeuf19254592015-12-15 09:39:32 -0600182 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)