From owner-freebsd-arch@FreeBSD.ORG Mon Jun 14 10:56:15 2010 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A77C1065673 for ; Mon, 14 Jun 2010 10:56:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id A41E48FC1A for ; Mon, 14 Jun 2010 10:56:14 +0000 (UTC) Received: from c122-106-175-69.carlnfd1.nsw.optusnet.com.au (c122-106-175-69.carlnfd1.nsw.optusnet.com.au [122.106.175.69]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id o5EAu1GJ024259 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 14 Jun 2010 20:56:03 +1000 Date: Mon, 14 Jun 2010 20:56:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= In-Reply-To: <86zkz05bra.fsf@ds4.des.no> Message-ID: <20100614201541.B37598@delplex.bde.org> References: <20100612.101458.10150326125744273.imp@bsdimp.com> <20100612.111805.94843338670897167.imp@bsdimp.com> <86zkz05bra.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-542411416-1276512960=:37598" Cc: arch@FreeBSD.org Subject: Re: Change to config(8) for OFED X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jun 2010 10:56:15 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-542411416-1276512960=:37598 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sat, 12 Jun 2010, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote: > "M. Warner Losh" writes: >> but NORMAL_C is >> >> NORMAL_C=3D ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} >> >> and .IMPSRC is null. That seems like a bug to me, but I'm not sure if >> the bug is that .IMPSRC is computed wrong, or if it really should be >> ${.ALLSRC} > > .IMPSRC is the *implicit* source and is only valid in *implicit* rules. However, NORMAL_C and related macros have always depended on it being defined to something reasonable so that they can abuse it in explicit rules. > Consider the following: > > .SUFFIXES: .foo .bar > .foo.bar: foo2bar.sh > /bin/sh foo2bar.sh ${.IMPSRC} ${.TARGET} > > When building hello.bar from hello.foo, .IMPSRC is "hello.foo" but .ALLSR= C > is "hello.foo foo2bar.sh". > > GNU make has a way of defining more complex implicit rules (pattern > rules). If we had something similar, we could do: > > foo_%.o: %.c > ${NORMAL_C} BSD make can handle simple cases like this using pattern filters and substitution. E.g.: %%% ABNORMAL_C=3D ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.ALLSRC:M*.c:S/^foo_//= } # Untested more careful patterns: ${.ALLSRC:M^foo*.c$:S/^foo_//} bar.o: foo_bar.c stuff.nonc =09${ABNORMAL_C} %%% This has no alternative of using .IMPSRC instead of .ALLSRC since its =2EIMPSRC is empty with the above dependencies. The rule for getting a nonempty .IMPSRC in an explicit dependency with BSD makef seems to be: some of the sources must match the target according to a suffix rule; then the first matching one (according to the order of the sources in the dependency list for the target) becomes .IMPSRC, so .IMPSRC always contains either 0 or 1 name. I've don't remember having seen the exact rule documented. Bruce --0-542411416-1276512960=:37598--