From owner-freebsd-standards@FreeBSD.ORG Sat Sep 27 14:30:17 2003 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACFDC16A4B3 for ; Sat, 27 Sep 2003 14:30:17 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 92A4544049 for ; Sat, 27 Sep 2003 14:30:13 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h8RLUDFY020119 for ; Sat, 27 Sep 2003 14:30:13 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h8RLUDNH020118; Sat, 27 Sep 2003 14:30:13 -0700 (PDT) (envelope-from gnats) Resent-Date: Sat, 27 Sep 2003 14:30:13 -0700 (PDT) Resent-Message-Id: <200309272130.h8RLUDNH020118@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "James E. Flemer" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7625E16A4B3 for ; Sat, 27 Sep 2003 14:25:01 -0700 (PDT) Received: from psi.speednaked.com (h0002e323fc2b.ne.client2.attbi.com [66.31.42.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id DAA3C44008 for ; Sat, 27 Sep 2003 14:24:59 -0700 (PDT) (envelope-from jflemer@psi.speednaked.com) Received: from psi.speednaked.com (localhost [127.0.0.1]) by psi.speednaked.com (8.12.9/8.12.9) with ESMTP id h8RLOwXg032711 for ; Sat, 27 Sep 2003 17:24:59 -0400 (EDT) (envelope-from jflemer@psi.speednaked.com) Received: (from jflemer@localhost) by psi.speednaked.com (8.12.9/8.12.9/Submit) id h8RLOw5P032710; Sat, 27 Sep 2003 17:24:58 -0400 (EDT) (envelope-from jflemer) Message-Id: <200309272124.h8RLOw5P032710@psi.speednaked.com> Date: Sat, 27 Sep 2003 17:24:58 -0400 (EDT) From: "James E. Flemer" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: standards/57295: [patch] make does not include cmd line variables in MAKEFLAGS X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "James E. Flemer" List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Sep 2003 21:30:17 -0000 >Number: 57295 >Category: standards >Synopsis: [patch] make does not include cmd line variables in MAKEFLAGS >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Sep 27 14:30:10 PDT 2003 >Closed-Date: >Last-Modified: >Originator: James E. Flemer >Release: FreeBSD 5.1-CURRENT i386 >Organization: n/a >Environment: System: FreeBSD psi.speednaked.com 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Sun Sep 14 14:04:37 EDT 2003 jflemer@psi.speednaked.com:/usr/obj/usr/src/sys/PSI i386 >Description: The make utility allows variables to be defined on the command line with '-D variable' or 'variable=value'. The MAKEFLAGS variable currently only includes the '-D' style definitions. According to the POSIX standard, both should be included. This issue was mentioned on freebsd-hackers about 1.5 years ago[1]. NetBSD fixed their make about 2.25 years ago[2], after a few tries. [1] Message-ID: <20020413141834.GA16339@snark.ratmir.ru> [2] $NetBSD: src/usr.bin/make/var.c,v 1.62 2001/06/09 05:22:47 sjg Exp $ (and some other files / versions) >How-To-Repeat: $ cat < Makefile > default: > @echo MAKEFLAGS: "$(.MAKEFLAGS)" > EOF $ make -DFOO BAR=missing MAKEFLAGS: -D FOO ... after patch ... $ make -DFOO BAR=missing MAKEFLAGS: -D FOO BAR=missing >Fix: The patch below seems to Do The Right Thing, at least for simple cases. I am not exactly sure what should be done if the .MAKEFLAGS variable is explicitly set by the makefile. This fix is different than the NetBSD fix, since FreeBSD does not have the .MAKEOVERRIDES variable. I am also not sure what the behavior should be when the command line is something like: "make 'FOO=$(BAR)'". This case may be what the examples in the NetBSD commit messages are referring to when they mention FOO=goo. I am about a third of the way through a buildworld with this patch applied to my make without any problems. I would really like to see a fix for this issue committed, to facilitate the recording of flags used when building ports. --- make.diff begins here --- Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/main.c,v retrieving revision 1.84 diff -u -u -r1.84 main.c --- main.c 14 Sep 2003 12:31:33 -0000 1.84 +++ main.c 27 Sep 2003 21:05:11 -0000 @@ -346,8 +346,10 @@ * on the end of the "create" list. */ for (argv += optind, argc -= optind; *argv; ++argv, --argc) - if (Parse_IsVar(*argv)) + if (Parse_IsVar(*argv)) { + Var_Append(MAKEFLAGS, *argv, VAR_GLOBAL); Parse_DoVar(*argv, VAR_CMD); + } else { if (!**argv) Punt("illegal (null) argument."); --- make.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: