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