blob: 523b7bc1055321051d62562f1f490165ea2872b5 [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
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000031CC := $(CROSS_COMPILE)gcc -MD
32PKG_CONFIG := $(CROSS_COMPILE)pkg-config
Ingo Molnar8b6eb562013-09-30 13:51:28 +020033
Ingo Molnarb6aa9972013-09-30 10:08:24 +020034all: $(FILES)
35
Chunwei Chen56560ec2013-12-21 13:48:11 +080036BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
Ingo Molnarb6aa9972013-09-30 10:08:24 +020037
38###############################
39
Chunwei Chen56560ec2013-12-21 13:48:11 +080040test-all.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000041 $(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 +020042
Chunwei Chen56560ec2013-12-21 13:48:11 +080043test-hello.bin:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020044 $(BUILD)
45
Chunwei Chen56560ec2013-12-21 13:48:11 +080046test-stackprotector-all.bin:
Ingo Molnar90ac5422013-09-30 13:48:44 +020047 $(BUILD) -Werror -fstack-protector-all
48
Chunwei Chen56560ec2013-12-21 13:48:11 +080049test-fortify-source.bin:
Ingo Molnar1ea6f992013-10-07 09:38:28 +020050 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
51
Chunwei Chen56560ec2013-12-21 13:48:11 +080052test-bionic.bin:
Ingo Molnar78e9d652013-09-30 14:11:46 +020053 $(BUILD)
54
Chunwei Chen56560ec2013-12-21 13:48:11 +080055test-libelf.bin:
Ingo Molnar8f7f8002013-09-30 14:20:25 +020056 $(BUILD) -lelf
57
Chunwei Chen56560ec2013-12-21 13:48:11 +080058test-glibc.bin:
Ingo Molnare12762c2013-10-07 10:34:20 +020059 $(BUILD)
60
Chunwei Chen56560ec2013-12-21 13:48:11 +080061test-dwarf.bin:
Ingo Molnar8295d4e2013-10-07 10:35:39 +020062 $(BUILD) -ldw
63
Chunwei Chen56560ec2013-12-21 13:48:11 +080064test-libelf-mmap.bin:
Ingo Molnar8869b172013-09-30 15:02:28 +020065 $(BUILD) -lelf
66
Chunwei Chen56560ec2013-12-21 13:48:11 +080067test-libelf-getphdrnum.bin:
Ingo Molnarb7bcef62013-09-30 14:35:27 +020068 $(BUILD) -lelf
69
Chunwei Chen56560ec2013-12-21 13:48:11 +080070test-libnuma.bin:
Ingo Molnar3ae069c2013-09-30 13:37:10 +020071 $(BUILD) -lnuma
72
Chunwei Chen56560ec2013-12-21 13:48:11 +080073test-libunwind.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010074 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020075
Chunwei Chen56560ec2013-12-21 13:48:11 +080076test-libunwind-debug-frame.bin:
Jean Pihet1448fef2013-12-10 13:24:04 +010077 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +010078
Chunwei Chen56560ec2013-12-21 13:48:11 +080079test-libaudit.bin:
Ingo Molnard795a652013-09-30 14:55:31 +020080 $(BUILD) -laudit
81
Chunwei Chen56560ec2013-12-21 13:48:11 +080082test-libslang.bin:
Ingo Molnarb9498b52013-09-30 14:57:54 +020083 $(BUILD) -I/usr/include/slang -lslang
84
Chunwei Chen56560ec2013-12-21 13:48:11 +080085test-gtk2.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000086 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnar7ef9e052013-09-30 15:01:56 +020087
Chunwei Chen56560ec2013-12-21 13:48:11 +080088test-gtk2-infobar.bin:
Mark Rutlanda8a5cd82014-01-15 10:44:08 +000089 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
Ingo Molnarc7a79e92013-09-30 15:08:30 +020090
Ingo Molnar7181a672013-09-30 15:15:36 +020091grep-libs = $(filter -l%,$(1))
92strip-libs = $(filter-out -l%,$(1))
93
94PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
95PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
96PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
97PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
98FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
99
Chunwei Chen56560ec2013-12-21 13:48:11 +0800100test-libperl.bin:
Ingo Molnar7181a672013-09-30 15:15:36 +0200101 $(BUILD) $(FLAGS_PERL_EMBED)
102
Ingo Molnar97341632013-09-30 15:18:37 +0200103override PYTHON := python
104override PYTHON_CONFIG := python-config
105
106escape-for-shell-sq = $(subst ','\'',$(1))
107shell-sq = '$(escape-for-shell-sq)'
108
109PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
110
111PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
112PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
113PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
114PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
115FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
116
Chunwei Chen56560ec2013-12-21 13:48:11 +0800117test-libpython.bin:
Ingo Molnar97341632013-09-30 15:18:37 +0200118 $(BUILD) $(FLAGS_PYTHON_EMBED)
119
Chunwei Chen56560ec2013-12-21 13:48:11 +0800120test-libpython-version.bin:
Ingo Molnar95d061c2013-09-30 15:40:04 +0200121 $(BUILD) $(FLAGS_PYTHON_EMBED)
122
Chunwei Chen56560ec2013-12-21 13:48:11 +0800123test-libbfd.bin:
Andi Kleen280e7c42014-01-11 11:42:51 -0800124 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200125
Chunwei Chen56560ec2013-12-21 13:48:11 +0800126test-liberty.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200127 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200128
Chunwei Chen56560ec2013-12-21 13:48:11 +0800129test-liberty-z.bin:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200130 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200131
Chunwei Chen56560ec2013-12-21 13:48:11 +0800132test-cplus-demangle.bin:
Ingo Molnar1c476612013-10-02 15:15:09 +0200133 $(BUILD) -liberty
134
Chunwei Chen56560ec2013-12-21 13:48:11 +0800135test-on-exit.bin:
Ingo Molnar34ef2162013-09-30 16:46:49 +0200136 $(BUILD)
137
Chunwei Chen56560ec2013-12-21 13:48:11 +0800138test-backtrace.bin:
Ingo Molnar4cc91172013-09-30 16:49:38 +0200139 $(BUILD)
140
Chunwei Chen56560ec2013-12-21 13:48:11 +0800141test-timerfd.bin:
David Ahern87419c92013-10-29 10:43:16 -0600142 $(BUILD)
143
Ingo Molnar231486a2013-10-10 09:10:59 +0200144-include *.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200145
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200146###############################
147
148clean:
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200149 rm -f $(FILES) *.d