Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 2015 10:09:46 -0800
From:      Justin Hibbits <jhibbits@freebsd.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        "freebsd-arch@freebsd.org" <arch@freebsd.org>
Subject:   Re: Better way to do conditional inclusion in make
Message-ID:  <CAHSQbTAYZi3RkbA-krMos2wH7KPwEbhD=_iYYUHLPxibnh=5GA@mail.gmail.com>
In-Reply-To: <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com>
References:  <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 5, 2015 at 9:56 AM, Warner Losh <imp@bsdimp.com> wrote:
> Greetings,
>
> I=E2=80=99ve started a pass through the tree to cleanup how we do conditi=
onal inclusion in our build system.
>
> https://reviews.freebsd.org/D1781
>
> It moves away from
>
> .if ${MK_foo} !=3D =E2=80=9Cno=E2=80=9D
> FILES+=3D files
> .endif
>
> and
>
> SUBDIRS=3D =E2=80=A6 ${_foo} =E2=80=A6
> ...
> .if ${MK_foo} !=3D =E2=80=9Cno=E2=80=9D
> _foo+=3D foo
> .endif
>
> and instead more directly assigns things. We know that MK_foo is always g=
oing 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 t=
o something like:
>
> FILES=3Dlist of unconditional files here ${FILES.yes}
> FILES.${MK_foo}+=3Dfoo bar biz
> FILES.${MK_baz}+=3Dbaz bing boo
>
> which eliminates a whole lot of needless .if / .endif lines, lots of extr=
a blank lines, etc.
>
> Comments?
>
> Warner

I like it. It makes it easier to see at a glance what options are
available, and how the files are guarded.

- Justin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHSQbTAYZi3RkbA-krMos2wH7KPwEbhD=_iYYUHLPxibnh=5GA>