Loading...
--- Libc/Libc-498.1.7/stdlib/Makefile.inc
+++ Libc/Libc-583/stdlib/Makefile.inc
@@ -9,6 +9,9 @@
CWD := ${.CURDIR}/stdlib
MISRCS+=a64l.c grantpt.c l64a.c
+.ifdef FEATURE_BLOCKS
+MISRCS+=qsort_b.c
+.endif # FEATURE_BLOCKS
.include "Makefile.fbsd_begin"
FBSDMISRCS=_Exit_.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
@@ -22,6 +25,62 @@
FBSDHDRS= atexit.h
.include "Makefile.fbsd_end"
+# special cases: heapsort_b-fbsd.c, merge_b-fbsd.c
+.for _file in heapsort merge
+.ifmake autopatch
+.for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
+AUTOPATCHSRCS+= ${_cwd}/${_file}_b-fbsd.c
+${_cwd}/${_file}_b-fbsd.c: ${_cwd}/FreeBSD/${_file}.c
+ ${CP} ${.ALLSRC} ${.TARGET}
+ ${PATCH} ${.TARGET} ${.ALLSRC:S/${_file}/${_file}_b/}.patch
+.endfor # _cwd
+.else # !autopatch
+.ifdef FEATURE_BLOCKS
+MISRCS+= ${_file}_b.c
+.endif # FEATURE_BLOCKS
+.endif # autopatch
+.endfor # _file
+
+# special cases: heapsort_r-fbsd.c
+.for _file in heapsort
+.ifmake autopatch
+.for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
+AUTOPATCHSRCS+= ${_cwd}/${_file}_r-fbsd.c
+${_cwd}/${_file}_r-fbsd.c: ${_cwd}/FreeBSD/${_file}.c
+ ${CP} ${.ALLSRC} ${.TARGET}
+ ${PATCH} ${.TARGET} ${.ALLSRC:S/${_file}/${_file}_r/}.patch
+.endfor # _cwd
+.else # !autopatch
+MISRCS+= ${_file}_r.c
+.endif # autopatch
+.endfor # _file
+
+# special cases: psort{,_b,_r}-fbsd.c psort.3
+.for _cwd in ${CWD} # This .for statement forces evaluation of ${CWD}
+.ifmake autopatch
+AUTOPATCHSRCS+= ${_cwd}/psort-fbsd.c
+${_cwd}/psort-fbsd.c: ${_cwd}/qsort-fbsd.c
+ ${CP} ${.ALLSRC} ${.TARGET}
+ ${PATCH} ${.TARGET} ${_cwd}/psort.c.patch
+.for _file in psort_b psort_r
+AUTOPATCHSRCS+= ${_cwd}/${_file}-fbsd.c
+${_cwd}/${_file}-fbsd.c: ${_cwd}/psort-fbsd.c
+ ${LN} ${.ALLSRC} ${.TARGET}
+.endfor # _file
+AUTOPATCHMAN+= ${_cwd}/psort.3
+${_cwd}/psort.3: ${_cwd}/qsort.3
+ ${CP} ${.ALLSRC} ${.TARGET}
+ ${PATCH} ${.TARGET} ${_cwd}/psort.3.patch
+.else # !autopatch
+MISRCS+= psort.c psort_r.c
+CFLAGS-psort_r-fbsd.c += -DI_AM_PSORT_R
+.ifdef FEATURE_BLOCKS
+MISRCS+= psort_b.c
+CFLAGS-psort_b-fbsd.c += -DI_AM_PSORT_B
+.endif # FEATURE_BLOCKS
+.endif # autopatch
+.endfor # _cwd
+
.include "Makefile.nbsd_begin"
NBSDMISRCS = strfmon.c
.include "Makefile.nbsd_end"
@@ -50,7 +109,7 @@
CFLAGS-system-fbsd.c += -DLIBC_ALIAS_SYSTEM
.if ${LIB} == "c"
-MAN3+= a64l.3 grantpt.3
+MAN3+= a64l.3 grantpt.3 psort.3
MAN3+= strtod_l.3 strtol_l.3
.include "Makefile.fbsd_begin"
@@ -71,6 +130,10 @@
MLINKS+= a64l.3 l64a.3
+.ifdef FEATURE_BLOCKS
+MLINKS+= atexit.3 atexit_b.3
+.endif # FEATURE_BLOCKS
+
MLINKS+= atof.3 atof_l.3
MLINKS+= atoi.3 atoi_l.3
@@ -79,6 +142,10 @@
atol.3 atoll.3 \
atol.3 atoll_l.3
+.ifdef FEATURE_BLOCKS
+MLINKS+= bsearch.3 bsearch_b.3
+.endif # FEATURE_BLOCKS
+
MLINKS+= ecvt.3 fcvt.3 \
ecvt.3 gcvt.3
@@ -101,9 +168,19 @@
MLINKS+= lsearch.3 lfind.3
+MLINKS+= psort.3 psort_r.3
+.ifdef FEATURE_BLOCKS
+MLINKS+= psort.3 psort_b.3
+.endif # FEATURE_BLOCKS
+
MLINKS+= qsort.3 heapsort.3 \
qsort.3 mergesort.3 \
qsort.3 qsort_r.3
+.ifdef FEATURE_BLOCKS
+MLINKS+= qsort.3 heapsort_b.3 \
+ qsort.3 mergesort_b.3 \
+ qsort.3 qsort_b.3
+.endif # FEATURE_BLOCKS
MLINKS+= radixsort.3 sradixsort.3