From owner-freebsd-arch@FreeBSD.ORG Wed Jan 4 01:32:43 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3208106566B; Wed, 4 Jan 2012 01:32:43 +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 616798FC0A; Wed, 4 Jan 2012 01:32:43 +0000 (UTC) Received: from 63.imp.bsdimp.com (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id q041VBGr013707 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Tue, 3 Jan 2012 18:31:12 -0700 (MST) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Tue, 3 Jan 2012 18:31:11 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <5B845928-5DDC-4DB8-BFD5-1A0599D261EC@bsdimp.com> References: <15285562-E9BA-431B-A2C1-D0547DFB2663@bsdimp.com> <201201030924.44493.jhb@freebsd.org> To: Adrian Chadd X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Tue, 03 Jan 2012 18:31:12 -0700 (MST) Cc: freebsd-arch@freebsd.org Subject: Re: Request for help: how do teach module building about kernel options? 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: Wed, 04 Jan 2012 01:32:43 -0000 On Jan 3, 2012, at 5:12 PM, Adrian Chadd wrote: > On 3 January 2012 15:31, Warner Losh wrote: >=20 >> Please find enclosed a proposed patch. This will not build, of = course, since there's no file in the tree mesh_baby.c, so if you have = IEEE80211_SUPPORT_MESH defined, it won't work. It keys off the actual = define. >>=20 >> It even works with devices (which define DEV_xxx), but only if you = have it in the options file like isa (eg, you need to tell config to = generate it). >>=20 >> Comments? >=20 > I don't strictly need the SRCS line just yet - I can wrap it up in an > if: (not correct make fu, but you get the idea): >=20 > .if (KERNOPT_IEEE80211_SUPPORT_MESH =3D=3D 1) > SRCS+=3D ieee80211_mesh.c > .endif >=20 > .if (KERNOPT_IEEE80211_SUPPORT_TDMA =3D=3D 1) > SRCS+=3D ieee80211_tdma.c > .endif The problem with this method is the chicken/egg problem. These defines = aren't defined until after kmod.mk has been included. But the kmod.mk = files depend, in some places, on having a full list. The = SRCS_IEE80211_SUPPORT_MESH solves this problem nicely. > What do you mean about DEV_xxx? Can you give me an example to look at > in the sys directory? isa. Look at sys/conf/options* to see what I'm talking about. Warner=