From owner-freebsd-arch@FreeBSD.ORG Sun Jun 13 09:34:37 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 A7765106566B for ; Sun, 13 Jun 2010 09:34:37 +0000 (UTC) (envelope-from jroberson@jroberson.net) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id BC01B8FC14 for ; Sun, 13 Jun 2010 09:34:32 +0000 (UTC) Received: by pwi3 with SMTP id 3so1314165pwi.13 for ; Sun, 13 Jun 2010 02:34:31 -0700 (PDT) Received: by 10.140.55.16 with SMTP id d16mr3299050rva.26.1276421666714; Sun, 13 Jun 2010 02:34:26 -0700 (PDT) Received: from [10.0.1.198] (udp022762uds.hawaiiantel.net [72.234.79.107]) by mx.google.com with ESMTPS id l29sm3405379rvb.16.2010.06.13.02.34.24 (version=SSLv3 cipher=RC4-MD5); Sun, 13 Jun 2010 02:34:25 -0700 (PDT) Date: Sat, 12 Jun 2010 23:35:03 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: "M. Warner Losh" In-Reply-To: <20100613.023223.972525811890973035.imp@bsdimp.com> Message-ID: References: <20100612.101458.10150326125744273.imp@bsdimp.com> <20100612.111805.94843338670897167.imp@bsdimp.com> <86zkz05bra.fsf@ds4.des.no> <20100613.023223.972525811890973035.imp@bsdimp.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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 09:34:37 -0000 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. Thanks, Jeff > > Warner >