blob: 42ac05aaf8ac1a8bf004c1e664aa10a1853111bc [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 \
32 test-compile-32.bin \
Namhyung Kime92ce122014-10-31 16:51:38 +090033 test-compile-x32.bin \
34 test-zlib.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020035
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000036CC := $(CROSS_COMPILE)gcc -MD
37PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020038
Ingo Molnarb6aa9972013-09-30 10:08:24 +020039all: $(FILES)
40
Chunwei Chen56560ec2013-12-21 13:48:11 +080041BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
Ingo Molnarb6aa9972013-09-30 10:08:24 +020042
43###############################
44
Chunwei Chen56560ec2013-12-21 13:48:11 +080045test-all.bin:
Namhyung Kime92ce122014-10-31 16:51:38 +090046 $(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
Ingo Molnarbaa9c302013-10-01 14:14:31 +020047
Chunwei Chen56560ec2013-12-21 13:48:11 +080048test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020049 $(BUILD)
50
Vineet Gupta459a3df2015-01-13 19:13:24 +053051test-pthread-attr-setaffinity-np.bin:
52 $(BUILD) -Werror -lpthread
53
Chunwei Chen56560ec2013-12-21 13:48:11 +080054test-stackprotector-all.bin:
Ingo Molnar90ac5422013-09-30 13:48:44 +020055 $(BUILD) -Werror -fstack-protector-all
56
Chunwei Chen56560ec2013-12-21 13:48:11 +080057test-fortify-source.bin:
Ingo Molnar1ea6f992013-10-07 09:38:28 +020058 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
59
Chunwei Chen56560ec2013-12-21 13:48:11 +080060test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020061 $(BUILD)
62
Chunwei Chen56560ec2013-12-21 13:48:11 +080063test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020064 $(BUILD) -lelf
65
Chunwei Chen56560ec2013-12-21 13:48:11 +080066test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020067 $(BUILD)
68
Chunwei Chen56560ec2013-12-21 13:48:11 +080069test-dwarf.bin:
Ingo Molnar8295d4e2013-10-07 10:35:39 +020070 $(BUILD) -ldw
71
Chunwei Chen56560ec2013-12-21 13:48:11 +080072test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020073 $(BUILD) -lelf
74
Chunwei Chen56560ec2013-12-21 13:48:11 +080075test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020076 $(BUILD) -lelf
77
Chunwei Chen56560ec2013-12-21 13:48:11 +080078test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +020079 $(BUILD) -lnuma
80
Chunwei Chen56560ec2013-12-21 13:48:11 +080081test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010082 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020083
Chunwei Chen56560ec2013-12-21 13:48:11 +080084test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010085 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +010086
Chunwei Chen56560ec2013-12-21 13:48:11 +080087test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +020088 $(BUILD) -laudit
89
Chunwei Chen56560ec2013-12-21 13:48:11 +080090test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +020091 $(BUILD) -I/usr/include/slang -lslang
92
Chunwei Chen56560ec2013-12-21 13:48:11 +080093test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000094 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +020095
Chunwei Chen56560ec2013-12-21 13:48:11 +080096test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000097 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +020098
Ingo Molnar7181a672013-09-30 15:15:36 +020099grep-libs = $(filter -l%,$(1))
100strip-libs = $(filter-out -l%,$(1))
101
102PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
103PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
104PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
105PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
106FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
107
Chunwei Chen56560ec2013-12-21 13:48:11 +0800108test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200109 $(BUILD) $(FLAGS_PERL_EMBED)
110
Chunwei Chen56560ec2013-12-21 13:48:11 +0800111test-libpython.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900112 $(BUILD)
Ingo Molnar97341632013-09-30 15:18:37 +0200113
Chunwei Chen56560ec2013-12-21 13:48:11 +0800114test-libpython-version.bin:
Namhyung Kim56c7d792014-07-29 15:57:19 +0900115 $(BUILD)
Ingo Molnar95d061c2013-09-30 15:40:04 +0200116
Chunwei Chen56560ec2013-12-21 13:48:11 +0800117test-libbfd.bin:
Andi Kleen280e7c42014-01-11 11:42:51 -0800118 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200119
Chunwei Chen56560ec2013-12-21 13:48:11 +0800120test-liberty.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200121 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200122
Chunwei Chen56560ec2013-12-21 13:48:11 +0800123test-liberty-z.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200124 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200125
Chunwei Chen56560ec2013-12-21 13:48:11 +0800126test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200127 $(BUILD) -liberty
128
Chunwei Chen56560ec2013-12-21 13:48:11 +0800129test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200130 $(BUILD)
131
Chunwei Chen56560ec2013-12-21 13:48:11 +0800132test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600133 $(BUILD)
134
Jiri Olsa45757892014-02-19 16:52:56 +0100135test-libdw-dwarf-unwind.bin:
136 $(BUILD)
137
Adrian Hunterf6d31362014-07-14 13:02:53 +0300138test-sync-compare-and-swap.bin:
139 $(BUILD) -Werror
140
Adrian Huntere477f3f2014-10-23 18:16:03 -0300141test-compile-32.bin:
142 $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
143
144test-compile-x32.bin:
145 $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
146
Namhyung Kime92ce122014-10-31 16:51:38 +0900147test-zlib.bin:
148 $(BUILD) -lz
149
Ingo Molnar231486a2013-10-10 09:10:59 +0200150-include *.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200151
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200152###############################
153
154clean:
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200155 rm -f $(FILES) *.d