Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Mar 2012 10:19:40 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Doug Barton <dougb@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, Dimitry Andric <dim@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, svn-src-head@freebsd.org, Chris Rees <utisoft@gmail.com>
Subject:   Re: svn commit: r233052 - head/share/mk
Message-ID:  <201203201019.40486.jhb@freebsd.org>
In-Reply-To: <4F67A7A9.50003@FreeBSD.org>
References:  <201203162319.q2GNJjx5039482@svn.freebsd.org> <4F678B03.8050307@FreeBSD.org> <4F67A7A9.50003@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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)
> >   .if defined(BAR)
> >     CFLAGS+=	-DFOO_BAR
> >   .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?  The bits in I see in bsd.port.mk suffer
from the limitation Dimitry raises, e.g.:

.if defined(OPTIONS)
# include OPTIONSFILE first if exists
.       if exists(${OPTIONSFILE}) && !make(rmconfig)
.       include "${OPTIONSFILE}"
.       endif
.       if exists(${OPTIONSFILE}.local)
.       include "${OPTIONSFILE}.local"
.       endif
WITHOUT:=
WITH:=
.       if defined(OPTIONS)
REALOPTIONS=${OPTIONS:C/".*"//g}
.       for O in ${REALOPTIONS}
RO:=${O}
.       if ${RO:L} == off
WITHOUT:=       ${WITHOUT} ${OPT}
.       endif
.       if ${RO:L} == on
WITH:=          ${WITH} ${OPT}
.       endif
OPT:=${RO}
.       endfor
.       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) {} }'.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203201019.40486.jhb>