]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - tools/build/feature/Makefile
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[karo-tx-linux.git] / tools / build / feature / 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-numa_num_possible_cpus.bin \
23         test-libperl.bin                \
24         test-libpython.bin              \
25         test-libpython-version.bin      \
26         test-libslang.bin               \
27         test-libunwind.bin              \
28         test-libunwind-debug-frame.bin  \
29         test-pthread-attr-setaffinity-np.bin    \
30         test-stackprotector-all.bin     \
31         test-timerfd.bin                \
32         test-libdw-dwarf-unwind.bin     \
33         test-libbabeltrace.bin          \
34         test-compile-32.bin             \
35         test-compile-x32.bin            \
36         test-zlib.bin                   \
37         test-lzma.bin                   \
38         test-bpf.bin                    \
39         test-get_cpuid.bin
40
41 CC := $(CROSS_COMPILE)gcc -MD
42 PKG_CONFIG := $(CROSS_COMPILE)pkg-config
43
44 all: $(FILES)
45
46 __BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
47   BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
48
49 ###############################
50
51 test-all.bin:
52         $(BUILD) -fstack-protector-all -O2 -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 -llzma
53
54 test-hello.bin:
55         $(BUILD)
56
57 test-pthread-attr-setaffinity-np.bin:
58         $(BUILD) -D_GNU_SOURCE -lpthread
59
60 test-stackprotector-all.bin:
61         $(BUILD) -fstack-protector-all
62
63 test-fortify-source.bin:
64         $(BUILD) -O2 -D_FORTIFY_SOURCE=2
65
66 test-bionic.bin:
67         $(BUILD)
68
69 test-libelf.bin:
70         $(BUILD) -lelf
71
72 test-glibc.bin:
73         $(BUILD)
74
75 DWARFLIBS := -ldw
76 ifeq ($(findstring -static,${LDFLAGS}),-static)
77 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
78 endif
79
80 test-dwarf.bin:
81         $(BUILD) $(DWARFLIBS)
82
83 test-libelf-mmap.bin:
84         $(BUILD) -lelf
85
86 test-libelf-getphdrnum.bin:
87         $(BUILD) -lelf
88
89 test-libnuma.bin:
90         $(BUILD) -lnuma
91
92 test-numa_num_possible_cpus.bin:
93         $(BUILD) -lnuma
94
95 test-libunwind.bin:
96         $(BUILD) -lelf
97
98 test-libunwind-debug-frame.bin:
99         $(BUILD) -lelf
100
101 test-libaudit.bin:
102         $(BUILD) -laudit
103
104 test-libslang.bin:
105         $(BUILD) -I/usr/include/slang -lslang
106
107 test-gtk2.bin:
108         $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
109
110 test-gtk2-infobar.bin:
111         $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
112
113 grep-libs  = $(filter -l%,$(1))
114 strip-libs = $(filter-out -l%,$(1))
115
116 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
117 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
118 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
119 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
120 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
121
122 test-libperl.bin:
123         $(BUILD) $(FLAGS_PERL_EMBED)
124
125 test-libpython.bin:
126         $(BUILD)
127
128 test-libpython-version.bin:
129         $(BUILD)
130
131 test-libbfd.bin:
132         $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
133
134 test-liberty.bin:
135         $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
136
137 test-liberty-z.bin:
138         $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
139
140 test-cplus-demangle.bin:
141         $(BUILD) -liberty
142
143 test-backtrace.bin:
144         $(BUILD)
145
146 test-timerfd.bin:
147         $(BUILD)
148
149 test-libdw-dwarf-unwind.bin:
150         $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
151
152 test-libbabeltrace.bin:
153         $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
154
155 test-sync-compare-and-swap.bin:
156         $(BUILD)
157
158 test-compile-32.bin:
159         $(CC) -m32 -o $(OUTPUT)$@ test-compile.c
160
161 test-compile-x32.bin:
162         $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
163
164 test-zlib.bin:
165         $(BUILD) -lz
166
167 test-lzma.bin:
168         $(BUILD) -llzma
169
170 test-get_cpuid.bin:
171         $(BUILD)
172
173 test-bpf.bin:
174         $(BUILD)
175
176 -include *.d
177
178 ###############################
179
180 clean:
181         rm -f $(FILES) *.d $(FILES:.bin=.make.output)