Date: Mon, 14 Jun 2010 20:56:00 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no> Cc: arch@FreeBSD.org Subject: Re: Change to config(8) for OFED Message-ID: <20100614201541.B37598@delplex.bde.org> In-Reply-To: <86zkz05bra.fsf@ds4.des.no> References: <alpine.BSF.2.00.1006111611380.1435@desktop> <20100612.101458.10150326125744273.imp@bsdimp.com> <20100612.111805.94843338670897167.imp@bsdimp.com> <86zkz05bra.fsf@ds4.des.no>
next in thread | previous in thread | raw e-mail | index | archive | help
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" <imp@bsdimp.com> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100614201541.B37598>