From owner-freebsd-arch@FreeBSD.ORG Fri Feb 6 03:18:31 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 88323F31 for ; Fri, 6 Feb 2015 03:18:31 +0000 (UTC) Received: from mail-ig0-f182.google.com (mail-ig0-f182.google.com [209.85.213.182]) (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 506CF949 for ; Fri, 6 Feb 2015 03:18:30 +0000 (UTC) Received: by mail-ig0-f182.google.com with SMTP id h15so4789714igd.3 for ; Thu, 05 Feb 2015 19:18:30 -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=/vVY4Q9hWKjFem1Cn6IK3DnEb2yLapOtGTAL/katKwE=; b=ZHZLEXHrxcAh1wsGsnl4fqwnnTyoCaKu+sQbrbQgUy9XH3lIHQgcsD5ztTUpMi/r2S bciJ10bxiKisR2vV8uF0mCSawUNXFli61xCtiN9kfFcg+3UX1B7jpd+TtCOFT7LQ8yrE sH1uJdvxD6Sq8anBeG4tHojqFhmp0tnHthEFbqsgEGmypBJD6obulAA1J5diJw1l/DvJ GIYL2z2kM8spYMDMauvT6EKhI9ugxRLhqMVPM7IpZU/I7IZn2cXuY6X14NQBsv9eMZw/ 7waxNuO2aRpVLXTCrGcY2qATJ+4Uy8GzjCKNeCUa35Ds9pQLEyHKuRjPUsL0hVNMxPMX m3BA== X-Gm-Message-State: ALoCoQkeQrKpENaa31RgpSjjNm5f+eFXovR94NmF10hsRUhxFoyOJfvjIS1dmUxTgKnq+88TlCZ1 X-Received: by 10.42.77.9 with SMTP id g9mr10855970ick.78.1423192709850; Thu, 05 Feb 2015 19:18:29 -0800 (PST) Received: from netflix-mac-wired.bsdimp.com ([50.253.99.174]) by mx.google.com with ESMTPSA id 9sm625960iom.10.2015.02.05.19.18.29 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Feb 2015 19:18:29 -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: <54D40DC4.9070907@freebsd.org> Date: Thu, 5 Feb 2015 20:18:28 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <07D8BEB5-8142-431A-B823-4900D664CEE2@bsdimp.com> References: <39C20BA1-E6B1-4DAE-95BB-8011A0A64D54@bsdimp.com> <54D40DC4.9070907@freebsd.org> To: Julian Elischer 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: Fri, 06 Feb 2015 03:18:31 -0000 > On Feb 5, 2015, at 5:41 PM, Julian Elischer = wrote: >=20 > On 2/6/15 1:56 AM, Warner Losh wrote: >> Greetings, >>=20 >> I=E2=80=99ve started a pass through the tree to cleanup how we do = conditional inclusion in our build system. >>=20 >> https://reviews.freebsd.org/D1781 >>=20 >> It moves away from >>=20 >> .if ${MK_foo} !=3D =E2=80=9Cno=E2=80=9D >> FILES+=3D files >> .endif >>=20 >> and >>=20 >> SUBDIRS=3D =E2=80=A6 ${_foo} =E2=80=A6 >> ... >> .if ${MK_foo} !=3D =E2=80=9Cno=E2=80=9D >> _foo+=3D foo >> .endif >>=20 >> and instead more directly assigns things. 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 > how does it cope with the case where a single file is dependent on = either of two options. > (we have this in our tree.. not sure if it occurs in the FreeBSD = tree.) > file could occur in both lists or twice in one list.. We have this in our tree a fair amount. power, for example, is enabled = with either MK_ACPI or MK_APM. When it is either/or, just list it for both. FILES.${MK_APCI}+=3D acpiconf powerd FILES.${MK_APM}+=3D powerd The FILES:=3D${FILES:O:u} at the end sorts everything and removes the = duplicates. Warner=