aboutsummaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 4a87f077ab3dfc3eebeba7ff6fe34a05e9b681cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# Copyright (c) 2011, Linaro Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of the Linaro nor the
#       names of its contributors may be used to endorse or promote products
#       derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

# Top level Makefile for cortex-strings

# Used to record the compiler version in the executables
COMPILER = $(shell $(CC) --version 2>&1 | head -n1)

# The main library
lib_LTLIBRARIES = \
	libcortex-strings.la

## Test suite
check_PROGRAMS = \
	tests/test-memchr \
	tests/test-memcmp \
	tests/test-memcpy \
	tests/test-memmove \
	tests/test-memset \
	tests/test-strchr \
	tests/test-strcmp \
	tests/test-strcpy \
	tests/test-strlen \
	tests/test-strncmp \
	tests/test-strnlen

# Options for the tests
tests_cflags = -I$(srcdir)/tests $(AM_CFLAGS)
tests_ldadd = libcortex-strings.la
tests_test_memchr_LDADD = $(tests_ldadd)
tests_test_memchr_CFLAGS = $(tests_cflags)
tests_test_memcmp_LDADD = $(tests_ldadd)
tests_test_memcmp_CFLAGS = $(tests_cflags)
tests_test_memcpy_LDADD = $(tests_ldadd)
tests_test_memcpy_CFLAGS = $(tests_cflags)
tests_test_memmove_LDADD = $(tests_ldadd)
tests_test_memmove_CFLAGS = $(tests_cflags)
tests_test_memset_LDADD = $(tests_ldadd)
tests_test_memset_CFLAGS = $(tests_cflags)
tests_test_strchr_LDADD = $(tests_ldadd)
tests_test_strchr_CFLAGS = $(tests_cflags)
tests_test_strcmp_LDADD = $(tests_ldadd)
tests_test_strcmp_CFLAGS = $(tests_cflags)
tests_test_strcpy_LDADD = $(tests_ldadd)
tests_test_strcpy_CFLAGS = $(tests_cflags)
tests_test_strlen_LDADD = $(tests_ldadd)
tests_test_strlen_CFLAGS = $(tests_cflags)
tests_test_strncmp_LDADD = $(tests_ldadd)
tests_test_strncmp_CFLAGS = $(tests_cflags)

TESTS = $(check_PROGRAMS)

## Benchmarks
noinst_PROGRAMS = \
	dhry \
	dhry-native \
	try-none \
	try-this \
	try-plain \
	try-newlib-c \
	try-bionic-c \
	try-glibc-c

# Good 'ol Dhrystone
dhry_SOURCES = \
	benchmarks/dhry/dhry_1.c \
	benchmarks/dhry/dhry_2.c \
	benchmarks/dhry/dhry.h

dhry_CFLAGS = -Dcompiler="\"$(COMPILER)\"" -Doptions="\"$(CFLAGS)\""
dhry_LDADD = libcortex-strings.la

dhry_native_SOURCES = $(dhry_SOURCES)
dhry_native_CFLAGS = $(dhry_CFLAGS)

# Benchmark harness
noinst_LIBRARIES = \
	libmulti.a \
	libbionic-c.a \
	libglibc-c.a \
	libnewlib-c.a \
	libplain.a

libmulti_a_SOURCES = \
	benchmarks/multi/harness.c

libmulti_a_CFLAGS = -DVERSION=\"$(VERSION)\" $(AM_CFLAGS)

## Other architecture independant implementaions
libbionic_c_a_SOURCES = \
	reference/bionic-c/bcopy.c \
	reference/bionic-c/memchr.c \
	reference/bionic-c/memcmp.c \
	reference/bionic-c/memcpy.c \
	reference/bionic-c/memset.c \
	reference/bionic-c/strchr.c \
	reference/bionic-c/strcmp.c \
	reference/bionic-c/strcpy.c \
	reference/bionic-c/strlen.c

libglibc_c_a_SOURCES = \
	reference/glibc-c/memchr.c \
	reference/glibc-c/memcmp.c \
	reference/glibc-c/memcpy.c \
	reference/glibc-c/memset.c \
	reference/glibc-c/strchr.c \
	reference/glibc-c/strcmp.c \
	reference/glibc-c/strcpy.c \
	reference/glibc-c/strlen.c \
	reference/glibc-c/wordcopy.c \
	reference/glibc-c/bp-checks.h \
	reference/glibc-c/memcopy.h \
	reference/glibc-c/pagecopy.h

libnewlib_c_a_SOURCES = \
	reference/newlib-c/memchr.c \
	reference/newlib-c/memcmp.c \
	reference/newlib-c/memcpy.c \
	reference/newlib-c/memset.c \
	reference/newlib-c/strchr.c \
	reference/newlib-c/strcmp.c \
	reference/newlib-c/strcpy.c \
	reference/newlib-c/strlen.c \
	reference/newlib-c/shim.h

libplain_a_SOURCES = \
	reference/plain/memset.c \
	reference/plain/memcpy.c \
	reference/plain/strcmp.c \
	reference/plain/strcpy.c

try_none_SOURCES =
try_none_LDADD = libmulti.a -lrt
try_this_SOURCES =
try_this_LDADD = libmulti.a libcortex-strings.la -lrt
try_bionic_c_SOURCES =
try_bionic_c_LDADD = libmulti.a libbionic-c.a -lrt
try_glibc_c_SOURCES =
try_glibc_c_LDADD = libmulti.a libglibc-c.a -lrt
try_newlib_c_SOURCES =
try_newlib_c_LDADD = libmulti.a libnewlib-c.a -lrt
try_plain_SOURCES =
try_plain_LDADD = libmulti.a libplain.a -lrt

# Architecture specific

if HOST_AARCH32

if WITH_NEON
# Pull in the NEON specific files
neon_bionic_sources = \
	reference/bionic/memcpy.S
fpu_flags = -mfpu=neon
else
if WITH_VFP
fpu_flags = -mfpu=vfp
else
fpu_flags = -msoft-float
endif
endif

# Benchmarks and example programs
noinst_PROGRAMS += \
	try-bionic \
	try-csl \
	try-glibc \
	try-newlib \
	try-newlib-xscale

# Libraries used in the benchmarks and examples
noinst_LIBRARIES += \
	libbionic.a \
	libcsl.a \
	libglibc.a \
	libnewlib.a \
	libnewlib-xscale.a

# Main library
libcortex_strings_la_SOURCES = \
	src/thumb-2/strcpy.c \
	src/linaro-a9/memchr.S \
	src/linaro-a9/strchr.S \
	src/linaro-a9/strlen.S \
	src/linaro-a9/memset.S \
	src/linaro-a9/memcpy.S

# Libraries containing the difference reference versions
libbionic_a_SOURCES = \
	$(neon_bionic_sources) \
	reference/bionic/memcmp.S \
	reference/bionic/memset.S \
	reference/bionic/strcmp.S \
	reference/bionic/strcpy.S \
	reference/bionic/strlen.c

libbionic_a_CFLAGS = -Wa,-mimplicit-it=thumb

libcsl_a_SOURCES = \
	reference/csl/memcpy.c \
	reference/csl/memset.c \
	reference/csl/arm_asm.h

libglibc_a_SOURCES = \
	reference/glibc/memcpy.S \
	reference/glibc/memset.S \
	reference/glibc/strlen.S

libnewlib_a_SOURCES = \
	reference/newlib/memcpy.S \
	reference/newlib/strcmp.S \
	reference/newlib/strcpy.c \
	reference/newlib/strlen.c \
	reference/newlib/arm_asm.h \
	reference/newlib/shim.h

libnewlib_xscale_a_SOURCES = \
	reference/newlib-xscale/memchr.c \
	reference/newlib-xscale/memcpy.c \
	reference/newlib-xscale/memset.c \
	reference/newlib-xscale/strchr.c \
	reference/newlib-xscale/strcmp.c \
	reference/newlib-xscale/strcpy.c \
	reference/newlib-xscale/strlen.c \
	reference/newlib-xscale/xscale.h

# Flags for the benchmark helpers
try_bionic_SOURCES =
try_bionic_LDADD = libmulti.a libbionic.a -lrt
try_csl_SOURCES =
try_csl_LDADD = libmulti.a libcsl.a -lrt
try_glibc_SOURCES =
try_glibc_LDADD = libmulti.a libglibc.a -lrt
try_newlib_SOURCES =
try_newlib_LDADD = libmulti.a libnewlib.a -lrt
try_newlib_xscale_SOURCES =
try_newlib_xscale_LDADD = libmulti.a libnewlib-xscale.a -lrt

AM_CPPFLAGS = $(fpu_flags)
AM_LDFLAGS = $(fpu_flags)

endif

# aarch64 specific
if HOST_AARCH64

libcortex_strings_la_SOURCES = \
	src/aarch64/memcmp.S \
	src/aarch64/memcpy.S \
	src/aarch64/memmove.S \
	src/aarch64/memset.S \
	src/aarch64/strcmp.S \
	src/aarch64/strlen.S \
	src/aarch64/strncmp.S \
	src/aarch64/strnlen.S

endif

libcortex_strings_la_LDFLAGS = -version-info 1:0:0

AM_CFLAGS = \
	-std=gnu99 -Wall \
	-fno-builtin -fno-stack-protector -U_FORTIFY_SOURCE \
	$(AM_CPPFLAGS)

if WITH_SUBMACHINE
AM_CFLAGS += \
	-mtune=$(submachine)
endif

EXTRA_DIST = \
	tests/hp-timing.h \
	tests/test-string.h \
	tests/test-skeleton.c \
	scripts/add-license.sh \
	scripts/bench.py \
	scripts/fixup.py \
	scripts/libplot.py \
	scripts/plot-align.py \
	scripts/plot.py \
	scripts/plot-sizes.py \
	scripts/plot-top.py \
	scripts/trim.sh \
	autogen.sh