Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[linux/fpc-iii.git] / tools / build / feature / Makefile
blobc5f4c417428d7099fbe4f487a179b0663f478611
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-libcrypto.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
41 FILES := $(addprefix $(OUTPUT),$(FILES))
43 CC := $(CROSS_COMPILE)gcc -MD
44 PKG_CONFIG := $(CROSS_COMPILE)pkg-config
46 all: $(FILES)
48 __BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
49 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
51 ###############################
53 $(OUTPUT)test-all.bin:
54 $(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
56 $(OUTPUT)test-hello.bin:
57 $(BUILD)
59 $(OUTPUT)test-pthread-attr-setaffinity-np.bin:
60 $(BUILD) -D_GNU_SOURCE -lpthread
62 $(OUTPUT)test-stackprotector-all.bin:
63 $(BUILD) -fstack-protector-all
65 $(OUTPUT)test-fortify-source.bin:
66 $(BUILD) -O2 -D_FORTIFY_SOURCE=2
68 $(OUTPUT)test-bionic.bin:
69 $(BUILD)
71 $(OUTPUT)test-libelf.bin:
72 $(BUILD) -lelf
74 $(OUTPUT)test-glibc.bin:
75 $(BUILD)
77 DWARFLIBS := -ldw
78 ifeq ($(findstring -static,${LDFLAGS}),-static)
79 DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
80 endif
82 $(OUTPUT)test-dwarf.bin:
83 $(BUILD) $(DWARFLIBS)
85 $(OUTPUT)test-libelf-mmap.bin:
86 $(BUILD) -lelf
88 $(OUTPUT)test-libelf-getphdrnum.bin:
89 $(BUILD) -lelf
91 $(OUTPUT)test-libnuma.bin:
92 $(BUILD) -lnuma
94 $(OUTPUT)test-numa_num_possible_cpus.bin:
95 $(BUILD) -lnuma
97 $(OUTPUT)test-libunwind.bin:
98 $(BUILD) -lelf
100 $(OUTPUT)test-libunwind-debug-frame.bin:
101 $(BUILD) -lelf
103 $(OUTPUT)test-libaudit.bin:
104 $(BUILD) -laudit
106 $(OUTPUT)test-libslang.bin:
107 $(BUILD) -I/usr/include/slang -lslang
109 $(OUTPUT)test-libcrypto.bin:
110 $(BUILD) -lcrypto
112 $(OUTPUT)test-gtk2.bin:
113 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
115 $(OUTPUT)test-gtk2-infobar.bin:
116 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
118 grep-libs = $(filter -l%,$(1))
119 strip-libs = $(filter-out -l%,$(1))
121 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
122 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
123 PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
124 PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
125 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
127 $(OUTPUT)test-libperl.bin:
128 $(BUILD) $(FLAGS_PERL_EMBED)
130 $(OUTPUT)test-libpython.bin:
131 $(BUILD)
133 $(OUTPUT)test-libpython-version.bin:
134 $(BUILD)
136 $(OUTPUT)test-libbfd.bin:
137 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
139 $(OUTPUT)test-liberty.bin:
140 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
142 $(OUTPUT)test-liberty-z.bin:
143 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
145 $(OUTPUT)test-cplus-demangle.bin:
146 $(BUILD) -liberty
148 $(OUTPUT)test-backtrace.bin:
149 $(BUILD)
151 $(OUTPUT)test-timerfd.bin:
152 $(BUILD)
154 $(OUTPUT)test-libdw-dwarf-unwind.bin:
155 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
157 $(OUTPUT)test-libbabeltrace.bin:
158 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
160 $(OUTPUT)test-sync-compare-and-swap.bin:
161 $(BUILD)
163 $(OUTPUT)test-compile-32.bin:
164 $(CC) -m32 -o $@ test-compile.c
166 $(OUTPUT)test-compile-x32.bin:
167 $(CC) -mx32 -o $@ test-compile.c
169 $(OUTPUT)test-zlib.bin:
170 $(BUILD) -lz
172 $(OUTPUT)test-lzma.bin:
173 $(BUILD) -llzma
175 $(OUTPUT)test-get_cpuid.bin:
176 $(BUILD)
178 $(OUTPUT)test-bpf.bin:
179 $(BUILD)
181 -include $(OUTPUT)*.d
183 ###############################
185 clean:
186 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)