freebsd-nq/usr.bin/sort/Makefile
Alex Richardson d053fb22f6 usr.bin/sort: Avoid UBSan errors
UBSan complains about out-of-bounds accesses for zero-length arrays. To
avoid this we can use flexible array members. However, the C standard does
not allow for structures that only contain flexible array members, so we
move the length parameters into that structure too.

Split out from D28233.

Reviewed By:	markj
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D31009
2021-07-06 10:51:05 +01:00

39 lines
666 B
Makefile

# $FreeBSD$
.include <src.opts.mk>
PROG= sort
SRCS= bwstring.c coll.c file.c mem.c radixsort.c sort.c vsort.c
CSTD= c11
sort.1: sort.1.in
sed ${MAN_SUB} ${.ALLSRC} >${.TARGET}
CLEANFILES+= sort.1
.if ${MK_SORT_THREADS} != "no"
CFLAGS+= -DSORT_THREADS
LIBADD= pthread md
MAN_SUB+= -e 's|%%THREADS%%||g'
.else
LIBADD= md
MAN_SUB+= -e 's|%%THREADS%%|\.\\"|g'
.endif
.if ${MK_NLS} != "no"
NLS+= hu_HU.ISO8859-2
NLSSRCFILES= ${NLS:S@$@.msg@}
MAN_SUB+= -e 's|%%NLS%%||g'
.for lang in ${NLS}
NLSSRCDIR_${lang}= ${.CURDIR}/nls
.endfor
.else
CFLAGS+= -DWITHOUT_NLS
MAN_SUB+= -e 's|%%NLS%%|\.\\"|g'
.endif
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>