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