Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 2015 20:18:28 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Julian Elischer <julian@freebsd.org>
Cc:        "freebsd-arch@freebsd.org" <arch@FreeBSD.org>
Subject:   Re: Better way to do conditional inclusion in make
Message-ID:  <07D8BEB5-8142-431A-B823-4900D664CEE2@bsdimp.com>
In-Reply-To: <54D40DC4.9070907@freebsd.org>
References:  <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com> <54D40DC4.9070907@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> On Feb 5, 2015, at 5:41 PM, Julian Elischer <julian@freebsd.org> =
wrote:
>=20
> On 2/6/15 1:56 AM, Warner Losh wrote:
>> Greetings,
>>=20
>> I=E2=80=99ve started a pass through the tree to cleanup how we do =
conditional inclusion in our build system.
>>=20
>> https://reviews.freebsd.org/D1781
>>=20
>> It moves away from
>>=20
>> .if ${MK_foo} !=3D =E2=80=9Cno=E2=80=9D
>> FILES+=3D files
>> .endif
>>=20
>> and
>>=20
>> SUBDIRS=3D =E2=80=A6 ${_foo} =E2=80=A6
>> ...
>> .if ${MK_foo} !=3D =E2=80=9Cno=E2=80=9D
>> _foo+=3D foo
>> .endif
>>=20
>> and instead more directly assigns things. We know that MK_foo is =
always going to be yes or no
>> for build options. We can leverage that fact, and the fact that bmake =
is so much better at variable
>> expansion than fmake was (especially in the early days) to instead =
move to something like:
>>=20
>> FILES=3Dlist of unconditional files here ${FILES.yes}
>> FILES.${MK_foo}+=3Dfoo bar biz
>> FILES.${MK_baz}+=3Dbaz bing boo
>>=20
>> which eliminates a whole lot of needless .if / .endif lines, lots of =
extra blank lines, etc.
>>=20
>> Comments?
>=20
> how does it cope with the case where a single file is dependent on =
either of two options.
> (we have this in our tree.. not sure if it occurs in the FreeBSD =
tree.)
> file could occur in both lists or twice in one list..

We have this in our tree a fair amount. power, for example, is enabled =
with either MK_ACPI or
MK_APM. When it is either/or, just list it for both.

FILES.${MK_APCI}+=3D acpiconf powerd
FILES.${MK_APM}+=3D powerd

The FILES:=3D${FILES:O:u} at the end sorts everything and removes the =
duplicates.

Warner=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?07D8BEB5-8142-431A-B823-4900D664CEE2>