Date: Sat, 27 Sep 2003 17:24:58 -0400 (EDT) From: "James E. Flemer" <jflemer@alum.rpi.edu> To: FreeBSD-gnats-submit@FreeBSD.org Subject: standards/57295: [patch] make does not include cmd line variables in MAKEFLAGS Message-ID: <200309272124.h8RLOw5P032710@psi.speednaked.com> Resent-Message-ID: <200309272130.h8RLUDNH020118@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <<EOF > 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309272124.h8RLOw5P032710>