Change to config(8) for OFED

M. Warner Losh imp at bsdimp.com
Mon Jun 14 15:54:52 UTC 2010


In message: <20100614201541.B37598 at delplex.bde.org>
            Bruce Evans <brde at optusnet.com.au> writes:
: On Sat, 12 Jun 2010, [utf-8] Dag-Erling Smørgrav wrote:
: 
: > "M. Warner Losh" <imp at bsdimp.com> writes:
: >> but NORMAL_C is
: >>
: >> NORMAL_C= ${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
: > .ALLSRC
: > 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= ${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
: 	${ABNORMAL_C}
: %%%

That would work.  Not sure I like it, but it would work.

: This has no alternative of using .IMPSRC instead of .ALLSRC since its
: .IMPSRC 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.

I've never seen this rule documented either.  It is only a repeated
observation that I've seen over the years.  When I tried to chase it
into the source, I couldn't find the place that did this...

Warner


More information about the freebsd-arch mailing list