From owner-freebsd-arch@FreeBSD.ORG Sun Jun 13 16:12:23 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 16FC11065676 for ; Sun, 13 Jun 2010 16:12:23 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id BADAA8FC0C for ; Sun, 13 Jun 2010 16:12:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id o5DGA3SB020743; Sun, 13 Jun 2010 10:10:03 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 13 Jun 2010 10:10:06 -0600 (MDT) Message-Id: <20100613.101006.549303830244327332.imp@bsdimp.com> To: jroberson@jroberson.net From: "M. Warner Losh" In-Reply-To: References: <86zkz05bra.fsf@ds4.des.no> <20100613.023223.972525811890973035.imp@bsdimp.com> X-Mailer: Mew version 6.3 on Emacs 22.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: des@des.no, 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: Sun, 13 Jun 2010 16:12:23 -0000 In message: Jeff Roberson writes: : On Sun, 13 Jun 2010, M. Warner Losh wrote: : : > In message: <86zkz05bra.fsf@ds4.des.no> : > Dag-Erling Sm?rgrav writes: : > : "M. Warner Losh" 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