]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/cortex-strings/Makefile.am
ident(1): Normalizing date format
[FreeBSD/FreeBSD.git] / contrib / cortex-strings / Makefile.am
1 # Copyright (c) 2011, Linaro Limited
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are met:
6 #     * Redistributions of source code must retain the above copyright
7 #       notice, this list of conditions and the following disclaimer.
8 #     * Redistributions in binary form must reproduce the above copyright
9 #       notice, this list of conditions and the following disclaimer in the
10 #       documentation and/or other materials provided with the distribution.
11 #     * Neither the name of the Linaro nor the
12 #       names of its contributors may be used to endorse or promote products
13 #       derived from this software without specific prior written permission.
14 #
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
19 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 #
26
27 # Top level Makefile for cortex-strings
28
29 # Used to record the compiler version in the executables
30 COMPILER = $(shell $(CC) --version 2>&1 | head -n1)
31
32 # The main library
33 lib_LTLIBRARIES = \
34         libcortex-strings.la
35
36 ## Test suite
37 check_PROGRAMS = \
38         tests/test-memchr \
39         tests/test-memcmp \
40         tests/test-memcpy \
41         tests/test-memmove \
42         tests/test-memset \
43         tests/test-strchr \
44         tests/test-strcmp \
45         tests/test-strcpy \
46         tests/test-strlen \
47         tests/test-strncmp \
48         tests/test-strnlen
49
50 # Options for the tests
51 tests_cflags = -I$(srcdir)/tests $(AM_CFLAGS)
52 tests_ldadd = libcortex-strings.la
53 tests_test_memchr_LDADD = $(tests_ldadd)
54 tests_test_memchr_CFLAGS = $(tests_cflags)
55 tests_test_memcmp_LDADD = $(tests_ldadd)
56 tests_test_memcmp_CFLAGS = $(tests_cflags)
57 tests_test_memcpy_LDADD = $(tests_ldadd)
58 tests_test_memcpy_CFLAGS = $(tests_cflags)
59 tests_test_memmove_LDADD = $(tests_ldadd)
60 tests_test_memmove_CFLAGS = $(tests_cflags)
61 tests_test_memset_LDADD = $(tests_ldadd)
62 tests_test_memset_CFLAGS = $(tests_cflags)
63 tests_test_strchr_LDADD = $(tests_ldadd)
64 tests_test_strchr_CFLAGS = $(tests_cflags)
65 tests_test_strcmp_LDADD = $(tests_ldadd)
66 tests_test_strcmp_CFLAGS = $(tests_cflags)
67 tests_test_strcpy_LDADD = $(tests_ldadd)
68 tests_test_strcpy_CFLAGS = $(tests_cflags)
69 tests_test_strlen_LDADD = $(tests_ldadd)
70 tests_test_strlen_CFLAGS = $(tests_cflags)
71 tests_test_strncmp_LDADD = $(tests_ldadd)
72 tests_test_strncmp_CFLAGS = $(tests_cflags)
73
74 TESTS = $(check_PROGRAMS)
75
76 ## Benchmarks
77 noinst_PROGRAMS = \
78         dhry \
79         dhry-native \
80         try-none \
81         try-this \
82         try-plain \
83         try-newlib-c \
84         try-bionic-c \
85         try-glibc-c
86
87 # Good 'ol Dhrystone
88 dhry_SOURCES = \
89         benchmarks/dhry/dhry_1.c \
90         benchmarks/dhry/dhry_2.c \
91         benchmarks/dhry/dhry.h
92
93 dhry_CFLAGS = -Dcompiler="\"$(COMPILER)\"" -Doptions="\"$(CFLAGS)\""
94 dhry_LDADD = libcortex-strings.la
95
96 dhry_native_SOURCES = $(dhry_SOURCES)
97 dhry_native_CFLAGS = $(dhry_CFLAGS)
98
99 # Benchmark harness
100 noinst_LIBRARIES = \
101         libmulti.a \
102         libbionic-c.a \
103         libglibc-c.a \
104         libnewlib-c.a \
105         libplain.a
106
107 libmulti_a_SOURCES = \
108         benchmarks/multi/harness.c
109
110 libmulti_a_CFLAGS = -DVERSION=\"$(VERSION)\" $(AM_CFLAGS)
111
112 ## Other architecture independant implementaions
113 libbionic_c_a_SOURCES = \
114         reference/bionic-c/bcopy.c \
115         reference/bionic-c/memchr.c \
116         reference/bionic-c/memcmp.c \
117         reference/bionic-c/memcpy.c \
118         reference/bionic-c/memset.c \
119         reference/bionic-c/strchr.c \
120         reference/bionic-c/strcmp.c \
121         reference/bionic-c/strcpy.c \
122         reference/bionic-c/strlen.c
123
124 libglibc_c_a_SOURCES = \
125         reference/glibc-c/memchr.c \
126         reference/glibc-c/memcmp.c \
127         reference/glibc-c/memcpy.c \
128         reference/glibc-c/memset.c \
129         reference/glibc-c/strchr.c \
130         reference/glibc-c/strcmp.c \
131         reference/glibc-c/strcpy.c \
132         reference/glibc-c/strlen.c \
133         reference/glibc-c/wordcopy.c \
134         reference/glibc-c/memcopy.h \
135         reference/glibc-c/pagecopy.h
136
137 libnewlib_c_a_SOURCES = \
138         reference/newlib-c/memchr.c \
139         reference/newlib-c/memcmp.c \
140         reference/newlib-c/memcpy.c \
141         reference/newlib-c/memset.c \
142         reference/newlib-c/strchr.c \
143         reference/newlib-c/strcmp.c \
144         reference/newlib-c/strcpy.c \
145         reference/newlib-c/strlen.c \
146         reference/newlib-c/shim.h
147
148 libplain_a_SOURCES = \
149         reference/plain/memset.c \
150         reference/plain/memcpy.c \
151         reference/plain/strcmp.c \
152         reference/plain/strcpy.c
153
154 try_none_SOURCES =
155 try_none_LDADD = libmulti.a -lrt
156 try_this_SOURCES =
157 try_this_LDADD = libmulti.a libcortex-strings.la -lrt
158 try_bionic_c_SOURCES =
159 try_bionic_c_LDADD = libmulti.a libbionic-c.a -lrt
160 try_glibc_c_SOURCES =
161 try_glibc_c_LDADD = libmulti.a libglibc-c.a -lrt
162 try_newlib_c_SOURCES =
163 try_newlib_c_LDADD = libmulti.a libnewlib-c.a -lrt
164 try_plain_SOURCES =
165 try_plain_LDADD = libmulti.a libplain.a -lrt
166
167 # Architecture specific
168
169 if HOST_AARCH32
170
171 if WITH_NEON
172 # Pull in the NEON specific files
173 neon_bionic_a9_sources = \
174         reference/bionic-a9/memcpy.S \
175         reference/bionic-a9/memset.S
176 neon_bionic_a15_sources = \
177         reference/bionic-a15/memcpy.S \
178         reference/bionic-a15/memset.S
179 fpu_flags = -mfpu=neon
180 else
181 if WITH_VFP
182 fpu_flags = -mfpu=vfp
183 else
184 fpu_flags = -msoft-float
185 endif
186 endif
187
188 # Benchmarks and example programs
189 noinst_PROGRAMS += \
190         try-bionic-a9 \
191         try-bionic-a15 \
192         try-csl \
193         try-glibc \
194         try-newlib \
195         try-newlib-xscale
196
197 # Libraries used in the benchmarks and examples
198 noinst_LIBRARIES += \
199         libbionic-a9.a \
200         libbionic-a15.a \
201         libcsl.a \
202         libglibc.a \
203         libnewlib.a \
204         libnewlib-xscale.a
205
206 # Main library
207 libcortex_strings_la_SOURCES = \
208         src/thumb-2/strcpy.c \
209         src/arm/memchr.S \
210         src/arm/strchr.S \
211         src/thumb-2/strlen.S \
212         src/arm/memset.S \
213         src/arm/memcpy.S \
214         src/arm/strcmp.S
215
216 # Libraries containing the difference reference versions
217 libbionic_a9_a_SOURCES = \
218         $(neon_bionic_a9_sources) \
219         reference/bionic-a9/memcmp.S \
220         reference/bionic-a9/strcmp.S \
221         reference/bionic-a9/strcpy.S \
222         reference/bionic-a9/strlen.c
223
224 libbionic_a9_a_CFLAGS = -Wa,-mimplicit-it=thumb
225
226 libbionic_a15_a_SOURCES = \
227         $(neon_bionic_a15_sources) \
228         reference/bionic-a15/memcmp.S \
229         reference/bionic-a15/strcmp.S \
230         reference/bionic-a15/strcpy.S \
231         reference/bionic-a15/strlen.c
232
233 libbionic_a15_a_CFLAGS = -Wa,-mimplicit-it=thumb
234
235 libcsl_a_SOURCES = \
236         reference/csl/memcpy.c \
237         reference/csl/memset.c \
238         reference/csl/arm_asm.h
239
240 libglibc_a_SOURCES = \
241         reference/glibc/memcpy.S \
242         reference/glibc/memset.S \
243         reference/glibc/strchr.S \
244         reference/glibc/strlen.S
245
246 libnewlib_a_SOURCES = \
247         reference/newlib/memcpy.S \
248         reference/newlib/strcmp.S \
249         reference/newlib/strcpy.c \
250         reference/newlib/strlen.c \
251         reference/newlib/arm_asm.h \
252         reference/newlib/shim.h
253
254 libnewlib_xscale_a_SOURCES = \
255         reference/newlib-xscale/memchr.c \
256         reference/newlib-xscale/memcpy.c \
257         reference/newlib-xscale/memset.c \
258         reference/newlib-xscale/strchr.c \
259         reference/newlib-xscale/strcmp.c \
260         reference/newlib-xscale/strcpy.c \
261         reference/newlib-xscale/strlen.c \
262         reference/newlib-xscale/xscale.h
263
264 # Flags for the benchmark helpers
265 try_bionic_a9_SOURCES =
266 try_bionic_a9_LDADD = libmulti.a libbionic-a9.a -lrt
267 try_bionic_a15_SOURCES =
268 try_bionic_a15_LDADD = libmulti.a libbionic-a15.a -lrt
269 try_csl_SOURCES =
270 try_csl_LDADD = libmulti.a libcsl.a -lrt
271 try_glibc_SOURCES =
272 try_glibc_LDADD = libmulti.a libglibc.a -lrt
273 try_newlib_SOURCES =
274 try_newlib_LDADD = libmulti.a libnewlib.a -lrt
275 try_newlib_xscale_SOURCES =
276 try_newlib_xscale_LDADD = libmulti.a libnewlib-xscale.a -lrt
277
278 AM_CPPFLAGS = $(fpu_flags)
279 AM_LDFLAGS = $(fpu_flags)
280
281 endif
282
283 # aarch64 specific
284 if HOST_AARCH64
285
286 libcortex_strings_la_SOURCES = \
287         src/aarch64/memchr.S \
288         src/aarch64/memcmp.S \
289         src/aarch64/memcpy.S \
290         src/aarch64/memmove.S \
291         src/aarch64/memset.S \
292         src/aarch64/strchr.S \
293         src/aarch64/strchrnul.S \
294         src/aarch64/strcmp.S \
295         src/aarch64/strcpy.S \
296         src/aarch64/strlen.S \
297         src/aarch64/strncmp.S \
298         src/aarch64/strnlen.S
299
300 endif
301
302 libcortex_strings_la_LDFLAGS = -version-info 1:0:0
303
304 AM_CFLAGS = \
305         -std=gnu99 -Wall \
306         -fno-builtin -fno-stack-protector -U_FORTIFY_SOURCE \
307         $(AM_CPPFLAGS)
308
309 if WITH_SUBMACHINE
310 AM_CFLAGS += \
311         -mtune=$(submachine)
312 endif
313
314 EXTRA_DIST = \
315         tests/hp-timing.h \
316         tests/test-string.h \
317         tests/test-skeleton.c \
318         scripts/add-license.sh \
319         scripts/bench.py \
320         scripts/fixup.py \
321         scripts/libplot.py \
322         scripts/plot-align.py \
323         scripts/plot.py \
324         scripts/plot-sizes.py \
325         scripts/plot-top.py \
326         scripts/trim.sh \
327         autogen.sh