blob: bc86462e80a2cde23da02fadd3b9ac95b1b7944f [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-timerfd
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
Jean Pihet1448fef2013-12-10 13:24:04 +010035BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $@.c $(LDFLAGS)
Ingo Molnarb6aa9972013-09-30 10:08:24 +020036
37###############################
38
Ingo Molnarbaa9c302013-10-01 14:14:31 +020039test-all:
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
Ingo Molnar8b6eb562013-09-30 13:51:28 +020042test-hello:
Ingo Molnarb6aa9972013-09-30 10:08:24 +020043 $(BUILD)
44
Ingo Molnar90ac5422013-09-30 13:48:44 +020045test-stackprotector-all:
46 $(BUILD) -Werror -fstack-protector-all
47
Ingo Molnar1ea6f992013-10-07 09:38:28 +020048test-fortify-source:
49 $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
50
Ingo Molnar78e9d652013-09-30 14:11:46 +020051test-bionic:
52 $(BUILD)
53
Ingo Molnar8f7f8002013-09-30 14:20:25 +020054test-libelf:
55 $(BUILD) -lelf
56
Ingo Molnare12762c2013-10-07 10:34:20 +020057test-glibc:
58 $(BUILD)
59
Ingo Molnar8295d4e2013-10-07 10:35:39 +020060test-dwarf:
61 $(BUILD) -ldw
62
Ingo Molnar8869b172013-09-30 15:02:28 +020063test-libelf-mmap:
64 $(BUILD) -lelf
65
Ingo Molnarb7bcef62013-09-30 14:35:27 +020066test-libelf-getphdrnum:
67 $(BUILD) -lelf
68
Ingo Molnar3ae069c2013-09-30 13:37:10 +020069test-libnuma:
70 $(BUILD) -lnuma
71
Ingo Molnar058f9522013-09-30 14:45:44 +020072test-libunwind:
Jean Pihet1448fef2013-12-10 13:24:04 +010073 $(BUILD) -lelf
Ingo Molnar058f9522013-09-30 14:45:44 +020074
Ingo Molnare3107182013-11-14 08:25:24 +010075test-libunwind-debug-frame:
Jean Pihet1448fef2013-12-10 13:24:04 +010076 $(BUILD) -lelf
Ingo Molnare3107182013-11-14 08:25:24 +010077
Ingo Molnard795a652013-09-30 14:55:31 +020078test-libaudit:
79 $(BUILD) -laudit
80
Ingo Molnarb9498b52013-09-30 14:57:54 +020081test-libslang:
82 $(BUILD) -I/usr/include/slang -lslang
83
Ingo Molnar7ef9e052013-09-30 15:01:56 +020084test-gtk2:
85 $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
86
Ingo Molnarc7a79e92013-09-30 15:08:30 +020087test-gtk2-infobar:
88 $(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
99test-libperl:
100 $(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
116test-libpython:
117 $(BUILD) $(FLAGS_PYTHON_EMBED)
118
Ingo Molnar95d061c2013-09-30 15:40:04 +0200119test-libpython-version:
120 $(BUILD) $(FLAGS_PYTHON_EMBED)
121
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200122test-libbfd:
Ingo Molnar0dc09742013-10-10 08:47:01 +0200123 $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
Ingo Molnar3b7646e2013-09-30 15:53:31 +0200124
Ingo Molnar1c476612013-10-02 15:15:09 +0200125test-liberty:
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
128test-liberty-z:
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
131test-cplus-demangle:
132 $(BUILD) -liberty
133
Ingo Molnar34ef2162013-09-30 16:46:49 +0200134test-on-exit:
135 $(BUILD)
136
Ingo Molnar4cc91172013-09-30 16:49:38 +0200137test-backtrace:
138 $(BUILD)
139
David Ahern87419c92013-10-29 10:43:16 -0600140test-timerfd:
141 $(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