xref: /freebsd/lib/libc/aarch64/string/Makefile.inc (revision 86077f4fd11070518a6d04eee7fdb93cbbfb1b52)
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	memcpy \
9	memmove \
10	memrchr \
11	memset \
12	stpcpy \
13	strchr \
14	strchrnul \
15	strcpy \
16	strnlen \
17	strrchr
18
19# SIMD-enhanced routines not derived from Arm's code
20MDSRCS+= \
21	memchr.S \
22	strcmp.S \
23	strspn.S \
24	strcspn.S \
25	strpbrk.c \
26	strsep.c \
27	strcat.c \
28	strlcpy.S \
29	strncmp.S \
30	memccpy.S \
31	strncat.c \
32	strlcat.c \
33	strlen.S \
34	timingsafe_bcmp.S \
35	timingsafe_memcmp.S \
36	bcopy.c \
37	bzero.c
38
39#
40# Add the above functions. Generate an asm file that includes the needed
41# Arm Optimized Routines file defining the function name to the libc name.
42# Some file need multiple macros defined or a weak symbol added we can
43# override the generated file in these cases.
44#
45.for FUNC in ${AARCH64_STRING_FUNCS}
46.if !exists(${FUNC}.S)
47${FUNC}.S:
48	printf '/* %sgenerated by libc/aarch64/string/Makefile.inc */\n' @ > ${.TARGET}
49	printf '#define	__%s_aarch64 %s\n' ${FUNC} ${FUNC} >> ${.TARGET}
50	printf '#include "aarch64/%s.S"\n' ${FUNC} >> ${.TARGET}
51CLEANFILES+=	${FUNC}.S
52.endif
53
54MDSRCS+=	${FUNC}.S
55CFLAGS.${FUNC}.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
56.endfor
57
58# memchr.S is a wrapper in the src tree for the implementation from
59# arm-optimized-routines
60CFLAGS.memchr.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
61