From owner-freebsd-arch@FreeBSD.ORG Thu Feb 5 18:09:48 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 E1ADFF51 for ; Thu, 5 Feb 2015 18:09:48 +0000 (UTC) Received: from mail-lb0-x22e.google.com (mail-lb0-x22e.google.com [IPv6:2a00:1450:4010:c04::22e]) (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 845761FD for ; Thu, 5 Feb 2015 18:09:48 +0000 (UTC) Received: by mail-lb0-f174.google.com with SMTP id f15so10053008lbj.5 for ; Thu, 05 Feb 2015 10:09:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=fEc+ll7Qe7xmyeeeiGnngiPWAgNF2VDbGC8RIUwmt9o=; b=lAFBHGK/t9mF0PHrGMZAUa+ZwpH/kSRplBvBZqr8M1SoJRRQTQHHCDjVG1b37vyi/9 LMSErKLfGVuZoJ+bErRah/T1p5M98tsZMV60yQg/bWhDhFaB/nBCJutWAXjWGkw+H/bl LnpYbHDzEaKHLQxI0DRKuZVLIuApzCjc12xTjZeNTezoxnMAny7H0tRGxodhMFh8RKvO 6YzocJQjg/0amGr4QlQHyLud7cnMirOhzO8pwgqOZMUEauHXzv6fZ1EUa2Osn6zpzXu/ QGk2wUDrTRM8pH1fD33fG8/Vmny5UdnaHdPuS8pl+cVQwxaWqYafRhCrizStHdD1ctEm myzg== MIME-Version: 1.0 X-Received: by 10.112.32.34 with SMTP id f2mr5372968lbi.50.1423159786115; Thu, 05 Feb 2015 10:09:46 -0800 (PST) Sender: chmeeedalf@gmail.com Received: by 10.25.160.202 with HTTP; Thu, 5 Feb 2015 10:09:46 -0800 (PST) In-Reply-To: <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com> References: <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com> Date: Thu, 5 Feb 2015 10:09:46 -0800 X-Google-Sender-Auth: FJfN2pbYR57M__aEAWaowRP6GmA Message-ID: Subject: Re: Better way to do conditional inclusion in make From: Justin Hibbits To: Warner Losh Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 18:09:49 -0000 On Thu, Feb 5, 2015 at 9:56 AM, Warner Losh 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