Change to config(8) for OFED
Jeff Roberson
jroberson at jroberson.net
Sun Jun 13 09:34:37 UTC 2010
On Sun, 13 Jun 2010, M. Warner Losh wrote:
> In message: <86zkz05bra.fsf at ds4.des.no>
> Dag-Erling Sm?rgrav <des at des.no> writes:
> : "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.
> : 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".
>
> Yes, it appears to be set only when the target matches the object, so
> the .c.o rule matches, even if the more specific one is used (where
> there is not a match).
>
> : 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}
>
> Yes. I'm starting to think that this would be necessary to implement
> this properly. Or, as Jeff suggested, have config generate a complete
> compile line with -o foo_bar.o -c bar.c in the line...
Here's what I ended up with:
In kern.pre.mk:
+OFED_C_NOIMP= ${CC} -c ${OFEDCFLAGS} ${WERROR} ${OFEDNOERR} ${PROF}
+OFED_C= ${OFED_C_NOIMP} ${.IMPSRC}
I don't use NORMAL_C as linux doesn't use some warnings that we specify
and I need to modify the include path to search the linux wrapper paths
first.
in files:
+ofed/drivers/infiniband/hw/mlx4/ah.c optional mlx4 \
+ no-depend obj-prefix "mlx4_" \
+ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
Generated Makefile:
mlx4_ah.o: $S/ofed/drivers/infiniband/hw/mlx4/ah.c
${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/ $S/ofed/drivers/infiniband/hw/mlx4/ah.c
And the patch to config:
http://people.freebsd.org/~jeff/objprefix.diff
The full source path is only emitted when an object prefix is set. If you
don't like this diff please speak now before I commit. It will go to my
private branch for ofed first but I'm sure I'll forget about it before I
merge.
I still need to change config so it will do proper depends for files which
require extra includes. Before then I just specify no-depend for ib.
Is it possible to set make variables within targets? I can export shell
variables since that's an executable command. I could then refer to the
shell variables in the scripts but that seems really gross.
Thanks,
Jeff
>
> Warner
>
More information about the freebsd-arch
mailing list