blob: 463ed8f2a267bd6ad58f0a96656ea342574d3865 [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 \
22 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 \
36 test-lzma.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020037
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000038CC := $(CROSS_COMPILE)gcc -MD
39PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020040
Ingo Molnarb6aa9972013-09-30 10:08:24 +020041all: $(FILES)
42
Jiri Olsa806f0722015-03-11 09:01:26 +010043__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
44 BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
Ingo Molnarb6aa9972013-09-30 10:08:24 +020045
46###############################
47
Chunwei Chen56560ec2013-12-21 13:48:11 +080048test-all.bin:
Jiri Olsa6c6f0f62015-03-04 11:35:47 +010049 $(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 +020050
Chunwei Chen56560ec2013-12-21 13:48:11 +080051test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020052 $(BUILD)
53
Vineet Gupta459a3df2015-01-13 19:13:24 +053054test-pthread-attr-setaffinity-np.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010055 $(BUILD) -D_GNU_SOURCE -lpthread
Vineet Gupta459a3df2015-01-13 19:13:24 +053056
Chunwei Chen56560ec2013-12-21 13:48:11 +080057test-stackprotector-all.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010058 $(BUILD) -fstack-protector-all
Ingo Molnar90ac5422013-09-30 13:48:44 +020059
Chunwei Chen56560ec2013-12-21 13:48:11 +080060test-fortify-source.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +010061 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
Ingo Molnar1ea6f992013-10-07 09:38:28 +020062
Chunwei Chen56560ec2013-12-21 13:48:11 +080063test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020064 $(BUILD)
65
Chunwei Chen56560ec2013-12-21 13:48:11 +080066test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020067 $(BUILD) -lelf
68
Chunwei Chen56560ec2013-12-21 13:48:11 +080069test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020070 $(BUILD)
71
Chunwei Chen56560ec2013-12-21 13:48:11 +080072test-dwarf.bin:
Ingo Molnar8295d4e2013-10-07 10:35:39 +020073 $(BUILD) -ldw
74
Chunwei Chen56560ec2013-12-21 13:48:11 +080075test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020076 $(BUILD) -lelf
77
Chunwei Chen56560ec2013-12-21 13:48:11 +080078test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020079 $(BUILD) -lelf
80
Chunwei Chen56560ec2013-12-21 13:48:11 +080081test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +020082 $(BUILD) -lnuma
83
Chunwei Chen56560ec2013-12-21 13:48:11 +080084test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010085 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020086
Chunwei Chen56560ec2013-12-21 13:48:11 +080087test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010088 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +010089
Chunwei Chen56560ec2013-12-21 13:48:11 +080090test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +020091 $(BUILD) -laudit
92
Chunwei Chen56560ec2013-12-21 13:48:11 +080093test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +020094 $(BUILD) -I/usr/include/slang -lslang
95
Chunwei Chen56560ec2013-12-21 13:48:11 +080096test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000097 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +020098
Chunwei Chen56560ec2013-12-21 13:48:11 +080099test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +0000100 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +0200101
Ingo Molnar7181a672013-09-30 15:15:36 +0200102grep-libs = $(filter -l%,$(1))
103strip-libs = $(filter-out -l%,$(1))
104
105PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
106PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
107PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
108PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
109FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
110
Chunwei Chen56560ec2013-12-21 13:48:11 +0800111test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200112 $(BUILD) $(FLAGS_PERL_EMBED)
113
Chunwei Chen56560ec2013-12-21 13:48:11 +0800114test-libpython.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900115 $(BUILD)
Ingo Molnar97341632013-09-30 15:18:37 +0200116
Chunwei Chen56560ec2013-12-21 13:48:11 +0800117test-libpython-version.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900118 $(BUILD)
Ingo Molnar95d061c2013-09-30 15:40:04 +0200119
Chunwei Chen56560ec2013-12-21 13:48:11 +0800120test-libbfd.bin:
Andi Kleen280e7c42014-01-11 11:42:51 -0800121 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200122
Chunwei Chen56560ec2013-12-21 13:48:11 +0800123test-liberty.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +0100124 $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200125
Chunwei Chen56560ec2013-12-21 13:48:11 +0800126test-liberty-z.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +0100127 $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200128
Chunwei Chen56560ec2013-12-21 13:48:11 +0800129test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200130 $(BUILD) -liberty
131
Chunwei Chen56560ec2013-12-21 13:48:11 +0800132test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200133 $(BUILD)
134
Chunwei Chen56560ec2013-12-21 13:48:11 +0800135test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600136 $(BUILD)
137
Jiri Olsa45757892014-02-19 16:52:56 +0100138test-libdw-dwarf-unwind.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100139 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
140
141test-libbabeltrace.bin:
142 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
Jiri Olsa45757892014-02-19 16:52:56 +0100143
Adrian Hunterf6d31362014-07-14 13:02:53 +0300144test-sync-compare-and-swap.bin:
Ingo Molnarb49f1a42015-02-28 10:16:27 +0100145 $(BUILD)
Adrian Hunterf6d31362014-07-14 13:02:53 +0300146
Adrian Huntere477f3f2014-10-23 18:16:03 -0300147test-compile-32.bin:
148 $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
149
150test-compile-x32.bin:
151 $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
152
Namhyung Kime92ce122014-10-31 16:51:38 +0900153test-zlib.bin:
154 $(BUILD) -lz
155
Jiri Olsa6c6f0f62015-03-04 11:35:47 +0100156test-lzma.bin:
157 $(BUILD) -llzma
158
Ingo Molnar231486a2013-10-10 09:10:59 +0200159-include *.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200160
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200161###############################
162
163clean:
Jiri Olsa806f0722015-03-11 09:01:26 +0100164 rm -f $(FILES) *.d $(FILES:.bin=.make.output)