Module Name:    src
Committed By:   pooka
Date:           Mon Dec 10 20:58:55 UTC 2012

Modified Files:
        src/share/mk: bsd.gcc.mk

Log Message:
Deal with crti and crtn not present in some EXTERNAL_TOOLCHAIN's.  Also,
handle "missing" crtstuff internally instead of depending on external
intervention.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/mk/bsd.gcc.mk

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

Modified files:

Index: src/share/mk/bsd.gcc.mk
diff -u src/share/mk/bsd.gcc.mk:1.7 src/share/mk/bsd.gcc.mk:1.8
--- src/share/mk/bsd.gcc.mk:1.7	Wed Nov 21 20:30:01 2012
+++ src/share/mk/bsd.gcc.mk	Mon Dec 10 20:58:55 2012
@@ -1,22 +1,30 @@
-#	$NetBSD: bsd.gcc.mk,v 1.7 2012/11/21 20:30:01 pooka Exp $
+#	$NetBSD: bsd.gcc.mk,v 1.8 2012/12/10 20:58:55 pooka Exp $
 
 .if !defined(_BSD_GCC_MK_)
 _BSD_GCC_MK_=1
 
 .if defined(EXTERNAL_TOOLCHAIN)
 _GCC_CRTBEGIN!=		${CC} --print-file-name=crtbegin.o
-.ifndef _GCC_CRTBEGINS
-_GCC_CRTBEGINS!=	${CC} --print-file-name=crtbeginS.o
-.endif
 _GCC_CRTEND!=		${CC} --print-file-name=crtend.o
-.ifndef _GCC_CRTENDS
-_GCC_CRTENDS!=		${CC} --print-file-name=crtendS.o
-.endif
-_GCC_CRTI!=		${CC} --print-file-name=crti.o
-_GCC_CRTN!=		${CC} --print-file-name=crtn.o
-_GCC_CRTDIR!=		dirname ${_GCC_CRTBEGIN}
-_GCC_LIBGCCDIR!=	dirname `${CC} --print-libgcc-file-name`
+
+# If the toolchain does not know about a file, --print-file-name echoes
+# the input file name (why??).  In that case we want an empty string for
+# dependencies to work correctly.  Note: do _not_ use TOOL_SED here because
+# this file is used before TOOL_SED is built.
+_GCC_CRTBEGINS!=	${CC} --print-file-name=crtbeginS.o		\
+			    | sed 's|^crtbeginS.o$$||'
+_GCC_CRTENDS!=		${CC} --print-file-name=crtendS.o		\
+			    | sed 's|^crtendS.o$$||'
+_GCC_CRTI!=		${CC} --print-file-name=crti.o			\
+			    | sed 's|^crti.o$$||'
+_GCC_CRTN!=		${CC} --print-file-name=crtn.o			\
+			    | sed 's|^crtn.o$$||'
+
+_GCC_CRTDIR!=    	dirname ${_GCC_CRTBEGIN}
+_GCC_LIBGCCDIR!= 	dirname `${CC} --print-libgcc-file-name`
+
 .else
+
 _GCC_CRTBEGIN?=		${DESTDIR}/usr/lib/crtbegin.o
 _GCC_CRTBEGINS?=	${DESTDIR}/usr/lib/crtbeginS.o
 _GCC_CRTEND?=		${DESTDIR}/usr/lib/crtend.o

Reply via email to