Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 2015 22:10:09 -0800
From:      "Simon J. Gerraty" <sjg@juniper.net>
To:        NGie Cooper <yaneurabeya@gmail.com>
Cc:        "freebsd-arch@freebsd.org" <arch@freebsd.org>
Subject:   Re: Better way to do conditional inclusion in make
Message-ID:  <11865.1423203009@chaos>
In-Reply-To: <CAGHfRMCNMoisdn=Xheg-V5SnJhvB1yfk2s_RJc%2BSHYLwt4eekA@mail.gmail.com>
References:  <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com> <54D40DC4.9070907@freebsd.org> <CAGHfRMAdOTUQZvU5D_1KYEyZdoaD4RJ2BTTOgUjrm3sK31U0kw@mail.gmail.com> <5180.1423185968@chaos> <CAGHfRMCNMoisdn=Xheg-V5SnJhvB1yfk2s_RJc%2BSHYLwt4eekA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
NGie Cooper <yaneurabeya@gmail.com> wrote:
> .if ${MK_BAR} != "no" && ${MK_FOO} != "no"
> FILES+= a_lot_of_bar_in_my_foo
> .endif
> 

Actually the same idea can handle that:

FILES+= ${FILES.yesyes}
FILES.${MK_BAR}${MK_FOO}+= a_lot_of_bar_in_my_foo

extend as far as you like

> >> What concerns me about the short description of the implementation,
> >> (and something that I'm going to add to the phabricator review) is
> >> that this will:
> >>
> >> 1. Break using FILESGROUPS
> >
> > Why?
> 
> The same reason why bsd.progs.mk didn't work with bsd.prog.mk on
> FreeBSD out of the box originally -- defaults:
> 
> 10 FILESGROUPS?=   FILES
> 11
> 12 .for group in ${FILESGROUPS}
> 13 buildfiles: ${${group}}
> 14 .endfor
> 15

If you do 

FILES:= ${FILES}

prior to the above and even if you don't 
I don't think the behavior would change - at least for the snippet quoted.

${${group}} would still expand to the same thing, and dependency rules
don't care if something is listed more than once

FILES:= ${FILES}

would probably be a good idea anyway though.

> Warner's change (based on what I understand, again I haven't looked at
> the review yet...) would require setting FILESGROUPS explicitly. So if
> you had a Makefile snippet that defines the non-default FILESGROUPS
> already, it will break that usecase.

I don't think Warners change - per the brief description makes no
difference to 

FILESGROUPS?=   FILES




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11865.1423203009>