Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Oct 1997 16:47:47 +0200 (CEST)
From:      Martin Kammerhofer <dada@sbox.tu-graz.ac.at>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/4736: Bugs in /usr/share/mk/bsd.*.mk bsd-make include files
Message-ID:  <199710091447.QAA07975@lend.tu-graz.ac.at>
Resent-Message-ID: <199710091500.IAA05117@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4736
>Category:       bin
>Synopsis:       Bugs in /usr/share/mk/bsd.*.mk bsd-make include files
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct  9 08:00:01 PDT 1997
>Last-Modified:
>Originator:     Martin Kammerhofer
>Organization:
Graz University of Technology
>Release:        FreeBSD 2.2.2-RELEASE i386
>Environment:

        probably all BSDs, for sure in FreeBSD 2.2.2

>Description:

        There are make rules wich are intended to define default rules
        for undefined targets, i.e targets never occuring on the left
        side of a dependency.
        E.g. from bsd.subdir.mk:

.for __target in all checkdpadd clean cleandir depend lint \
                 maninstall obj objlink
.if !target(__target)
${__target}: _SUBDIRUSE
.endif
.endfor

        These do not work as intended because ``__target'' is taken
        literally. It should - of course - read:

.if !target(${__target})

        As a consequence these default rules are added *unconditionally*
        (except for the case where someone has explicitely defined
        a ``__target'' target, in which case no rule at all would get
        added).
        There are at least three of these bugs:

<ttyp4 /src/share/mk>fgrep -n target\(_ *
bsd.port.subdir.mk:51:.if !target(__target)
bsd.sgml.mk:152:.if !target(__target)
bsd.subdir.mk:31:.if !target(__target)

>How-To-Repeat:

<ttyp4 /var/tmp>cat Makefile

SUBDIR = nosuchsubdir

all:
        @echo "This rule won't fall over after fixing this bug"

clean: _SUBDIRUSE
        @echo "This is expected to fail"

.include <bsd.subdir.mk>

<ttyp4 /var/tmp>make
This rule won't fall over after fixing this bug
===> nosuchsubdir
cd: can't cd to /var/tmp/nosuchsubdir
*** Error code 2

Stop.
<ttyp4 /var/tmp>

>Fix:
        
        substitute ``target(${__target})'' for ``target(__target)''

        Note: Since this affects all makes it could theoretically break
              existing Makefiles if they relied on this bug.
              If you want the default rules added, you have to specify
              a ``_SUBDIRUSE'' dependency like in ``clean'' above.

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710091447.QAA07975>