Module Name:    src
Committed By:   dsl
Date:           Wed Aug 12 21:18:43 UTC 2009

Modified Files:
        src/sys/lib/libkern: Makefile.libkern

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/lib/libkern/Makefile.libkern

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libkern/Makefile.libkern
diff -u src/sys/lib/libkern/Makefile.libkern:1.3 src/sys/lib/libkern/Makefile.libkern:1.4
--- src/sys/lib/libkern/Makefile.libkern:1.3	Tue Jul 21 14:55:33 2009
+++ src/sys/lib/libkern/Makefile.libkern	Wed Aug 12 21:18:42 2009
@@ -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+=	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 @@
 # 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

Reply via email to