Date: Thu, 5 Feb 2015 15:32:40 -0700 From: Warner Losh <imp@bsdimp.com> To: Dimitry Andric <dim@freebsd.org> Cc: "freebsd-arch@freebsd.org" <arch@FreeBSD.org> Subject: Re: Better way to do conditional inclusion in make Message-ID: <2F98809C-14AA-4658-BCF4-15A6179515C9@bsdimp.com> In-Reply-To: <B72A818B-A8ED-45C3-998E-D179F6B9F71D@FreeBSD.org> References: <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com> <B72A818B-A8ED-45C3-998E-D179F6B9F71D@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Feb 5, 2015, at 2:32 PM, Dimitry Andric <dim@freebsd.org> wrote: >=20 > On 05 Feb 2015, at 18:56, Warner Losh <imp@bsdimp.com> wrote: >>=20 >> 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 > One disadvantage is that you then cannot intersperse MK_foo files or > subdirs in between unconditional ones, and keep a certain order, e.g. > like: >=20 > FILES+=3D a b c > .if ${MK_foo} !=3D "no" > FILES+=3D d e f > .endif > FILES+=3D g h i >=20 > Of course, this is only important for a few particular places, most of > the tree should not care too much about the order in which subdirs or > files are built. I can=E2=80=99t think of any places where this matters. The only place = where it used to matter was library ordering, but that=E2=80=99s been fixed. And if there = is any other places in the tree where this matters, that should be listed as a real = dependency and not rely on the order which isn=E2=80=99t -j safe. Warner=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2F98809C-14AA-4658-BCF4-15A6179515C9>