Date: Sun, 13 Jun 2010 10:10:06 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: jroberson@jroberson.net Cc: des@des.no, arch@freebsd.org Subject: Re: Change to config(8) for OFED Message-ID: <20100613.101006.549303830244327332.imp@bsdimp.com> In-Reply-To: <alpine.BSF.2.00.1006122328470.1435@desktop> References: <86zkz05bra.fsf@ds4.des.no> <20100613.023223.972525811890973035.imp@bsdimp.com> <alpine.BSF.2.00.1006122328470.1435@desktop>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <alpine.BSF.2.00.1006122328470.1435@desktop> Jeff Roberson <jroberson@jroberson.net> writes: : On Sun, 13 Jun 2010, M. Warner Losh wrote: : : > In message: <86zkz05bra.fsf@ds4.des.no> : > Dag-Erling Sm?rgrav <des@des.no> writes: : > : "M. Warner Losh" <imp@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. No. You can't set make variables within targets, unless you are doing subtargets: foo.o: bar.c (cd subdir; make FRED=WILMA BARNEY=BETTY gerbils) Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100613.101006.549303830244327332.imp>