Merge branch 'for-linus-dma-masks' of git://git.linaro.org/people/rmk/linux-arm
[cascardo/linux.git] / tools / perf / config / feature-checks / Makefile
1
2 FILES=                                  \
3         test-all                        \
4         test-backtrace                  \
5         test-bionic                     \
6         test-dwarf                      \
7         test-fortify-source             \
8         test-glibc                      \
9         test-gtk2                       \
10         test-gtk2-infobar               \
11         test-hello                      \
12         test-libaudit                   \
13         test-libbfd                     \
14         test-liberty                    \
15         test-liberty-z                  \
16         test-cplus-demangle             \
17         test-libelf                     \
18         test-libelf-getphdrnum          \
19         test-libelf-mmap                \
20         test-libnuma                    \
21         test-libperl                    \
22         test-libpython                  \
23         test-libpython-version          \
24         test-libslang                   \
25         test-libunwind                  \
26         test-on-exit                    \
27         test-stackprotector-all         \
28         test-stackprotector             \
29         test-timerfd
30
31 CC := $(CC) -MD
32
33 all: $(FILES)
34
35 BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c
36
37 ###############################
38
39 test-all:
40         $(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
41
42 test-hello:
43         $(BUILD)
44
45 test-stackprotector-all:
46         $(BUILD) -Werror -fstack-protector-all
47
48 test-stackprotector:
49         $(BUILD) -Werror -fstack-protector -Wstack-protector
50
51 test-fortify-source:
52         $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
53
54 test-bionic:
55         $(BUILD)
56
57 test-libelf:
58         $(BUILD) -lelf
59
60 test-glibc:
61         $(BUILD)
62
63 test-dwarf:
64         $(BUILD) -ldw
65
66 test-libelf-mmap:
67         $(BUILD) -lelf
68
69 test-libelf-getphdrnum:
70         $(BUILD) -lelf
71
72 test-libnuma:
73         $(BUILD) -lnuma
74
75 test-libunwind:
76         $(BUILD) $(LIBUNWIND_LIBS) -lelf
77
78 test-libaudit:
79         $(BUILD) -laudit
80
81 test-libslang:
82         $(BUILD) -I/usr/include/slang -lslang
83
84 test-gtk2:
85         $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
86
87 test-gtk2-infobar:
88         $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
89
90 grep-libs  = $(filter -l%,$(1))
91 strip-libs = $(filter-out -l%,$(1))
92
93 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
94 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
95 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
96 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
97 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
98
99 test-libperl:
100         $(BUILD) $(FLAGS_PERL_EMBED)
101
102 override PYTHON := python
103 override PYTHON_CONFIG := python-config
104
105 escape-for-shell-sq =  $(subst ','\'',$(1))
106 shell-sq = '$(escape-for-shell-sq)'
107
108 PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG))
109
110 PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
111 PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
112 PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
113 PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
114 FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
115
116 test-libpython:
117         $(BUILD) $(FLAGS_PYTHON_EMBED)
118
119 test-libpython-version:
120         $(BUILD) $(FLAGS_PYTHON_EMBED)
121
122 test-libbfd:
123         $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
124
125 test-liberty:
126         $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
127
128 test-liberty-z:
129         $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
130
131 test-cplus-demangle:
132         $(BUILD) -liberty
133
134 test-on-exit:
135         $(BUILD)
136
137 test-backtrace:
138         $(BUILD)
139
140 test-timerfd:
141         $(BUILD)
142
143 -include *.d
144
145 ###############################
146
147 clean:
148         rm -f $(FILES) *.d