NetBSD Problem Report #49087

From  Thu Aug  7 16:19:54 2014
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer "Postmaster" (verified OK))
	by (Postfix) with ESMTPS id 1C312AB8F6
	for <>; Thu,  7 Aug 2014 16:19:54 +0000 (UTC)
Message-Id: <>
Date: Thu,  7 Aug 2014 19:19:52 +0300 (EEST)
From: Jarmo Jaakkola <>
Reply-To: Jarmo Jaakkola <>
Subject: some makefiles in src/ use $(.IMPSRC) in explicit rules
X-Send-Pr-Version: 3.95

>Number:         49087
>Category:       toolchain
>Synopsis:       $(.IMPSRC) is incorrectly used in some explicit rules
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 07 16:20:00 +0000 2014
>Last-Modified:  Thu Aug 21 08:55:00 +0000 2014
>Originator:     Jarmo Jaakkola <>
>Release:        NetBSD 6.1.2_PATCH
System: NetBSD 6.1.2_PATCH NetBSD 6.1.2_PATCH (KOTOISA) #5: Mon Jan 20 17:01:44 EET 2014 amd64
Architecture: x86_64
Machine: amd64

Two makefiles in the src/ tree use $(.IMPSRC) in rules which are not
suffix transformation rules.  This should not work as that variable
is not supposed to exist for explicit rules.

It happens to work because there is a bug in make(1), which causes
implicit and explicit dependencies from transformation rules to be
applied on all applicable explicit rules. (see PR ?????, issue 8)

The offending makefiles are:




Don't use ${.IMPSRC} in non-transformation rules.

This is most probably NOT a proper fix, only a quick workaround.
A proper fix should most likely utilize suffix transformation rules.
 external/gpl3/gcc/lib/libgcc/ | 11 +++++++----
 lib/libc/net/                 |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/external/gpl3/gcc/lib/libgcc/ b/external/gpl3/gcc/lib/libgcc/
index 4819914..645350f 100644
--- a/external/gpl3/gcc/lib/libgcc/
+++ b/external/gpl3/gcc/lib/libgcc/
@@ -149,21 +149,24 @@ ${LIB1ASMFUNCS}: ${.CURDIR}/Makefile
 	printf '#define L${.PREFIX}\n#include <${G_LIB1ASMSRC}>\n' >${.TARGET}

+# XXX: this is ugly, can this be done with transformation rules?
-	${COMPILE.c} -fexceptions ${COPTS.${.IMPSRC:T}} -o ${.TARGET} ${.IMPSRC}
+	${COMPILE.c} -fexceptions ${COPTS.${.TARGET:.o=.c}} -o ${.TARGET} ${.ALLSRC:M*${.TARGET:.o=.c}}

-	${COMPILE.c} ${CPICFLAGS} -fexceptions ${COPTS.${.IMPSRC:T}} -o ${.TARGET} ${.IMPSRC}
+	${COMPILE.c} ${CPICFLAGS} -fexceptions ${COPTS.${.TARGET:.pico=.c}} -o ${.TARGET} ${.ALLSRC:M*${.TARGET:.pico=.c}}

-	${COMPILE.c} -fexceptions -fnon-call-exceptions ${COPTS.${.IMPSRC:T}} -o ${.TARGET} ${.IMPSRC}
+	${COMPILE.c} -fexceptions -fnon-call-exceptions ${COPTS.${.TARGET:.o=.c}} -o ${.TARGET} ${.ALLSRC:M*${.TARGET:.o=.c}}

-	${COMPILE.c} ${CPICFLAGS} -fexceptions -fnon-call-exceptions ${COPTS.${.IMPSRC:T}} -o ${.TARGET} ${.IMPSRC}
+	${COMPILE.c} ${CPICFLAGS} -fexceptions -fnon-call-exceptions ${COPTS.${.TARGET:.pico=.c}} -o ${.TARGET} ${.ALLSRC:M*${.TARGET:.pico=.c}}

 dp-bit.c: ${.CURDIR}/Makefile
diff --git a/lib/libc/net/ b/lib/libc/net/
index 08b3b66..7115871 100644
--- a/lib/libc/net/
+++ b/lib/libc/net/
@@ -36,7 +36,7 @@ CLEANFILES+=nsparser.c nslexer.c nsparser.h

 nslexer.c: nslexer.l nsparser.h
-	${LEX.l} -t ${.IMPSRC} | sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET}
+	${LEX.l} -t ${.ALLSRC:M*nslexer.l} | sed -e '/YY_BUF_SIZE/s/16384/1024/' >${.TARGET}

 # machine-dependent net sources
 # m-d must include sources for:

From: Jarmo Jaakkola <>
Subject: Re: toolchain/49087: some makefiles in src/ use $(.IMPSRC) in
	explicit rules
Date: Thu, 7 Aug 2014 19:26:46 +0300

 Sorry, I forgot to fill in the number of the referenced PR.

 It is PR 49086.

 Jarmo Jaakkola

From: Jarmo Jaakkola <>
Subject: Re: toolchain/49087: some makefiles in src/ use $(.IMPSRC) in
	explicit rules
Date: Tue, 19 Aug 2014 21:57:12 +0300

 After discussions on tech-toolchain (1), it was revealed to me that
 $(.IMPSRC) should be available like it is in gmake, not be unavailable
 like the manual page says.  The proper way of making $(.IMPSRC) available
 is now implemented in the patch for PR 49086.

 However, src/external/gpl3/gcc/lib/libgcc/ won't still work
 because its dependencies are not properly specified even for
 the improved functionality.  A proper patch for that file can be found from
 (use dynamic sources to specify the C file dependency)

 src/lib/libc/net/ is fine.


 Jarmo Jaakkola

From: "Christos Zoulas" <>
Subject: PR/49087 CVS commit: src/external/gpl3/gcc/lib/libgcc
Date: Thu, 21 Aug 2014 04:52:24 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Thu Aug 21 08:52:24 UTC 2014

 Modified Files:

 Log Message:
 PR/49087: Jarmo Jaakkola: Make sure that the first dependency is the C source
 file so ${.IMPSRC} gets set correctly.

 To generate a diff of this commit:
 cvs rdiff -u -r1.28 -r1.29 src/external/gpl3/gcc/lib/libgcc/

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

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.