blob: 2b492f5480e275aa3688d985c65977b56358c619 [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 \
8 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 \
21 test-libperl.bin \
22 test-libpython.bin \
23 test-libpython-version.bin \
24 test-libslang.bin \
25 test-libunwind.bin \
26 test-libunwind-debug-frame.bin \
27 test-on-exit.bin \
28 test-stackprotector-all.bin \
Jiri Olsa45757892014-02-19 16:52:56 +010029 test-timerfd.bin \
30 test-libdw-dwarf-unwind.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020031
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000032CC := $(CROSS_COMPILE)gcc -MD
33PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020034
Ingo Molnarb6aa9972013-09-30 10:08:24 +020035all: $(FILES)
36
Chunwei Chen56560ec2013-12-21 13:48:11 +080037BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
Ingo Molnarb6aa9972013-09-30 10:08:24 +020038
39###############################
40
Chunwei Chen56560ec2013-12-21 13:48:11 +080041test-all.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000042 $(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
Ingo Molnarbaa9c302013-10-01 14:14:31 +020043
Chunwei Chen56560ec2013-12-21 13:48:11 +080044test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020045 $(BUILD)
46
Chunwei Chen56560ec2013-12-21 13:48:11 +080047test-stackprotector-all.bin:
Ingo Molnar90ac5422013-09-30 13:48:44 +020048 $(BUILD) -Werror -fstack-protector-all
49
Chunwei Chen56560ec2013-12-21 13:48:11 +080050test-fortify-source.bin:
Ingo Molnar1ea6f992013-10-07 09:38:28 +020051 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
52
Chunwei Chen56560ec2013-12-21 13:48:11 +080053test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020054 $(BUILD)
55
Chunwei Chen56560ec2013-12-21 13:48:11 +080056test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020057 $(BUILD) -lelf
58
Chunwei Chen56560ec2013-12-21 13:48:11 +080059test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020060 $(BUILD)
61
Chunwei Chen56560ec2013-12-21 13:48:11 +080062test-dwarf.bin:
Ingo Molnar8295d4e2013-10-07 10:35:39 +020063 $(BUILD) -ldw
64
Chunwei Chen56560ec2013-12-21 13:48:11 +080065test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020066 $(BUILD) -lelf
67
Chunwei Chen56560ec2013-12-21 13:48:11 +080068test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020069 $(BUILD) -lelf
70
Chunwei Chen56560ec2013-12-21 13:48:11 +080071test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +020072 $(BUILD) -lnuma
73
Chunwei Chen56560ec2013-12-21 13:48:11 +080074test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010075 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020076
Chunwei Chen56560ec2013-12-21 13:48:11 +080077test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010078 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +010079
Chunwei Chen56560ec2013-12-21 13:48:11 +080080test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +020081 $(BUILD) -laudit
82
Chunwei Chen56560ec2013-12-21 13:48:11 +080083test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +020084 $(BUILD) -I/usr/include/slang -lslang
85
Chunwei Chen56560ec2013-12-21 13:48:11 +080086test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000087 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +020088
Chunwei Chen56560ec2013-12-21 13:48:11 +080089test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000090 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +020091
Ingo Molnar7181a672013-09-30 15:15:36 +020092grep-libs = $(filter -l%,$(1))
93strip-libs = $(filter-out -l%,$(1))
94
95PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
96PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
97PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
98PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
99FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
100
Chunwei Chen56560ec2013-12-21 13:48:11 +0800101test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200102 $(BUILD) $(FLAGS_PERL_EMBED)
103
Ingo Molnar97341632013-09-30 15:18:37 +0200104override PYTHON := python
105override PYTHON_CONFIG := python-config
106
107escape-for-shell-sq = $(subst ','\'',$(1))
108shell-sq = '$(escape-for-shell-sq)'
109
110PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
111
112PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
113PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
114PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
115PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
116FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
117
Chunwei Chen56560ec2013-12-21 13:48:11 +0800118test-libpython.bin:
Ingo Molnar97341632013-09-30 15:18:37 +0200119 $(BUILD) $(FLAGS_PYTHON_EMBED)
120
Chunwei Chen56560ec2013-12-21 13:48:11 +0800121test-libpython-version.bin:
Ingo Molnar95d061c2013-09-30 15:40:04 +0200122 $(BUILD) $(FLAGS_PYTHON_EMBED)
123
Chunwei Chen56560ec2013-12-21 13:48:11 +0800124test-libbfd.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200125 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200126
Chunwei Chen56560ec2013-12-21 13:48:11 +0800127test-liberty.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200128 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200129
Chunwei Chen56560ec2013-12-21 13:48:11 +0800130test-liberty-z.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200131 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200132
Chunwei Chen56560ec2013-12-21 13:48:11 +0800133test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200134 $(BUILD) -liberty
135
Chunwei Chen56560ec2013-12-21 13:48:11 +0800136test-on-exit.bin:
Ingo Molnar34ef2162013-09-30 16:46:49 +0200137 $(BUILD)
138
Chunwei Chen56560ec2013-12-21 13:48:11 +0800139test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200140 $(BUILD)
141
Chunwei Chen56560ec2013-12-21 13:48:11 +0800142test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600143 $(BUILD)
144
Jiri Olsa45757892014-02-19 16:52:56 +0100145test-libdw-dwarf-unwind.bin:
146 $(BUILD)
147
Ingo Molnar231486a2013-10-10 09:10:59 +0200148-include *.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200149
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200150###############################
151
152clean:
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200153 rm -f $(FILES) *.d