From owner-freebsd-arch@FreeBSD.ORG Thu Feb 5 22:32:43 2015 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 83EB1564 for ; Thu, 5 Feb 2015 22:32:43 +0000 (UTC) Received: from mail-ig0-f171.google.com (mail-ig0-f171.google.com [209.85.213.171]) (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 4CE478DC for ; Thu, 5 Feb 2015 22:32:42 +0000 (UTC) Received: by mail-ig0-f171.google.com with SMTP id h15so2219307igd.4 for ; Thu, 05 Feb 2015 14:32:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=2UQMeoXxvvGzeUBlPQKyrDPqaucoSznttY/sbCBxIp8=; b=fc8fDV3O6X5mrzz8Ig/6XHHLyyFF2J4hy1rkh45MW6zONmBo+FyTcb8oa414i2Bvzc H614KI8WyoPyGLJNg30jtDeTT1hN/EQmNBvn8E3/rK4V+vdw5PzF373B/fblrto/Tu64 FA8KaUTctrKd2wwbjjQkLIiC94qZWdqSZu329qsvgj0GHO+VveahdKTzEvfFmy2wnLZa JbMNpCdr3wYawWYl/C3u0NInQGP7xB2oS8zRAg0tvGNKis+tFh0pKibuIvXOHISu12k7 RD6BCvRqn6aqS7EzmnYdU9JBXiyZ6MmnSs1PWyVcTvd+K5cL2Ae3VT2p6WIrUleT5xSP ZNdQ== X-Gm-Message-State: ALoCoQmXOxfG+arMKp7MvzaOu7Vd2S024OKowk/IDRd/lxNOE6OhT8Z52xYQ+bEp/iG2uO0kERhe X-Received: by 10.50.142.99 with SMTP id rv3mr966076igb.11.1423175562101; Thu, 05 Feb 2015 14:32:42 -0800 (PST) Received: from netflix-mac-wired.bsdimp.com ([50.253.99.174]) by mx.google.com with ESMTPSA id g11sm272703iod.28.2015.02.05.14.32.41 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Feb 2015 14:32:41 -0800 (PST) Sender: Warner Losh Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: Better way to do conditional inclusion in make From: Warner Losh In-Reply-To: Date: Thu, 5 Feb 2015 15:32:40 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <2F98809C-14AA-4658-BCF4-15A6179515C9@bsdimp.com> References: <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com> To: Dimitry Andric X-Mailer: Apple Mail (2.2070.6) 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 22:32:43 -0000 > On Feb 5, 2015, at 2:32 PM, Dimitry Andric wrote: >=20 > On 05 Feb 2015, at 18:56, Warner Losh 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=