~linaro-toolchain-dev/cortex-strings/trunk

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
# Top level Makefile for cortex-strings

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

if WITH_NEON
# Pull in the NEON specific files
neon_sources = \
	src/neon/memcpy.S \
	src/neon/memset.S
neon_bionic_sources = \
	reference/bionic/memcpy.S
neon_cppflags = -mfpu=neon
neon_dirs = neon
endif

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

# Test suite
check_PROGRAMS = \
	tests/test-memcpy \
	tests/test-memset \
	tests/test-strcmp \
	tests/test-strcpy \
	tests/test-strlen

# Benchmarks and example programs
noinst_PROGRAMS = \
	dhry \
	dhry-native \
	try-none \
	try-all \
	try-bionic \
	try-csl \
	try-glibc \
	try-newlib \
	try-plain

# Libraries used in the benchmarks and examples
noinst_LIBRARIES = \
	libbionic.a \
	libcsl.a \
	libglibc.a \
	libnewlib.a \
	libplain.a \
	libmulti.a

# Main library
libcortex_strings_la_SOURCES = \
	$(neon_sources) \
	src/thumb-2/strcmp.c \
	src/thumb-2/strcpy.c \
	src/thumb-2/strlen.c

# Options for the tests
tests_cflags = -I$(srcdir)/tests $(AM_CFLAGS)
tests_ldadd = libcortex-strings.la
tests_test_memcpy_LDADD = $(tests_ldadd)
tests_test_memcpy_CFLAGS = $(tests_cflags)
tests_test_memset_LDADD = $(tests_ldadd)
tests_test_memset_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 = $(check_PROGRAMS)

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

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

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

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

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

libmulti_a_SOURCES = \
	benchmarks/multi/harness.c

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

# Flags for the benchmark helpers
try_none_SOURCES =
try_none_LDFLAGS = -lrt
try_none_LDADD = libmulti.a
try_all_SOURCES =
try_all_LDFLAGS = -lrt
try_all_LDADD = libmulti.a libcortex-strings.la
try_bionic_SOURCES =
try_bionic_LDFLAGS = -lrt
try_bionic_LDADD = libmulti.a libbionic.a
try_csl_SOURCES =
try_csl_LDFLAGS = -lrt
try_csl_LDADD = libmulti.a libcsl.a
try_glibc_SOURCES =
try_glibc_LDFLAGS = -lrt
try_glibc_LDADD = libmulti.a libglibc.a
try_newlib_SOURCES =
try_newlib_LDFLAGS = -lrt
try_newlib_LDADD = libmulti.a libnewlib.a
try_plain_SOURCES =
try_plain_LDFLAGS = -lrt
try_plain_LDADD = libmulti.a libplain.a

# 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)

AM_CPPFLAGS = $(neon_cppflags)
AM_CFLAGS = -std=gnu99 -Wall $(AM_CPPFLAGS)

EXTRA_DIST = \
	tests/hp-timing.h \
	tests/test-string.h \
	tests/test-skeleton.c \
	autogen.sh

add_on_dist = add-on-dist
add_on_dest = $(add_on_dist)/$(PACKAGE)/sysdeps/arm/eabi/arm/$(submachine)
add_on_dirs = thumb-2 $(submachine) $(neon_dirs)

add_on_src = \
	$(wildcard $(add_on_dirs:%=$(srcdir)/src/%/*.c)) \
	$(wildcard $(add_on_dirs:%=$(srcdir)/src/%/*.S)) \
	$(wildcard $(add_on_dirs:%=$(srcdir)/src/%/*.h))

add-on:
	rm -rf $(add_on_dist)
	mkdir -p $(add_on_dest)
	cp -f $(add_on_src) $(add_on_dest)
	python $(srcdir)/scripts/fixup.py GLIBC $(add_on_dest)/*
	tar cf $(PACKAGE).tar -C $(add_on_dist) .