Merge branch 'acpi-ec'
[linux-drm-fsl-dcu.git] / 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-sync-compare-and-swap.bin  \
9         test-glibc.bin                  \
10         test-gtk2.bin                   \
11         test-gtk2-infobar.bin           \
12         test-hello.bin                  \
13         test-libaudit.bin               \
14         test-libbfd.bin                 \
15         test-liberty.bin                \
16         test-liberty-z.bin              \
17         test-cplus-demangle.bin         \
18         test-libelf.bin                 \
19         test-libelf-getphdrnum.bin      \
20         test-libelf-mmap.bin            \
21         test-libnuma.bin                \
22         test-libperl.bin                \
23         test-libpython.bin              \
24         test-libpython-version.bin      \
25         test-libslang.bin               \
26         test-libunwind.bin              \
27         test-libunwind-debug-frame.bin  \
28         test-pthread-attr-setaffinity-np.bin    \
29         test-stackprotector-all.bin     \
30         test-timerfd.bin                \
31         test-libdw-dwarf-unwind.bin     \
32         test-compile-32.bin             \
33         test-compile-x32.bin            \
34         test-zlib.bin
35
36 CC := $(CROSS_COMPILE)gcc -MD
37 PKG_CONFIG := $(CROSS_COMPILE)pkg-config
38
39 all: $(FILES)
40
41 BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
42
43 ###############################
44
45 test-all.bin:
46         $(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 -lz
47
48 test-hello.bin:
49         $(BUILD)
50
51 test-pthread-attr-setaffinity-np.bin:
52         $(BUILD) -Werror -lpthread
53
54 test-stackprotector-all.bin:
55         $(BUILD) -Werror -fstack-protector-all
56
57 test-fortify-source.bin:
58         $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
59
60 test-bionic.bin:
61         $(BUILD)
62
63 test-libelf.bin:
64         $(BUILD) -lelf
65
66 test-glibc.bin:
67         $(BUILD)
68
69 test-dwarf.bin:
70         $(BUILD) -ldw
71
72 test-libelf-mmap.bin:
73         $(BUILD) -lelf
74
75 test-libelf-getphdrnum.bin:
76         $(BUILD) -lelf
77
78 test-libnuma.bin:
79         $(BUILD) -lnuma
80
81 test-libunwind.bin:
82         $(BUILD) -lelf
83
84 test-libunwind-debug-frame.bin:
85         $(BUILD) -lelf
86
87 test-libaudit.bin:
88         $(BUILD) -laudit
89
90 test-libslang.bin:
91         $(BUILD) -I/usr/include/slang -lslang
92
93 test-gtk2.bin:
94         $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
95
96 test-gtk2-infobar.bin:
97         $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
98
99 grep-libs  = $(filter -l%,$(1))
100 strip-libs = $(filter-out -l%,$(1))
101
102 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
103 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
104 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
105 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
106 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
107
108 test-libperl.bin:
109         $(BUILD) $(FLAGS_PERL_EMBED)
110
111 test-libpython.bin:
112         $(BUILD)
113
114 test-libpython-version.bin:
115         $(BUILD)
116
117 test-libbfd.bin:
118         $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
119
120 test-liberty.bin:
121         $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
122
123 test-liberty-z.bin:
124         $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
125
126 test-cplus-demangle.bin:
127         $(BUILD) -liberty
128
129 test-backtrace.bin:
130         $(BUILD)
131
132 test-timerfd.bin:
133         $(BUILD)
134
135 test-libdw-dwarf-unwind.bin:
136         $(BUILD)
137
138 test-sync-compare-and-swap.bin:
139         $(BUILD) -Werror
140
141 test-compile-32.bin:
142         $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
143
144 test-compile-x32.bin:
145         $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
146
147 test-zlib.bin:
148         $(BUILD) -lz
149
150 -include *.d
151
152 ###############################
153
154 clean:
155         rm -f $(FILES) *.d