From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 7 15:44:25 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DD6A826B for ; Thu, 7 Nov 2013 15:44:25 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wg0-x235.google.com (mail-wg0-x235.google.com [IPv6:2a00:1450:400c:c00::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7BEEB2907 for ; Thu, 7 Nov 2013 15:44:25 +0000 (UTC) Received: by mail-wg0-f53.google.com with SMTP id y10so710138wgg.8 for ; Thu, 07 Nov 2013 07:44:23 -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; bh=cfZxzRfIuWxD4O5Q3SXm3FjccdqQaqVTr21MQD5yP2s=; b=NnIi51uZR9DV4hmPmJaACY6zRxXmm/yodvV3y3fjBvCxjumjZQW+ZMs9bQU9Kc0mt9 Rzgxl4zvB3Qe+fAUkey1f0FfWu65hcbyc3kUSyJEVKlUuuNwrlSQq7JmIJ0Dsz7p0Xnw coBA7rq0A+mAlB4wDoHRuW0IzQbCaN8S2byukCy29nVHW2UGLA1jWk7IWPkLiw0GELOJ +ekV8Pj1xkrbOWK4gRLCI1tD5/WjM5ge3FitRP9Rbm9ZtYdRwVTBVDAa5NJqSLnE48/r sCF6rzjXK/a82Ocm+ORtN76esvibb5sEKUVCMGNtQrFh1oytxQYZC5rAkbZOofLAqtVD bQvg== MIME-Version: 1.0 X-Received: by 10.194.185.73 with SMTP id fa9mr8019970wjc.29.1383839063598; Thu, 07 Nov 2013 07:44:23 -0800 (PST) Sender: asomers@gmail.com Received: by 10.194.171.35 with HTTP; Thu, 7 Nov 2013 07:44:23 -0800 (PST) In-Reply-To: <20131106084849.GA45949@fbair.virtual.network> References: <20131106084849.GA45949@fbair.virtual.network> Date: Thu, 7 Nov 2013 08:44:23 -0700 X-Google-Sender-Auth: lY6KkKbUrLoRMv3bY6mViQ5y-Tc Message-ID: Subject: Re: Is WITH_="yes"in make's command line expected to work? From: Alan Somers To: Julio Merino Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-hackers@freebsd.org" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2013 15:44:25 -0000 On Wed, Nov 6, 2013 at 1:48 AM, Julio Merino wrote: > Hello all, > > I'm currently working on fixing the build when the TESTS knob is enabled > and I have encountered some odd behavior that I'm not sure is expected. > > Basically, it seems that passing a WITH_*=yes option (note, no -D) > through make's command line conflicts with a similar NO_* option. > > Consider this sample Makefile which is derived from the contents of > bsd.own.mk: > > ----- > .if defined(SIMULATE_WITH_FOO_IN_SRC_CONF) > WITH_FOO=yes > .endif > > # Same code as in bsd.own.mk. > .for var in FOO > .if defined(NO_${var}) > .if defined(WITH_${var}) > .undef WITH_${var} > .endif > WITHOUT_${var}= > .endif > .endfor > # End code from bsd.own.mk. > > all: > .if defined(WITH_FOO) > @echo WITH_FOO > .endif > .if defined(WITHOUT_FOO) > @echo WITHOUT_FOO > .endif > ----- > > Now look at the following invocations: > > $ make -DSIMULATE_WITH_FOO_IN_SRC_CONF > WITH_FOO # OK. > > $ make -DSIMULATE_WITH_FOO_IN_SRC_CONF -DNO_FOO > WITHOUT_FOO # OK. > > $ make -DWITH_FOO -DNO_FOO > WITHOUT_FOO # OK. > > $ make WITH_FOO=yes -DNO_FOO > WITH_FOO # OOPS! > WITHOUT_FOO > > Is this expected behavior? It seems to me that the .undef is not working > properly in the way it's used by bsd.own.mk. > > The src.conf(5) manpage says that the WITH_* and WITHOUT_* variables can > be provided to make via the command line with -D. There is no mention of > providing explicit overrides with WITH_*=yes as I did above. Is it OK > to rely on this assumption and consider invocations with WITH_FOO=yes in > the command line to be broken? > > Thank you! Whether or not it's the correct thing to do, I usually set WITH_* as an environment variable. eg "WITH_TESTS=1 make install". It seems to work. I also frequently use a src.conf that is not in the usual location by setting SRCCONF. eg " SRCCONF=/path/to/src.conf make install" -Alan