{"thread":{"id":"40295","subject":"Conditionally define vars to improve portability","startedAt":"2015-09-07T17:51:42Z","lastAt":"2015-09-08T20:09:15Z","messageCount":5,"participants":["Renato Botelho","Jeff King","Junio C Hamano","Jacob Keller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"269576","messageId":"81961DE1-FA30-4E55-8818-9FCA3BC59B81@FreeBSD.org","threadId":"40295","inReplyTo":null,"subject":"Conditionally define vars to improve portability","fromName":"Renato Botelho","fromEmail":"garga@freebsd.org","sentAt":"2015-09-07T17:51:42Z","receivedAt":"2015-09-07T17:51:42Z","isPatch":false,"sender":{"key":"garga@freebsd.org","avatar":"https://gravatar.com/avatar/695c68fb2f0629998c430204a7212aec683a3f87ec5eeaae236fd2376e790bfc?d=mp&s=160"},"body":"Default variables used to build are set using = on Makefile, (e.g. CC, INSTALL, CFLAGS, …). GNU make overwrite these values if it’s passed as an argument (make CC=clang) and it works as expected.\n\nDefault method of passing arguments for make operations on FreeBSD ports tree is using environment variables instead of make arguments, then we have CC set on env before call gmake. Today these values are ignored by git Makefile, and we ended up patching Makefile replacing = by ?= on variable assignments [1].\n\nBefore I write a patch and submit I would like to check if it would be an acceptable change of if it’s something you won’t accept for any reason.\n\nRegards\n\n[1] https://svnweb.freebsd.org/ports/head/devel/git/files/patch-Makefile?revision=396048&view=markup#l7\n--\nRenato Botelho\n"},{"id":"269596","messageId":"20150908063034.GF26331@sigill.intra.peff.net","threadId":"40295","inReplyTo":"81961DE1-FA30-4E55-8818-9FCA3BC59B81@FreeBSD.org","subject":"Re: Conditionally define vars to improve portability","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-09-08T06:30:34Z","receivedAt":"2015-09-08T06:30:34Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Sep 07, 2015 at 02:51:42PM -0300, Renato Botelho wrote:\n\n> Default variables used to build are set using = on Makefile, (e.g. CC,\n> INSTALL, CFLAGS, …). GNU make overwrite these values if it’s passed as\n> an argument (make CC=clang) and it works as expected.\n> \n> Default method of passing arguments for make operations on FreeBSD\n> ports tree is using environment variables instead of make arguments,\n> then we have CC set on env before call gmake. Today these values are\n> ignored by git Makefile, and we ended up patching Makefile replacing =\n> by ?= on variable assignments [1].\n\nHmm. I can't really think of a downside to doing so, unless we expect\nusers to have things like CC set in the environment and _not_ want them\nto bleed through to our build.\n\nBut doesn't \"gmake -e\" solve your problem without a patch?\n\n-Peff\n"},{"id":"269601","messageId":"36F51AF9-44A7-492B-9EFA-79962B79ADC4@FreeBSD.org","threadId":"40295","inReplyTo":"20150908063034.GF26331@sigill.intra.peff.net","subject":"Re: Conditionally define vars to improve portability","fromName":"Renato Botelho","fromEmail":"garga@freebsd.org","sentAt":"2015-09-08T08:19:19Z","receivedAt":"2015-09-08T08:19:19Z","isPatch":false,"sender":{"key":"garga@freebsd.org","avatar":"https://gravatar.com/avatar/695c68fb2f0629998c430204a7212aec683a3f87ec5eeaae236fd2376e790bfc?d=mp&s=160"},"body":"> On Sep 8, 2015, at 03:30, Jeff King <peff@peff.net> wrote:\n> \n> On Mon, Sep 07, 2015 at 02:51:42PM -0300, Renato Botelho wrote:\n> \n>> Default variables used to build are set using = on Makefile, (e.g. CC,\n>> INSTALL, CFLAGS, …). GNU make overwrite these values if it’s passed as\n>> an argument (make CC=clang) and it works as expected.\n>> \n>> Default method of passing arguments for make operations on FreeBSD\n>> ports tree is using environment variables instead of make arguments,\n>> then we have CC set on env before call gmake. Today these values are\n>> ignored by git Makefile, and we ended up patching Makefile replacing =\n>> by ?= on variable assignments [1].\n> \n> Hmm. I can't really think of a downside to doing so, unless we expect\n> users to have things like CC set in the environment and _not_ want them\n> to bleed through to our build.\n> \n> But doesn't \"gmake -e\" solve your problem without a patch?\n\nGood idea, let me try it… :)\n\n--\nRenato Botelho\n"},{"id":"269622","messageId":"xmqqvbbk7n8r.fsf@gitster.mtv.corp.google.com","threadId":"40295","inReplyTo":"20150908063034.GF26331@sigill.intra.peff.net","subject":"Re: Conditionally define vars to improve portability","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-09-08T18:57:24Z","receivedAt":"2015-09-08T18:57:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Sep 07, 2015 at 02:51:42PM -0300, Renato Botelho wrote:\n>\n>> Default variables used to build are set using = on Makefile, (e.g. CC,\n>> INSTALL, CFLAGS, …). GNU make overwrite these values if it’s passed as\n>> an argument (make CC=clang) and it works as expected.\n>> \n>> Default method of passing arguments for make operations on FreeBSD\n>> ports tree is using environment variables instead of make arguments,\n>> then we have CC set on env before call gmake. Today these values are\n>> ignored by git Makefile, and we ended up patching Makefile replacing =\n>> by ?= on variable assignments [1].\n>\n> Hmm. I can't really think of a downside to doing so, unless we expect\n> users to have things like CC set in the environment and _not_ want them\n> to bleed through to our build.\n\nI do think that is the reason behind the choice.  I am not saying I\nnecessarily personally agree with it, though.\n\nCommon things like CC are not so problematic, but more problematic\nare various Git build customization in our Makefile that can be left\nbehind from a previous build.  It is easier for users to forget, as\na \"GIT_FOO=NoThanks; export GIT_FOO\" that was run previously in the\nsame shell does not leave trace once the shell exits, compared to\nother avenues of customization including config.mak and explicit\ncommand line settings given to the 'make' utility (i.e. can be seen\nin 'history' as a single entry, without having to trace the sequence\nof 'GIT_FOO=NoThanks', 'export GIT_FOO' and possible 'unset GIT_FOO'\nto find what was in effect when 'make' was run).  So from that point\nof view, if you encourage users to be less explicit by keeping them\nin the environment, you are making it easier for the users to hurt\nthemselves.\n\nIn an environment to build with a \"make world\" style propagation of\nsettings from top-level to down below, \"environment bleeding\" is a\nnon-issue.  It is merely a convention in that build environment how\nthe settings are passed to submakes in a whole system and everybody\nin that environment understands the ramifications.  I agree that\nyour suggestion of using \"gmake -e\" may be a good workaround for\nhandling cases like that.\n"},{"id":"269627","messageId":"CA+P7+xopnAfmKNfL=p5wrqfLx5CENcBoFkdZ1swLe+3PchcONQ@mail.gmail.com","threadId":"40295","inReplyTo":"xmqqvbbk7n8r.fsf@gitster.mtv.corp.google.com","subject":"Re: Conditionally define vars to improve portability","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2015-09-08T20:09:15Z","receivedAt":"2015-09-08T20:09:15Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Tue, Sep 8, 2015 at 11:57 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Common things like CC are not so problematic, but more problematic\n> are various Git build customization in our Makefile that can be left\n> behind from a previous build.  It is easier for users to forget, as\n> a \"GIT_FOO=NoThanks; export GIT_FOO\" that was run previously in the\n> same shell does not leave trace once the shell exits, compared to\n> other avenues of customization including config.mak and explicit\n> command line settings given to the 'make' utility (i.e. can be seen\n> in 'history' as a single entry, without having to trace the sequence\n> of 'GIT_FOO=NoThanks', 'export GIT_FOO' and possible 'unset GIT_FOO'\n> to find what was in effect when 'make' was run).  So from that point\n> of view, if you encourage users to be less explicit by keeping them\n> in the environment, you are making it easier for the users to hurt\n> themselves.\n\nIt should be noted that a common idiom is also \"VARIABLE=VALUE Make\"\nwhere we set the variable in the environment before running the\ncommand. This would begin working if you allow the =? setting of\nvariables.\n\nThat being said, since \"make VARIABLE=VALUE\" already works, and is\nreally just as easy to type as above, I think I prefer your argument\noverall. We shouldn't encourage people to use the environment, and\ninstead use config.mak or other methods which are far more explicit.\n"}]}