blob: 87e790017c6988b856e3b4e8b47f572a9d8beea9 [file] [log] [blame]
Ingo Molnarb6aa9972013-09-30 10:08:24 +02001
Ingo Molnar3ae069c2013-09-30 13:37:10 +02002FILES= \
Ingo Molnarf1138ec2013-10-02 09:54:43 +02003 test-all \
4 test-backtrace \
Ingo Molnar78e9d652013-09-30 14:11:46 +02005 test-bionic \
Ingo Molnar8295d4e2013-10-07 10:35:39 +02006 test-dwarf \
Ingo Molnarf1138ec2013-10-02 09:54:43 +02007 test-fortify-source \
8 test-glibc \
Ingo Molnar7ef9e052013-09-30 15:01:56 +02009 test-gtk2 \
Ingo Molnarc7a79e92013-09-30 15:08:30 +020010 test-gtk2-infobar \
Ingo Molnarf1138ec2013-10-02 09:54:43 +020011 test-hello \
12 test-libaudit \
13 test-libbfd \
Ingo Molnar1c476612013-10-02 15:15:09 +020014 test-liberty \
15 test-liberty-z \
16 test-cplus-demangle \
Ingo Molnarf1138ec2013-10-02 09:54:43 +020017 test-libelf \
18 test-libelf-getphdrnum \
19 test-libelf-mmap \
20 test-libnuma \
Ingo Molnar7181a672013-09-30 15:15:36 +020021 test-libperl \
Ingo Molnar97341632013-09-30 15:18:37 +020022 test-libpython \
Ingo Molnar95d061c2013-09-30 15:40:04 +020023 test-libpython-version \
Ingo Molnarf1138ec2013-10-02 09:54:43 +020024 test-libslang \
25 test-libunwind \
Linus Torvaldsf47671e2013-11-14 08:51:29 +090026 test-libunwind-debug-frame \
Ingo Molnar34ef2162013-09-30 16:46:49 +020027 test-on-exit \
Ingo Molnarf1138ec2013-10-02 09:54:43 +020028 test-stackprotector-all \
David Ahern87419c92013-10-29 10:43:16 -060029 test-stackprotector \
30 test-timerfd
Ingo Molnarb6aa9972013-09-30 10:08:24 +020031
Ingo Molnar8b6eb562013-09-30 13:51:28 +020032CC := $(CC) -MD
33
Ingo Molnarb6aa9972013-09-30 10:08:24 +020034all: $(FILES)
35
Adrian Hunter28e962b2013-11-01 15:51:31 +020036BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c
Ingo Molnarb6aa9972013-09-30 10:08:24 +020037
38###############################
39
Ingo Molnarbaa9c302013-10-01 14:14:31 +020040test-all:
Adrian Hunter8a0c4c22013-11-01 15:51:32 +020041 $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -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
Ingo Molnar8b6eb562013-09-30 13:51:28 +020043test-hello:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020044 $(BUILD)
45
Ingo Molnar90ac5422013-09-30 13:48:44 +020046test-stackprotector-all:
47 $(BUILD) -Werror -fstack-protector-all
48
Ingo Molnar430be5a2013-10-07 09:47:00 +020049test-stackprotector:
Ingo Molnar046fa7a2013-10-10 09:06:21 +020050 $(BUILD) -Werror -fstack-protector -Wstack-protector
Ingo Molnar430be5a2013-10-07 09:47:00 +020051
Ingo Molnar1ea6f992013-10-07 09:38:28 +020052test-fortify-source:
53 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
54
Ingo Molnar78e9d652013-09-30 14:11:46 +020055test-bionic:
56 $(BUILD)
57
Ingo Molnar8f7f8002013-09-30 14:20:25 +020058test-libelf:
59 $(BUILD) -lelf
60
Ingo Molnare12762c2013-10-07 10:34:20 +020061test-glibc:
62 $(BUILD)
63
Ingo Molnar8295d4e2013-10-07 10:35:39 +020064test-dwarf:
65 $(BUILD) -ldw
66
Ingo Molnar8869b172013-09-30 15:02:28 +020067test-libelf-mmap:
68 $(BUILD) -lelf
69
Ingo Molnarb7bcef62013-09-30 14:35:27 +020070test-libelf-getphdrnum:
71 $(BUILD) -lelf
72
Ingo Molnar3ae069c2013-09-30 13:37:10 +020073test-libnuma:
74 $(BUILD) -lnuma
75
Ingo Molnar058f9522013-09-30 14:45:44 +020076test-libunwind:
Adrian Hunter8a0c4c22013-11-01 15:51:32 +020077 $(BUILD) $(LIBUNWIND_LIBS) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020078
Ingo Molnare3107182013-11-14 08:25:24 +010079test-libunwind-debug-frame:
80 $(BUILD) $(LIBUNWIND_LIBS) -lelf
81
Ingo Molnard795a652013-09-30 14:55:31 +020082test-libaudit:
83 $(BUILD) -laudit
84
Ingo Molnarb9498b52013-09-30 14:57:54 +020085test-libslang:
86 $(BUILD) -I/usr/include/slang -lslang
87
Ingo Molnar7ef9e052013-09-30 15:01:56 +020088test-gtk2:
89 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
90
Ingo Molnarc7a79e92013-09-30 15:08:30 +020091test-gtk2-infobar:
92 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
93
Ingo Molnar7181a672013-09-30 15:15:36 +020094grep-libs = $(filter -l%,$(1))
95strip-libs = $(filter-out -l%,$(1))
96
97PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
98PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
99PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
100PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
101FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
102
103test-libperl:
104 $(BUILD) $(FLAGS_PERL_EMBED)
105
Ingo Molnar97341632013-09-30 15:18:37 +0200106override PYTHON := python
107override PYTHON_CONFIG := python-config
108
109escape-for-shell-sq = $(subst ','\'',$(1))
110shell-sq = '$(escape-for-shell-sq)'
111
112PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
113
114PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
115PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
116PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
117PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
118FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
119
120test-libpython:
121 $(BUILD) $(FLAGS_PYTHON_EMBED)
122
Ingo Molnar95d061c2013-09-30 15:40:04 +0200123test-libpython-version:
124 $(BUILD) $(FLAGS_PYTHON_EMBED)
125
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200126test-libbfd:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200127 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200128
Ingo Molnar1c476612013-10-02 15:15:09 +0200129test-liberty:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200130 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
Ingo Molnar1c476612013-10-02 15:15:09 +0200131
132test-liberty-z:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200133 $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
Ingo Molnar1c476612013-10-02 15:15:09 +0200134
135test-cplus-demangle:
136 $(BUILD) -liberty
137
Ingo Molnar34ef2162013-09-30 16:46:49 +0200138test-on-exit:
139 $(BUILD)
140
Ingo Molnar4cc91172013-09-30 16:49:38 +0200141test-backtrace:
142 $(BUILD)
143
David Ahern87419c92013-10-29 10:43:16 -0600144test-timerfd:
145 $(BUILD)
146
Ingo Molnar231486a2013-10-10 09:10:59 +0200147-include *.d
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200148
Ingo Molnarb6aa9972013-09-30 10:08:24 +0200149###############################
150
151clean:
Ingo Molnar8b6eb562013-09-30 13:51:28 +0200152 rm -f $(FILES) *.d