Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH] Teach Makefile to respect external variables: CFLAGS and others.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:16

Eygene Ryabinkin [off-list ref] writes:
Junio, Sam, good day.

Tue, Jun 12, 2007 at 11:07:56PM -0700, Junio C Hamano wrote:
quoted
I run "make CFLAGS=-O0 -g" all the time.  Also "make CC=echo"
seems to "work" as expected ;-).

Care to elaborate what problem you are trying to solve?
As Sam Ravnborg kindly pointed out, you're using make variables
and I am trying to give the respect to the environment variables.

And the real problem is that one (for example, me) can try to
build Git with the different compiler than CC (gccX or icc, for
example).  And it is much better for lazy people to do 'export
CC=whatever' once and then fire make any number of times ;))

Answering Sam: yes, with my patch it is easier to inherit the
variables from the environment.  But it is not clear if it is
good or bad ;))

But anyway, this patch is only my suggestion, and it can be
thrown away :)
Oh, I will, very gladly ;-), as it is obviously inferior than
how we currently do our build.

I would personally hate environment affecting build (or anything
for that matter), as it makes it unnecessarily difficult to
diagnose when something goes wrong.  I consider that it is a
beautiful thing that make can take explicit override from the
command line.

Lazy people like me can always have a make wrapper.  E.g. I have
a checkout of my 'todo' branch at Meta in git.git repository, so
I would say

	$ Meta/Make -pedantic

to ask for specific set of CFLAGS.  If something goes wrong and
I need to ask for help from other people, it is crystal clear to
them that I am using something "customized" from the above
command line.

If you modify Makefile to allow the build procedure to be easily
contaminated with stray environment, and when your build breaks,
you would answer that your command line is:

	$ make

when asked how you tried to build things -- and leave people who
try to help you scratching their head, wasting their time.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help