summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authordsl <dsl@NetBSD.org>2009-08-12 21:18:42 +0000
committerdsl <dsl@NetBSD.org>2009-08-12 21:18:42 +0000
commit6f5236b423e270ffcfda38f4be264301e5c72dfd (patch)
tree456f53835fd205dbc0a0e0193c86cc5a5d006327 /sys
parent612dfc4de922ac3d04d50f9dc87bc6dde1d17316 (diff)
Use stuff from libc/Makefile to auto-remove .c files if a .S has been added.
Use it to dispose of tne .c files that were already only conditionally added.
Diffstat (limited to 'sys')
-rw-r--r--sys/lib/libkern/Makefile.libkern49
1 files changed, 18 insertions, 31 deletions
diff --git a/sys/lib/libkern/Makefile.libkern b/sys/lib/libkern/Makefile.libkern
index 172ab147faf..6f00261da4c 100644
--- a/sys/lib/libkern/Makefile.libkern
+++ b/sys/lib/libkern/Makefile.libkern
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.libkern,v 1.3 2009/07/21 14:55:33 joerg Exp $
+# $NetBSD: Makefile.libkern,v 1.4 2009/08/12 21:18:42 dsl Exp $
#
# Variable definitions for libkern.
@@ -54,7 +54,11 @@ SRCS+= __cmsg_alignbytes.c cpuset.c inet_addr.c intoa.c
SRCS+= md4c.c md5c.c rmd160.c sha1.c sha2.c
SRCS+= pmatch.c arc4random.c bcd.c mcount.c mertwist.c crc32.c
-SRCS+= strsep.c strstr.c strlcpy.c strlcat.c
+SRCS+= strsep.c strstr.c
+SRCS+= strlcpy.c strlcat.c
+SRCS+= memcpy.c memmove.c
+SRCS+= strchr.c strrchr.c
+SRCS+= popcount32.c popcount64.c
SRCS+= strtoll.c strtoull.c strtoumax.c
@@ -65,34 +69,17 @@ SRCS+= heapsort.c ptree.c rb.c
# Files to clean up
CLEANFILES+= lib${LIB}.o lib${LIB}.po
-# XXX these stub builds should be cleaned up even further.
-
-# if no machine specific memcpy(3), build one out of bcopy(3) based stub.
-.if empty(SRCS:Mmemcpy.S)
-SRCS+= memcpy.c
-.endif
-
-# if no machine specific memmove(3), build one out of bcopy(3) based stub.
-.if empty(SRCS:Mmemmove.S)
-SRCS+= memmove.c
-.endif
-
-# if no machine specific strchr(3), build one out of index(3) based stub.
-.if empty(SRCS:Mstrchr.S)
-SRCS+= strchr.c
-.endif
-
-# if no machine specific strrchr(3), build one out of rindex(3) based stub.
-.if empty(SRCS:Mstrrchr.S)
-SRCS+= strrchr.c
-.endif
-
-# if no machine specific popcount32(3), build generic version
-.if empty(SRCS:Mpopcount32.S)
-SRCS+= popcount32.c
+# Remove from SRCS the .c files for any .S files added by the MD makefiles,
+# also remove from SRCS the .c files for the .S and .c files in NO_SRCS.
+#
+# Usage:
+# Add .S files to NO_SRSC when another .S file provides the entry points.
+# Add .c files to NO_SRSC when another .c file provides the entry points.
+
+.for check_file in ${SRCS:M*.S} ${NO_SRCS}
+unwanted_file := ${SRCS:M${check_file:.S=.c}}
+.if "${unwanted_file}" != ""
+SRCS := ${SRCS:N${unwanted_file}}
.endif
+.endfor
-# if no machine specific popcount64(3), build generic version
-.if empty(SRCS:Mpopcount64.S)
-SRCS+= popcount64.c
-.endif