blob: 70c9aebe9da3a62086d47bedc1731063a5d3c31f [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 \
35 test-zlib.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020036
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000037CC := $(CROSS_COMPILE)gcc -MD
38PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020039
Ingo Molnarb6aa9972013-09-30 10:08:24 +020040all: $(FILES)
41
Chunwei Chen56560ec2013-12-21 13:48:11 +080042BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
Ingo Molnarb6aa9972013-09-30 10:08:24 +020043
44###############################
45
Chunwei Chen56560ec2013-12-21 13:48:11 +080046test-all.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +010047 $(BUILD) -Werror -fstack-protector-all -O2 -Werror -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 -lbabeltrace
Ingo Molnarbaa9c302013-10-01 14:14:31 +020048
Chunwei Chen56560ec2013-12-21 13:48:11 +080049test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020050 $(BUILD)
51
Vineet Gupta459a3df2015-01-13 19:13:24 +053052test-pthread-attr-setaffinity-np.bin:
Josh Boyer39f57042015-02-11 11:24:05 -050053 $(BUILD) -D_GNU_SOURCE -Werror -lpthread
Vineet Gupta459a3df2015-01-13 19:13:24 +053054
Chunwei Chen56560ec2013-12-21 13:48:11 +080055test-stackprotector-all.bin:
Ingo Molnar90ac5422013-09-30 13:48:44 +020056 $(BUILD) -Werror -fstack-protector-all
57
Chunwei Chen56560ec2013-12-21 13:48:11 +080058test-fortify-source.bin:
Ingo Molnar1ea6f992013-10-07 09:38:28 +020059 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
60
Chunwei Chen56560ec2013-12-21 13:48:11 +080061test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020062 $(BUILD)
63
Chunwei Chen56560ec2013-12-21 13:48:11 +080064test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020065 $(BUILD) -lelf
66
Chunwei Chen56560ec2013-12-21 13:48:11 +080067test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020068 $(BUILD)
69
Chunwei Chen56560ec2013-12-21 13:48:11 +080070test-dwarf.bin:
Ingo Molnar8295d4e2013-10-07 10:35:39 +020071 $(BUILD) -ldw
72
Chunwei Chen56560ec2013-12-21 13:48:11 +080073test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020074 $(BUILD) -lelf
75
Chunwei Chen56560ec2013-12-21 13:48:11 +080076test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020077 $(BUILD) -lelf
78
Chunwei Chen56560ec2013-12-21 13:48:11 +080079test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +020080 $(BUILD) -lnuma
81
Chunwei Chen56560ec2013-12-21 13:48:11 +080082test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010083 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020084
Chunwei Chen56560ec2013-12-21 13:48:11 +080085test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010086 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +010087
Chunwei Chen56560ec2013-12-21 13:48:11 +080088test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +020089 $(BUILD) -laudit
90
Chunwei Chen56560ec2013-12-21 13:48:11 +080091test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +020092 $(BUILD) -I/usr/include/slang -lslang
93
Chunwei Chen56560ec2013-12-21 13:48:11 +080094test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000095 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +020096
Chunwei Chen56560ec2013-12-21 13:48:11 +080097test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000098 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +020099
Ingo Molnar7181a672013-09-30 15:15:36 +0200100grep-libs = $(filter -l%,$(1))
101strip-libs = $(filter-out -l%,$(1))
102
103PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
104PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
105PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
106PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
107FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
108
Chunwei Chen56560ec2013-12-21 13:48:11 +0800109test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200110 $(BUILD) $(FLAGS_PERL_EMBED)
111
Chunwei Chen56560ec2013-12-21 13:48:11 +0800112test-libpython.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900113 $(BUILD)
Ingo Molnar97341632013-09-30 15:18:37 +0200114
Chunwei Chen56560ec2013-12-21 13:48:11 +0800115test-libpython-version.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900116 $(BUILD)
Ingo Molnar95d061c2013-09-30 15:40:04 +0200117
Chunwei Chen56560ec2013-12-21 13:48:11 +0800118test-libbfd.bin:
Andi Kleen280e7c42014-01-11 11:42:51 -0800119 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200120
Chunwei Chen56560ec2013-12-21 13:48:11 +0800121test-liberty.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200122 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200123
Chunwei Chen56560ec2013-12-21 13:48:11 +0800124test-liberty-z.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200125 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200126
Chunwei Chen56560ec2013-12-21 13:48:11 +0800127test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200128 $(BUILD) -liberty
129
Chunwei Chen56560ec2013-12-21 13:48:11 +0800130test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200131 $(BUILD)
132
Chunwei Chen56560ec2013-12-21 13:48:11 +0800133test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600134 $(BUILD)
135
Jiri Olsa45757892014-02-19 16:52:56 +0100136test-libdw-dwarf-unwind.bin:
Jiri Olsa53d0a572015-02-20 23:16:58 +0100137 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
138
139test-libbabeltrace.bin:
140 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
Jiri Olsa45757892014-02-19 16:52:56 +0100141
Adrian Hunterf6d31362014-07-14 13:02:53 +0300142test-sync-compare-and-swap.bin:
143 $(BUILD) -Werror
144
Adrian Huntere477f3f2014-10-23 18:16:03 -0300145test-compile-32.bin:
146 $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
147
148test-compile-x32.bin:
149 $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
150
Namhyung Kime92ce122014-10-31 16:51:38 +0900151test-zlib.bin:
152 $(BUILD) -lz
153
Ingo Molnar231486a2013-10-10 09:10:59 +0200154-include *.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200155
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200156###############################
157
158clean:
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200159 rm -f $(FILES) *.d