blob: 7cf6fcdacebe625a95b27f53263ad897517dee56 [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 \
29 test-timerfd.bin
Ingo Molnarb6aa9972013-09-30 10:08:24 +020030
Ingo Molnar8b6eb562013-09-30 13:51:28 +020031CC := $(CC) -MD
32
Ingo Molnarb6aa9972013-09-30 10:08:24 +020033all: $(FILES)
34
Chunwei Chen56560ec2013-12-21 13:48:11 +080035BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
Ingo Molnarb6aa9972013-09-30 10:08:24 +020036
37###############################
38
Chunwei Chen56560ec2013-12-21 13:48:11 +080039test-all.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010040 $(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 +020041
Chunwei Chen56560ec2013-12-21 13:48:11 +080042test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020043 $(BUILD)
44
Chunwei Chen56560ec2013-12-21 13:48:11 +080045test-stackprotector-all.bin:
Ingo Molnar90ac5422013-09-30 13:48:44 +020046 $(BUILD) -Werror -fstack-protector-all
47
Chunwei Chen56560ec2013-12-21 13:48:11 +080048test-fortify-source.bin:
Ingo Molnar1ea6f992013-10-07 09:38:28 +020049 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
50
Chunwei Chen56560ec2013-12-21 13:48:11 +080051test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020052 $(BUILD)
53
Chunwei Chen56560ec2013-12-21 13:48:11 +080054test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020055 $(BUILD) -lelf
56
Chunwei Chen56560ec2013-12-21 13:48:11 +080057test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020058 $(BUILD)
59
Chunwei Chen56560ec2013-12-21 13:48:11 +080060test-dwarf.bin:
Ingo Molnar8295d4e2013-10-07 10:35:39 +020061 $(BUILD) -ldw
62
Chunwei Chen56560ec2013-12-21 13:48:11 +080063test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020064 $(BUILD) -lelf
65
Chunwei Chen56560ec2013-12-21 13:48:11 +080066test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020067 $(BUILD) -lelf
68
Chunwei Chen56560ec2013-12-21 13:48:11 +080069test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +020070 $(BUILD) -lnuma
71
Chunwei Chen56560ec2013-12-21 13:48:11 +080072test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010073 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020074
Chunwei Chen56560ec2013-12-21 13:48:11 +080075test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010076 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +010077
Chunwei Chen56560ec2013-12-21 13:48:11 +080078test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +020079 $(BUILD) -laudit
80
Chunwei Chen56560ec2013-12-21 13:48:11 +080081test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +020082 $(BUILD) -I/usr/include/slang -lslang
83
Chunwei Chen56560ec2013-12-21 13:48:11 +080084test-gtk2.bin:
Ingo Molnar7ef9e052013-09-30 15:01:56 +020085 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
86
Chunwei Chen56560ec2013-12-21 13:48:11 +080087test-gtk2-infobar.bin:
Ingo Molnarc7a79e92013-09-30 15:08:30 +020088 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
89
Ingo Molnar7181a672013-09-30 15:15:36 +020090grep-libs = $(filter -l%,$(1))
91strip-libs = $(filter-out -l%,$(1))
92
93PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
94PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
95PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
96PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
97FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
98
Chunwei Chen56560ec2013-12-21 13:48:11 +080099test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200100 $(BUILD) $(FLAGS_PERL_EMBED)
101
Ingo Molnar97341632013-09-30 15:18:37 +0200102override PYTHON := python
103override PYTHON_CONFIG := python-config
104
105escape-for-shell-sq = $(subst ','\'',$(1))
106shell-sq = '$(escape-for-shell-sq)'
107
108PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
109
110PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
111PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
112PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
113PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
114FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
115
Chunwei Chen56560ec2013-12-21 13:48:11 +0800116test-libpython.bin:
Ingo Molnar97341632013-09-30 15:18:37 +0200117 $(BUILD) $(FLAGS_PYTHON_EMBED)
118
Chunwei Chen56560ec2013-12-21 13:48:11 +0800119test-libpython-version.bin:
Ingo Molnar95d061c2013-09-30 15:40:04 +0200120 $(BUILD) $(FLAGS_PYTHON_EMBED)
121
Chunwei Chen56560ec2013-12-21 13:48:11 +0800122test-libbfd.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200123 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200124
Chunwei Chen56560ec2013-12-21 13:48:11 +0800125test-liberty.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200126 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200127
Chunwei Chen56560ec2013-12-21 13:48:11 +0800128test-liberty-z.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200129 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200130
Chunwei Chen56560ec2013-12-21 13:48:11 +0800131test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200132 $(BUILD) -liberty
133
Chunwei Chen56560ec2013-12-21 13:48:11 +0800134test-on-exit.bin:
Ingo Molnar34ef2162013-09-30 16:46:49 +0200135 $(BUILD)
136
Chunwei Chen56560ec2013-12-21 13:48:11 +0800137test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200138 $(BUILD)
139
Chunwei Chen56560ec2013-12-21 13:48:11 +0800140test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600141 $(BUILD)
142
Ingo Molnar231486a2013-10-10 09:10:59 +0200143-include *.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200144
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200145###############################
146
147clean:
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200148 rm -f $(FILES) *.d