From owner-freebsd-bugs@FreeBSD.ORG Thu Nov 7 20:20:04 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.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 036B955A for ; Thu, 7 Nov 2013 20:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D1B232B20 for ; Thu, 7 Nov 2013 20:20:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rA7KK3HI010258 for ; Thu, 7 Nov 2013 20:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rA7KK3IY010257; Thu, 7 Nov 2013 20:20:03 GMT (envelope-from gnats) Resent-Date: Thu, 7 Nov 2013 20:20:03 GMT Resent-Message-Id: <201311072020.rA7KK3IY010257@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Julio Merino 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 1FA5BFE for ; Thu, 7 Nov 2013 20:10:33 +0000 (UTC) (envelope-from julio@meroh.net) Received: from cdptpa-oedge-vip.email.rr.com (cdptpa-outbound-snat.email.rr.com [107.14.166.225]) by mx1.freebsd.org (Postfix) with ESMTP id D8B372A68 for ; Thu, 7 Nov 2013 20:10:32 +0000 (UTC) Received: from [108.176.158.82] ([108.176.158.82:65474] helo=portal.meroh.net) by cdptpa-oedge03 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id 3C/B3-19454-0B3FB725; Thu, 07 Nov 2013 20:10:24 +0000 Received: from mastodon.meroh.net (mastodon.meroh.net [192.168.1.12]) by portal.meroh.net (Postfix) with ESMTP id AE18CEFE67 for ; Thu, 7 Nov 2013 15:10:22 -0500 (EST) Received: from mastodon.meroh.net (localhost [127.0.0.1]) by mastodon.meroh.net (8.14.7/8.14.7) with ESMTP id rA7K8DHc007335 for ; Thu, 7 Nov 2013 15:08:13 -0500 (EST) (envelope-from jmmv@mastodon.meroh.net) Received: (from jmmv@localhost) by mastodon.meroh.net (8.14.7/8.14.7/Submit) id rA7K8DQj007334; Thu, 7 Nov 2013 15:08:13 -0500 (EST) (envelope-from jmmv) Message-Id: <201311072008.rA7K8DQj007334@mastodon.meroh.net> Date: Thu, 7 Nov 2013 15:08:13 -0500 (EST) From: Julio Merino To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.114 Subject: bin/183762: make(1) .undef does not work with variables set to a value X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Julio Merino List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Nov 2013 20:20:04 -0000 >Number: 183762 >Category: bin >Synopsis: make(1) .undef does not work with variables set to a value >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Nov 07 20:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Julio Merino >Release: FreeBSD 11.0-CURRENT powerpc >Organization: >Environment: System: FreeBSD mastodon.meroh.net 11.0-CURRENT FreeBSD 11.0-CURRENT #2 r257556M: Sat Nov 2 17:24:33 EDT 2013 jmmv@mastodon.meroh.net:/usr/obj/usr/src/sys/GENERIC64 powerpc >Description: The .undef directive of make(1) does not seem to work on a variable that has been defined to a value (even if empty) either via the environment or a command-line argument to make. However .undef works on variables that have been defined using make's -D flag and variables defined in the same Makefile. I have found this while debugging build issues in bsd.own.mk. Makefile.inc1 has to pass -DNO_* to make in order to explicitly disable some features during the build bootstrap. However, if the user explicitly sets WITH_* from the command line (without using -D), the build fails because it finds both WITH_* and WITHOUT_* defined. I believe .undef is buggy and hence the reason for this PR. And if it is not a bug, make(1) probably deserves some note about this as well as the build documentation (maybe in src.conf(5)) to warn about this. >How-To-Repeat: Sample Makefile: ----- .if defined(DEFINE_VAR_IN_MAKEFILE) VAR=foo .endif .undef VAR all: .if defined(VAR) @echo defined .else @echo undefined .endif ----- And sample invocations: ----- $ make undefined $ make -DVAR undefined $ make -DDEFINE_VAR_IN_MAKEFILE undefined $ make VAR= defined $ VAR= make defined ----- The last two cases shown above are unexpected behavior to me. I would expect the ".undef VAR" to take effect at all times. >Fix: >Release-Note: >Audit-Trail: >Unformatted: