xref: /freebsd/lib/libc/aarch64/string/Makefile.inc (revision a689bfa4e25af8307709dc12f75b0e02a65abf18)
1#
2# String handling from the Arm Optimized Routines
3# https://github.com/ARM-software/optimized-routines
4#
5
6AARCH64_STRING_FUNCS= \
7	memcmp \
8	memmove \
9	memrchr \
10	stpcpy \
11	strchr \
12	strchrnul \
13	strcpy \
14	strnlen \
15	strrchr
16
17AARCH64_STRING_IFUNC_FILES= \
18	memcpy-mops.S \
19	memmove-mops.S \
20	memset-mops.S
21
22# SIMD-enhanced routines not derived from Arm's code
23MDSRCS+= \
24	memchr.S \
25	strcmp.S \
26	strspn.S \
27	strcspn.S \
28	strpbrk.c \
29	strsep.c \
30	strcat.c \
31	strlcpy.S \
32	strncmp.S \
33	memccpy.S \
34	strncat.c \
35	strlcat.c \
36	strlen.S \
37	timingsafe_bcmp.S \
38	timingsafe_memcmp.S \
39	bcopy.c \
40	bzero.c \
41	memcpy.S \
42	memcpy_resolver.c \
43	memmove_resolver.c \
44	memset.S \
45	memset_resolver.c \
46	memset_zva64.S
47
48#
49# Add the above functions. Generate an asm file that includes the needed
50# Arm Optimized Routines file defining the function name to the libc name.
51# Some file need multiple macros defined or a weak symbol added we can
52# override the generated file in these cases.
53#
54.for FUNC in ${AARCH64_STRING_FUNCS}
55.if !exists(${LIBC_SRCTOP}/aarch64/string/${FUNC}.S)
56${FUNC}.S: ${LIBC_SRCTOP}/aarch64/string/Makefile.inc
57	printf '/* %sgenerated by libc/aarch64/string/Makefile.inc */\n' @ > ${.TARGET}
58	printf '#define	__%s_aarch64 %s\n' ${FUNC} ${FUNC} >> ${.TARGET}
59	printf '#include "aarch64/%s.S"\n' ${FUNC} >> ${.TARGET}
60CLEANFILES+=	${FUNC}.S
61.endif
62
63MDSRCS+=	${FUNC}.S
64CFLAGS.${FUNC}.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
65.endfor
66
67.for FILE in ${AARCH64_STRING_IFUNC_FILES}
68${FILE}: ${LIBC_SRCTOP}/aarch64/string/Makefile.inc
69	printf '/* %sgenerated by libc/aarch64/string/Makefile.inc */\n' @ > ${.TARGET}
70	printf '#include "aarch64/%s"\n' ${FILE} >> ${.TARGET}
71CLEANFILES+=   ${FILE}
72MDSRCS+=       ${FILE}
73CFLAGS.${FILE}+=-I${SRCTOP}/contrib/arm-optimized-routines/string
74.endfor
75
76# Several files are wrappers in the src tree for the implementation from
77# arm-optimized-routines
78CFLAGS.memchr.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
79CFLAGS.memcpy.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
80CFLAGS.memset.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
81CFLAGS.memset_zva64.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
82