* [PATCH] Teach Makefile to respect external variables: CFLAGS and others.
@ 2007-06-13 5:42 Eygene Ryabinkin
2007-06-13 6:07 ` Junio C Hamano
2007-06-13 6:12 ` Sam Ravnborg
0 siblings, 2 replies; 7+ messages in thread
From: Eygene Ryabinkin @ 2007-06-13 5:42 UTC (permalink / raw)
To: git
If one is not using the configure script, then there is no way to
redefine variables CFLAGS, LFLAGS, CC, AR, TAR, INSTALL, RPMBUILD,
TCL_PATCH and TCLTK_PATH. This shouldn't be so, since these variables
can be manually set by user and we should respect them.
The patch originates from the FreeBSD port and was originally made
by Ed Schouten, ed at fxq dot nl.
Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>
---
Makefile | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 30a4052..6cd9ea2 100644
--- a/Makefile
+++ b/Makefile
@@ -135,8 +135,8 @@ uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
# CFLAGS and LDFLAGS are for the users to override from the command line.
-CFLAGS = -g -O2 -Wall
-LDFLAGS =
+CFLAGS ?= -g -O2 -Wall
+LDFLAGS ?=
ALL_CFLAGS = $(CFLAGS)
ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip
@@ -172,13 +172,13 @@ GITWEB_SITE_FOOTER =
export prefix bindir gitexecdir sharedir template_dir sysconfdir
-CC = gcc
-AR = ar
-TAR = tar
-INSTALL = install
-RPMBUILD = rpmbuild
-TCL_PATH = tclsh
-TCLTK_PATH = wish
+CC ?= gcc
+AR ?= ar
+TAR ?= tar
+INSTALL ?= install
+RPMBUILD ?= rpmbuild
+TCL_PATH ?= tclsh
+TCLTK_PATH ?= wish
export TCL_PATH TCLTK_PATH
--
1.5.2.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Teach Makefile to respect external variables: CFLAGS and others.
2007-06-13 5:42 [PATCH] Teach Makefile to respect external variables: CFLAGS and others Eygene Ryabinkin
@ 2007-06-13 6:07 ` Junio C Hamano
2007-06-13 7:15 ` Eygene Ryabinkin
2007-06-13 6:12 ` Sam Ravnborg
1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-06-13 6:07 UTC (permalink / raw)
To: Eygene Ryabinkin; +Cc: git
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?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Teach Makefile to respect external variables: CFLAGS and others.
2007-06-13 6:07 ` Junio C Hamano
@ 2007-06-13 7:15 ` Eygene Ryabinkin
2007-06-13 7:39 ` Junio C Hamano
2007-06-13 7:42 ` Matthias Lederhofer
0 siblings, 2 replies; 7+ messages in thread
From: Eygene Ryabinkin @ 2007-06-13 7:15 UTC (permalink / raw)
To: Junio C Hamano, sam; +Cc: git
Junio, Sam, good day.
Tue, Jun 12, 2007 at 11:07:56PM -0700, Junio C Hamano wrote:
> 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 :)
--
Eygene
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Teach Makefile to respect external variables: CFLAGS and others.
2007-06-13 7:15 ` Eygene Ryabinkin
@ 2007-06-13 7:39 ` Junio C Hamano
2007-06-13 7:53 ` Eygene Ryabinkin
2007-06-13 7:42 ` Matthias Lederhofer
1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-06-13 7:39 UTC (permalink / raw)
To: Eygene Ryabinkin; +Cc: sam, git
Eygene Ryabinkin <rea-git@codelabs.ru> writes:
> Junio, Sam, good day.
>
> Tue, Jun 12, 2007 at 11:07:56PM -0700, Junio C Hamano wrote:
>> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Teach Makefile to respect external variables: CFLAGS and others.
2007-06-13 7:39 ` Junio C Hamano
@ 2007-06-13 7:53 ` Eygene Ryabinkin
0 siblings, 0 replies; 7+ messages in thread
From: Eygene Ryabinkin @ 2007-06-13 7:53 UTC (permalink / raw)
To: Junio C Hamano; +Cc: sam, git
Junio,
Wed, Jun 13, 2007 at 12:39:28AM -0700, Junio C Hamano wrote:
> > 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.
OK, then this topic can be closed ;))
Thank you!
--
Eygene
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Teach Makefile to respect external variables: CFLAGS and others.
2007-06-13 7:15 ` Eygene Ryabinkin
2007-06-13 7:39 ` Junio C Hamano
@ 2007-06-13 7:42 ` Matthias Lederhofer
1 sibling, 0 replies; 7+ messages in thread
From: Matthias Lederhofer @ 2007-06-13 7:42 UTC (permalink / raw)
To: Eygene Ryabinkin; +Cc: git
Eygene Ryabinkin <rea-git@codelabs.ru> wrote:
> Junio, Sam, good day.
>
> Tue, Jun 12, 2007 at 11:07:56PM -0700, Junio C Hamano wrote:
> > 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 :)
If you want to fix it for your own checkout of git just put whatever
you like in config.mak. For example I add -ggdb3 to CFLAGS, set the
prefix variable and add some custom make targets in this file.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Teach Makefile to respect external variables: CFLAGS and others.
2007-06-13 5:42 [PATCH] Teach Makefile to respect external variables: CFLAGS and others Eygene Ryabinkin
2007-06-13 6:07 ` Junio C Hamano
@ 2007-06-13 6:12 ` Sam Ravnborg
1 sibling, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2007-06-13 6:12 UTC (permalink / raw)
To: Eygene Ryabinkin; +Cc: git
On Wed, Jun 13, 2007 at 09:42:30AM +0400, Eygene Ryabinkin wrote:
> If one is not using the configure script, then there is no way to
> redefine variables CFLAGS, LFLAGS, CC, AR, TAR, INSTALL, RPMBUILD,
> TCL_PATCH and TCLTK_PATH. This shouldn't be so, since these variables
> can be manually set by user and we should respect them.
make distingush between environment variables and make variables.
So for make there is a big difference between:
export FOO=foobar
make
and
make FOO=foobar
The latter will work as expected without your changes.
And the good part about this is that some random environment variables
does not influence the build.
Sam
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-06-13 7:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-13 5:42 [PATCH] Teach Makefile to respect external variables: CFLAGS and others Eygene Ryabinkin
2007-06-13 6:07 ` Junio C Hamano
2007-06-13 7:15 ` Eygene Ryabinkin
2007-06-13 7:39 ` Junio C Hamano
2007-06-13 7:53 ` Eygene Ryabinkin
2007-06-13 7:42 ` Matthias Lederhofer
2007-06-13 6:12 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).