From owner-svn-src-all@FreeBSD.ORG Tue Mar 20 21:41:11 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 64C93106566B; Tue, 20 Mar 2012 21:41:11 +0000 (UTC) (envelope-from utisoft@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 52C088FC12; Tue, 20 Mar 2012 21:41:10 +0000 (UTC) Received: by bkcjc3 with SMTP id jc3so572157bkc.13 for ; Tue, 20 Mar 2012 14:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=wZaoQiszOTZU3PsqYjYTvxeyT7zfHVtm2Ve1WjqjqtM=; b=DcDKEnlFr/sMAfTTRgeCEUyT6NwpTP8sc6g8vpvz1ERFI+VQyvZimVtbhWtnUT/ram M2qpeH68NgGQieaeqpR5keQXY3cb+BNj/dv2qlKrPGEFILhWUy3SWmJEJNLW8tu7SPvr hea29hmzKd8ExcX2W7tBwVt740PABsg0i/sJ+x5JcQGVfJnwWQXZ/Vf407d8NeZr16Sl H6QpHYEyo3oxAqpTvpNgj39B+if7KqY1OKyR+lrd9BDk48WTpHJGYxDnq7jFsbqP+kaS TC2sIUKAzsREVeAIeIaGph40cR346+rHjwQw4Xg+bmK1k1q/vNBfmme7gQ1x3A1Z7QdW +0iA== Received: by 10.204.128.201 with SMTP id l9mr535037bks.90.1332279669255; Tue, 20 Mar 2012 14:41:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.202.142 with HTTP; Tue, 20 Mar 2012 14:40:39 -0700 (PDT) In-Reply-To: <201203201728.21049.jhb@freebsd.org> References: <201203162319.q2GNJjx5039482@svn.freebsd.org> <201203201019.40486.jhb@freebsd.org> <201203201728.21049.jhb@freebsd.org> From: Chris Rees Date: Tue, 20 Mar 2012 21:40:39 +0000 Message-ID: To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r233052 - head/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 21:41:11 -0000 On 20 March 2012 21:28, John Baldwin wrote: > On Tuesday, March 20, 2012 5:20:04 pm Chris Rees wrote: >> On 20 March 2012 14:19, John Baldwin wrote: >> > On Monday, March 19, 2012 5:39:53 pm Doug Barton wrote: >> >> On 3/19/2012 12:37 PM, Dimitry Andric wrote: >> >> > It would be much nicer to be able to write: >> >> > >> >> > .if defined(FOO) >> >> > =A0 .if defined(BAR) >> >> > =A0 =A0 CFLAGS+=3D =A0 =A0 =A0 =A0-DFOO_BAR >> >> > =A0 .endif >> >> > .endif >> >> >> >> Take a look at /usr/ports/Mk/bsd.port.mk for how this can be done. >> > >> > Hmm, do yoo have a specific example? =A0The bits in I see in bsd.port.= mk > suffer >> > from the limitation Dimitry raises, e.g.: >> > >> > .if defined(OPTIONS) >> > # include OPTIONSFILE first if exists >> > . =A0 =A0 =A0 if exists(${OPTIONSFILE}) && !make(rmconfig) >> > . =A0 =A0 =A0 include "${OPTIONSFILE}" >> > . =A0 =A0 =A0 endif >> > . =A0 =A0 =A0 if exists(${OPTIONSFILE}.local) >> > . =A0 =A0 =A0 include "${OPTIONSFILE}.local" >> > . =A0 =A0 =A0 endif >> > WITHOUT:=3D >> > WITH:=3D >> > . =A0 =A0 =A0 if defined(OPTIONS) >> > REALOPTIONS=3D${OPTIONS:C/".*"//g} >> > . =A0 =A0 =A0 for O in ${REALOPTIONS} >> > RO:=3D${O} >> > . =A0 =A0 =A0 if ${RO:L} =3D=3D off >> > WITHOUT:=3D =A0 =A0 =A0 ${WITHOUT} ${OPT} >> > . =A0 =A0 =A0 endif >> > . =A0 =A0 =A0 if ${RO:L} =3D=3D on >> > WITH:=3D =A0 =A0 =A0 =A0 =A0${WITH} ${OPT} >> > . =A0 =A0 =A0 endif >> > OPT:=3D${RO} >> > . =A0 =A0 =A0 endfor >> > . =A0 =A0 =A0 endif >> > >> > That is, all the lines that don't start with a . are not indented, and >> > even this indentation is rather horrible (it doesn't nest, and it >> > has the odd structure of 'if defined(OPTIONS) { if defined(OPTIONS) {}= }'. >> >> I don't see how it's any more horrible than the kernel style's rules >> on indented #ifs (though I can see the reasoning for that) >> >> It's an unfortunate consequence of the fact that any line starting >> with whitespace must be a shell command-- from before Makefiles were >> allowed conditionals etc. >> >> It's got to be an improvement on: >> >> .if defined(ONE) >> .if !defined(TWO) >> .for one in two three four >> .if ${VAR} =3D=3D ${one} >> .if defined(VERBOSE) >> .warning VAR =3D one >> .endif >> .endif >> .endfor >> .elif ${VAR} =3D=3D four >> .if defined(VERBOSE) >> .warning VAR =3D four >> .endif >> .else >> .warning VAR is not four, and VERBOSE is ignored >> .endif =A0 =A0# XXXX Which one is this for?? >> .endif >> >> which is what a lot of the Makefiles look like... debugging if-less >> endifs etc is infinitely easier if we indent, however horrible it >> looks. >> >> We shouldn't be *trying* to make Makefiles hard to read ;) > > Oh, it may be that I was reading it in less or some such and that bsd.por= t.mk > requires 4 space tabs, so when viewed in things like less the indentation > doesn't actually look like indentation. =A0In that respect, this is no be= tter > than the above (and is what bsd.ports.mk looks like to me at least): > > . =A0 =A0 =A0if defined(ONE) > . =A0 =A0 =A0if !defined(TWO) > . =A0 =A0 =A0for one in two three four > > etc. =A0To be worthwhile the spacing has to actually look like indentatio= n: > > .if defined(ONE) > . =A0if !defined(TWO) > . =A0 =A0for one in two three four > > etc. Yes-- it'd be nice if less could read the ex:ts=3D4 bit. That can go on my todo list. Chris