From owner-freebsd-arch@FreeBSD.ORG Thu Feb 5 23:33:53 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A0F1BA6D; Thu, 5 Feb 2015 23:33:53 +0000 (UTC) Received: from mail-ig0-x22a.google.com (mail-ig0-x22a.google.com [IPv6:2607:f8b0:4001:c05::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 67B69EF3; Thu, 5 Feb 2015 23:33:53 +0000 (UTC) Received: by mail-ig0-f170.google.com with SMTP id l13so8938868iga.1; Thu, 05 Feb 2015 15:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6NIfPStCglRvtxI6R1v29JV0c04XhLSXCJr6IatXt0s=; b=X8JNTH2AB3VuBGp7ynoFueThUC34XYCrraqA/arWt0P9F+VrrRoBF+61YGD65WfJIm KMGcPsgRnyCVbovcod5AzarTpbfUrUFbUErNLh0k6MMTAa9NYacg7EGo/yZxO2EP4H+f H5F0S+AY0e0mv814QyzjCxK7D9RKBb63fpa3ThucqgNEDyLJYrQ+YHHxADcaTuXE6H2A ZNibk9nPjiDoaN5XKrVhTxzBANqbkruoVmW5+i4iAEtzm1E8kaYHjofide3R8IkViZua 3KNCMSpoXrF6qqaXDc5fcAIk8wArP2jrLCm2FGVE+uqk/a/JTmDxMFniW2fx6u9i6VSH XmZw== MIME-Version: 1.0 X-Received: by 10.50.82.68 with SMTP id g4mr1266917igy.26.1423179232723; Thu, 05 Feb 2015 15:33:52 -0800 (PST) Received: by 10.50.182.233 with HTTP; Thu, 5 Feb 2015 15:33:52 -0800 (PST) In-Reply-To: References: <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com> Date: Thu, 5 Feb 2015 15:33:52 -0800 Message-ID: Subject: Re: Better way to do conditional inclusion in make From: NGie Cooper To: Dimitry Andric Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2015 23:33:53 -0000 On Thu, Feb 5, 2015 at 1:32 PM, Dimitry Andric wrote: > On 05 Feb 2015, at 18:56, Warner Losh wrote: >> >> 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: >> >> FILES=list of unconditional files here ${FILES.yes} >> FILES.${MK_foo}+=foo bar biz >> FILES.${MK_baz}+=baz bing boo >> >> which eliminates a whole lot of needless .if / .endif lines, lots of extra blank lines, etc. >> >> Comments? > > 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: > > FILES+= a b c > .if ${MK_foo} != "no" > FILES+= d e f > .endif > FILES+= g h i > > 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. Depending on implicit ordering like that is brittle and I'd rather not enable this kind of pattern...