blob: cea04ce9f35cdfb7e5b217077d60b214894b6c48 [file] [log] [blame]
Ingo Molnarb6aa9972013-09-30 10:08:24 +02001
Ingo Molnar3ae069c2013-09-30 13:37:10 +02002FILES= \
Chunwei Chen56560ec2013-12-21 13:48:11 +08003 test-all.bin \
4 test-backtrace.bin \
5 test-bionic.bin \
6 test-dwarf.bin \
7 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 \
27 test-libunwind.bin \
28 test-libunwind-debug-frame.bin \
Vineet Gupta459a3df2015-01-13 19:13:24 +053029 test-pthread-attr-setaffinity-np.bin \
Chunwei Chen56560ec2013-12-21 13:48:11 +080030 test-stackprotector-all.bin \
Jiri Olsa45757892014-02-19 16:52:56 +010031 test-timerfd.bin \
Adrian Huntere477f3f2014-10-23 18:16:03 -030032 test-libdw-dwarf-unwind.bin \
Jiri Olsa53d0a572015-02-20 23:16:58 +010033 test-libbabeltrace.bin \
Adrian Huntere477f3f2014-10-23 18:16:03 -030034 test-compile-32.bin \
Namhyung Kime92ce122014-10-31 16:51:38 +090035 test-compile-x32.bin \
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010036 test-zlib.bin \
Wang Nan1b76c132015-07-01 02:13:51 +000037 test-lzma.bin \
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -030038 test-bpf.bin \
39 test-get_cpuid.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020040
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000041CC := $(CROSS_COMPILE)gcc -MD
42PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020043
Ingo Molnarb6aa9972013-09-30 10:08:24 +020044all: $(FILES)
45
Jiri Olsa806f0722015-03-11 09:01:26 +010046__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
47 BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
Ingo Molnarb6aa9972013-09-30 10:08:24 +020048
49###############################
50
Chunwei Chen56560ec2013-12-21 13:48:11 +080051test-all.bin:
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010052 $(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 +020053
Chunwei Chen56560ec2013-12-21 13:48:11 +080054test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020055 $(BUILD)
56
Vineet Gupta459a3df2015-01-13 19:13:24 +053057test-pthread-attr-setaffinity-np.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010058 $(BUILD) -D_GNU_SOURCE -lpthread
Vineet Gupta459a3df2015-01-13 19:13:24 +053059
Chunwei Chen56560ec2013-12-21 13:48:11 +080060test-stackprotector-all.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010061 $(BUILD) -fstack-protector-all
Ingo Molnar90ac5422013-09-30 13:48:44 +020062
Chunwei Chen56560ec2013-12-21 13:48:11 +080063test-fortify-source.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010064 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
Ingo Molnar1ea6f992013-10-07 09:38:28 +020065
Chunwei Chen56560ec2013-12-21 13:48:11 +080066test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020067 $(BUILD)
68
Chunwei Chen56560ec2013-12-21 13:48:11 +080069test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020070 $(BUILD) -lelf
71
Chunwei Chen56560ec2013-12-21 13:48:11 +080072test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020073 $(BUILD)
74
Andi Kleen7aec51c2015-08-12 15:48:37 -070075DWARFLIBS := -ldw
76ifeq ($(findstring -static,${LDFLAGS}),-static)
77DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
78endif
79
Chunwei Chen56560ec2013-12-21 13:48:11 +080080test-dwarf.bin:
Andi Kleen7aec51c2015-08-12 15:48:37 -070081 $(BUILD) $(DWARFLIBS)
Ingo Molnar8295d4e2013-10-07 10:35:39 +020082
Chunwei Chen56560ec2013-12-21 13:48:11 +080083test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020084 $(BUILD) -lelf
85
Chunwei Chen56560ec2013-12-21 13:48:11 +080086test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020087 $(BUILD) -lelf
88
Chunwei Chen56560ec2013-12-21 13:48:11 +080089test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +020090 $(BUILD) -lnuma
91
Arnaldo Carvalho de Melof8ac8602015-09-17 12:20:28 -030092test-numa_num_possible_cpus.bin:
93 $(BUILD) -lnuma
94
Chunwei Chen56560ec2013-12-21 13:48:11 +080095test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010096 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020097
Chunwei Chen56560ec2013-12-21 13:48:11 +080098test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010099 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +0100100
Chunwei Chen56560ec2013-12-21 13:48:11 +0800101test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +0200102 $(BUILD) -laudit
103
Chunwei Chen56560ec2013-12-21 13:48:11 +0800104test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +0200105 $(BUILD) -I/usr/include/slang -lslang
106
Chunwei Chen56560ec2013-12-21 13:48:11 +0800107test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000108 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +0200109
Chunwei Chen56560ec2013-12-21 13:48:11 +0800110test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000111 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +0200112
Ingo Molnar7181a672013-09-30 15:15:36 +0200113grep-libs = $(filter -l%,$(1))
114strip-libs = $(filter-out -l%,$(1))
115
116PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
117PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
118PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
119PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
120FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
121
Chunwei Chen56560ec2013-12-21 13:48:11 +0800122test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200123 $(BUILD) $(FLAGS_PERL_EMBED)
124
Chunwei Chen56560ec2013-12-21 13:48:11 +0800125test-libpython.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900126 $(BUILD)
Ingo Molnar97341632013-09-30 15:18:37 +0200127
Chunwei Chen56560ec2013-12-21 13:48:11 +0800128test-libpython-version.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900129 $(BUILD)
Ingo Molnar95d061c2013-09-30 15:40:04 +0200130
Chunwei Chen56560ec2013-12-21 13:48:11 +0800131test-libbfd.bin:
Andi Kleen280e7c42014-01-11 11:42:51 -0800132 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200133
Chunwei Chen56560ec2013-12-21 13:48:11 +0800134test-liberty.bin:
Rabin Vincent3af6ed842015-10-29 08:49:37 +0100135 $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200136
Chunwei Chen56560ec2013-12-21 13:48:11 +0800137test-liberty-z.bin:
Rabin Vincent3af6ed842015-10-29 08:49:37 +0100138 $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200139
Chunwei Chen56560ec2013-12-21 13:48:11 +0800140test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200141 $(BUILD) -liberty
142
Chunwei Chen56560ec2013-12-21 13:48:11 +0800143test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200144 $(BUILD)
145
Chunwei Chen56560ec2013-12-21 13:48:11 +0800146test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600147 $(BUILD)
148
Jiri Olsa45757892014-02-19 16:52:56 +0100149test-libdw-dwarf-unwind.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100150 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
151
152test-libbabeltrace.bin:
153 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
Jiri Olsa45757892014-02-19 16:52:56 +0100154
Adrian Hunterf6d31362014-07-14 13:02:53 +0300155test-sync-compare-and-swap.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +0100156 $(BUILD)
Adrian Hunterf6d31362014-07-14 13:02:53 +0300157
Adrian Huntere477f3f2014-10-23 18:16:03 -0300158test-compile-32.bin:
159 $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
160
161test-compile-x32.bin:
162 $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
163
Namhyung Kime92ce122014-10-31 16:51:38 +0900164test-zlib.bin:
165 $(BUILD) -lz
166
Jiri Olsa6c6f0f62015-03-04 11:35:47 +0100167test-lzma.bin:
168 $(BUILD) -llzma
169
Arnaldo Carvalho de Melob0063db2015-09-17 12:54:30 -0300170test-get_cpuid.bin:
171 $(BUILD)
172
Wang Nan1b76c132015-07-01 02:13:51 +0000173test-bpf.bin:
174 $(BUILD)
175
Ingo Molnar231486a2013-10-10 09:10:59 +0200176-include *.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200177
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200178###############################
179
180clean:
Jiri Olsa806f0722015-03-11 09:01:26 +0100181 rm -f $(FILES) *.d $(FILES:.bin=.make.output)