NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/49087: some makefiles in src/ use $(.IMPSRC) in explicit rules



>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
>Originator:     Jarmo Jaakkola <jarmo.jaakkola%roskakori.fi@localhost>
>Release:        NetBSD 6.1.2_PATCH
>Organization:
>Environment:
System: NetBSD kotoisa.roskakori.fi 6.1.2_PATCH NetBSD 6.1.2_PATCH (KOTOISA) 
#5: Mon Jan 20 17:01:44 EET 2014 
jammuli%kotoisa.roskakori.fi@localhost:/usr/src/sys/arch/amd64/compile/KOTOISA 
amd64
Architecture: x86_64
Machine: amd64
>Description:

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:
        src/external/gpl3/gcc/lib/libgcc/Makefile.inc
        src/lib/libc/net/Makefile.inc

>How-To-Repeat:

N/A

>Fix:

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/Makefile.inc | 11 +++++++----
 lib/libc/net/Makefile.inc                 |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/external/gpl3/gcc/lib/libgcc/Makefile.inc 
b/external/gpl3/gcc/lib/libgcc/Makefile.inc
index 4819914..645350f 100644
--- a/external/gpl3/gcc/lib/libgcc/Makefile.inc
+++ b/external/gpl3/gcc/lib/libgcc/Makefile.inc
@@ -149,21 +149,24 @@ ${LIB1ASMFUNCS}: ${.CURDIR}/Makefile
        printf '#define L${.PREFIX}\n#include <${G_LIB1ASMSRC}>\n' >${.TARGET}
 .endif
 
+# XXX: this is ugly, can this be done with transformation rules?
+
 ${LIB2_EH:.c=.o}:
        ${_MKTARGET_COMPILE}
-       ${COMPILE.c} -fexceptions ${COPTS.${.IMPSRC:T}} -o ${.TARGET} ${.IMPSRC}
+       ${COMPILE.c} -fexceptions ${COPTS.${.TARGET:.o=.c}} -o ${.TARGET} 
${.ALLSRC:M*${.TARGET:.o=.c}}
+
 
 ${LIB2_EH:.c=.pico}:
        ${_MKTARGET_COMPILE}
-       ${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}}
 
 ${G_LIB2_DIVMOD_FUNCS:=.o}:
        ${_MKTARGET_COMPILE}
-       ${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}}
 
 ${G_LIB2_DIVMOD_FUNCS:=.pico}:
        ${_MKTARGET_COMPILE}
-       ${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
        ${_MKTARGET_CREATE}
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc
index 08b3b66..7115871 100644
--- a/lib/libc/net/Makefile.inc
+++ b/lib/libc/net/Makefile.inc
@@ -36,7 +36,7 @@ CLEANFILES+=nsparser.c nslexer.c nsparser.h
 
 nslexer.c: nslexer.l nsparser.h
        ${_MKTARGET_LEX}
-       ${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 Makefile.inc must include sources for:



Home | Main Index | Thread Index | Old Index