~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
# Top level Makefile for cortexcpu

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

# The main library
lib_LTLIBRARIES = \
	libcortexcpu.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-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
libcortexcpu_la_SOURCES = \
	src/neon/memcpy.S \
	src/neon/memset.S \
	src/thumb-2/strcmp.c \
	src/thumb-2/strcpy.c \
	src/thumb-2/strlen.c

# Options for the tests
tests_test_memcpy_LDADD = libcortexcpu.la
tests_test_memcpy_CFLAGS = -Itests $(AM_CFLAGS)
tests_test_memset_LDADD = libcortexcpu.la
tests_test_memset_CFLAGS = -Itests $(AM_CFLAGS)
tests_test_strcmp_LDADD = libcortexcpu.la
tests_test_strcmp_CFLAGS = -Itests $(AM_CFLAGS)
tests_test_strcpy_LDADD = libcortexcpu.la
tests_test_strcpy_CFLAGS = -Itests $(AM_CFLAGS)
tests_test_strlen_LDADD = libcortexcpu.la
tests_test_strlen_CFLAGS = -Itests $(AM_CFLAGS)

TESTS = $(check_PROGRAMS)

# Libraries containing the difference reference versions
libbionic_a_SOURCES = \
	reference/bionic/memcmp.S \
	reference/bionic/memcmp16.S \
	reference/bionic/strlen.c \
	reference/bionic/memset.S \
	reference/bionic/memcpy.S

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

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

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_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

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

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

AM_CFLAGS = -std=gnu99 -mfpu=neon -Wall
AM_CPPFLAGS = -mfpu=neon

add_on_dist = add-on-dist
add_on_dest = $(add_on_dist)/$(PACKAGE)/sysdeps/arm/eabi/arm/$(submachine)
add_on_dirs = thumb-2 $(submachine) $(if $(filter yes,$(with_neon)),neon)
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) .