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