From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 7 15:35:59 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0666EC91 for ; Thu, 7 Nov 2013 15:35:59 +0000 (UTC) (envelope-from julio@meroh.net) Received: from mail-qa0-f44.google.com (mail-qa0-f44.google.com [209.85.216.44]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BBA9C287C for ; Thu, 7 Nov 2013 15:35:58 +0000 (UTC) Received: by mail-qa0-f44.google.com with SMTP id f11so558828qae.17 for ; Thu, 07 Nov 2013 07:35:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=pJo0GvKgjB+oaaA75fyyTJqhXo2y0+RGauGYs2SIaOM=; b=m7NGlMw104Ad3lNdRr7SZtm8M3FOxuPJuKccasZbRs+YxX3HivxH8iOTDov3467DHQ WwBH1VkGENRqEj5EyA61JQ+e43MVkFJTvAVPeM0X4N/0UuEWsUsV6NB6qZHtLxckV44I GSGenjXTChgC8SM5rACR8m27k/6GCc8R428ZLd7/l2onecUJTOz3ZC/BF5gqjddkt+ja 2x48fzdAUlxHW5pPXFC/gWWRppFb9IWqX/YgGKLnLIDpip1f6HeYbo5McP0ablaoF8mF l6HwLeI4sljJI4Biso4RFjLZIuCEoP1VAjPjMFcJgVTgDjIMbHAoyxC34zf8JC1wBX6t EdyQ== X-Gm-Message-State: ALoCoQlQB/zrpJsCN1e4kcGJb7e75AV4TWVXj1mNdnrxV7wnv2PdmhqN0ufeqdGr4iQs7WFn1zgd X-Received: by 10.224.171.196 with SMTP id i4mr15285180qaz.38.1383838221792; Thu, 07 Nov 2013 07:30:21 -0800 (PST) Received: from fbair.virtual.network (dhcp-172-26-102-247.nyc.corp.google.com [172.26.102.247]) by mx.google.com with ESMTPSA id r5sm8595125qeh.1.2013.11.07.07.30.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Nov 2013 07:30:20 -0800 (PST) Date: Wed, 6 Nov 2013 03:48:49 -0500 From: Julio Merino To: freebsd-hackers@freebsd.org Subject: Is WITH_*=yes in make's command line expected to work? Message-ID: <20131106084849.GA45949@fbair.virtual.network> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.22 (2013-10-16) 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:35:59 -0000 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!