git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Conditionally define vars to improve portability

From
Jacob Keller <jacob.keller@gmail.com>
Date
Sep 8, 2015, 20:09 UTC
Message-ID
<CA+P7+xopnAfmKNfL=p5wrqfLx5CENcBoFkdZ1swLe+3PchcONQ@mail.gmail.com>
In-Reply-To
<xmqqvbbk7n8r.fsf@gitster.mtv.corp.google.com>
On Tue, Sep 8, 2015 at 11:57 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Common things like CC are not so problematic, but more problematic
> are various Git build customization in our Makefile that can be left
> behind from a previous build.  It is easier for users to forget, as
> a "GIT_FOO=NoThanks; export GIT_FOO" that was run previously in the
> same shell does not leave trace once the shell exits, compared to
> other avenues of customization including config.mak and explicit
> command line settings given to the 'make' utility (i.e. can be seen
> in 'history' as a single entry, without having to trace the sequence
> of 'GIT_FOO=NoThanks', 'export GIT_FOO' and possible 'unset GIT_FOO'
> to find what was in effect when 'make' was run).  So from that point
> of view, if you encourage users to be less explicit by keeping them
> in the environment, you are making it easier for the users to hurt
> themselves.

It should be noted that a common idiom is also "VARIABLE=VALUE Make" where we set the variable in the environment before running the command. This would begin working if you allow the =? setting of variables.

That being said, since "make VARIABLE=VALUE" already works, and is really just as easy to type as above, I think I prefer your argument overall. We shouldn't encourage people to use the environment, and instead use config.mak or other methods which are far more explicit.

Previous: Junio C Hamano
Message 5 of 5 in “Conditionally define vars to improve portability”
  1. Renato BotelhoSep 7, 2015
  2. Jeff KingSep 8, 2015
  3. Renato BotelhoSep 8, 2015
  4. Junio C HamanoSep 8, 2015
  5. Jacob KellerSep 8, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.