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