Git development
 help / color / mirror / Atom feed
* [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
@ 2006-06-22  1:47 Yakov Lerner
  2006-06-22  7:19 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Yakov Lerner @ 2006-06-22  1:47 UTC (permalink / raw)
  To: git; +Cc: iler.ml

Before this patch, -DDEFAULT_GIT_TEMPLATE_DIR was passed on compilation
command line to all and every %c compiled. In fact the macro
is used by only one .c file, and unused by all other .c files.
Remove -DDEFAULT_GIT_TEMPLATE_DIR where unused. Follow the examlpe of 
exec_cmd.o. Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used. 

Signed-off-by: Yakov Lerner <iler.ml@gmail.com>
---
 Makefile |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index c602099..7af0937 100644
--- a/Makefile
+++ b/Makefile
@@ -472,7 +472,6 @@ PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON
 GIT_PYTHON_DIR_SQ = $(subst ','\'',$(GIT_PYTHON_DIR))
 
 ALL_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS)
-ALL_CFLAGS += -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"'
 LIB_OBJS += $(COMPAT_OBJS)
 export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
 ### Build rules
@@ -548,6 +547,8 @@ git$X git.spec \
 
 exec_cmd.o: exec_cmd.c GIT-CFLAGS
 	$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
+builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
+	$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
 
 http.o: http.c GIT-CFLAGS
 	$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
-- 
1.4.0.ga40a

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
  2006-06-22  1:47 [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used Yakov Lerner
@ 2006-06-22  7:19 ` Junio C Hamano
  2006-06-22  7:49   ` Timo Hirvonen
  2006-06-22 13:12   ` Petr Baudis
  0 siblings, 2 replies; 8+ messages in thread
From: Junio C Hamano @ 2006-06-22  7:19 UTC (permalink / raw)
  To: Yakov Lerner; +Cc: git

Yakov Lerner <iler.ml@gmail.com> writes:

> Before this patch, -DDEFAULT_GIT_TEMPLATE_DIR was passed on compilation
> command line to all and every %c compiled. In fact the macro
> is used by only one .c file, and unused by all other .c files.
> Remove -DDEFAULT_GIT_TEMPLATE_DIR where unused. Follow the examlpe of 
> exec_cmd.o. Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used. 

Thanks.

By the way, I really started hating that we have $(GIT_VERSION)
in $(TRACK_CFLAGS).  Since the version string is tied to the
HEAD commit object name, having it in $(TRACK_CFLAGS) means that
every time I switch branches, make a new commit on top of the
current branch, or checkout-compile-and-then-make-local-change
sequence would force pretty much everything to be rebuilt.

Do you think of any downside if I remove it from the list of
symbols in TRACK_CFLAGS?

For that matter, I do not think tracking prefix_SQ makes much
sense since what matters are bindir, gitexecdir and template_dir
which are already covered, and prefix is merely a convenience to
set these three (four, counting GIT_PYTHON_DIR; we probably
should add it to TRACK_CFLAGS).

Thoughts?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
  2006-06-22  7:19 ` Junio C Hamano
@ 2006-06-22  7:49   ` Timo Hirvonen
  2006-06-22  9:04     ` Junio C Hamano
  2006-06-22 13:12   ` Petr Baudis
  1 sibling, 1 reply; 8+ messages in thread
From: Timo Hirvonen @ 2006-06-22  7:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: iler.ml, git

Junio C Hamano <junkio@cox.net> wrote:

> Yakov Lerner <iler.ml@gmail.com> writes:
> 
> > Before this patch, -DDEFAULT_GIT_TEMPLATE_DIR was passed on compilation
> > command line to all and every %c compiled. In fact the macro
> > is used by only one .c file, and unused by all other .c files.
> > Remove -DDEFAULT_GIT_TEMPLATE_DIR where unused. Follow the examlpe of 
> > exec_cmd.o. Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used. 
> 
> Thanks.
> 
> By the way, I really started hating that we have $(GIT_VERSION)
> in $(TRACK_CFLAGS).  Since the version string is tied to the
> HEAD commit object name, having it in $(TRACK_CFLAGS) means that
> every time I switch branches, make a new commit on top of the
> current branch, or checkout-compile-and-then-make-local-change
> sequence would force pretty much everything to be rebuilt.

I think this already makes sure git is compiled if version changes:

# These can record GIT_VERSION
git$X git.spec \
        $(patsubst %.sh,%,$(SCRIPT_SH)) \
        $(patsubst %.perl,%,$(SCRIPT_PERL)) \
        $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
        : GIT-VERSION-FILE

$ git grep GIT_VERSION *.sh *.perl
git-send-email.perl:	my $gitversion = '@@GIT_VERSION@@';
git-send-email.perl:	if ($gitversion =~ m/..GIT_VERSION../) {

Only git-send-email and git needs to depend on GIT_VERSION.

> For that matter, I do not think tracking prefix_SQ makes much
> sense since what matters are bindir, gitexecdir and template_dir
> which are already covered, and prefix is merely a convenience to
> set these three (four, counting GIT_PYTHON_DIR; we probably
> should add it to TRACK_CFLAGS).

Yes, only ALL_CFLAGS, bindir, gitexecdir, template_dir and
GIT_PYTHON_DIR should be in TRACK_CFLAGS.

-- 
http://onion.dynserv.net/~timo/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
  2006-06-22  7:49   ` Timo Hirvonen
@ 2006-06-22  9:04     ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2006-06-22  9:04 UTC (permalink / raw)
  To: Timo Hirvonen; +Cc: iler.ml, git

Timo Hirvonen <tihirvon@gmail.com> writes:

> Junio C Hamano <junkio@cox.net> wrote:
>
>> By the way, I really started hating that we have $(GIT_VERSION)
>> in $(TRACK_CFLAGS).  Since the version string is tied to the
>> HEAD commit object name, having it in $(TRACK_CFLAGS) means that
>> every time I switch branches, make a new commit on top of the
>> current branch, or checkout-compile-and-then-make-local-change
>> sequence would force pretty much everything to be rebuilt.
>...
>> For that matter, I do not think tracking prefix_SQ makes much
>> sense since what matters are bindir, gitexecdir and template_dir
>> which are already covered, and prefix is merely a convenience to
>> set these three (four, counting GIT_PYTHON_DIR; we probably
>> should add it to TRACK_CFLAGS).
>
> Yes, only ALL_CFLAGS, bindir, gitexecdir, template_dir and
> GIT_PYTHON_DIR should be in TRACK_CFLAGS.

Exactly my thinking.  Let's do it like this, then.

-- >8 --
Makefile: do not force unneeded recompilation upon GIT_VERSION changes

---
diff --git a/Makefile b/Makefile
index 55a84d4..d45f3dc 100644
--- a/Makefile
+++ b/Makefile
@@ -612,7 +612,7 @@ tags:
 	find . -name '*.[hcS]' -print | xargs ctags -a
 
 ### Detect prefix changes
-TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):$(GIT_VERSION):\
+TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):$(GIT_PYTHON_DIR_SQ):\
              $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
 
 GIT-CFLAGS: .FORCE-GIT-CFLAGS

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
  2006-06-22  7:19 ` Junio C Hamano
  2006-06-22  7:49   ` Timo Hirvonen
@ 2006-06-22 13:12   ` Petr Baudis
  2006-06-22 17:11     ` Junio C Hamano
  1 sibling, 1 reply; 8+ messages in thread
From: Petr Baudis @ 2006-06-22 13:12 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Yakov Lerner, git

Dear diary, on Thu, Jun 22, 2006 at 09:19:52AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> For that matter, I do not think tracking prefix_SQ makes much
> sense since what matters are bindir, gitexecdir and template_dir
> which are already covered, and prefix is merely a convenience to
> set these three (four, counting GIT_PYTHON_DIR; we probably
> should add it to TRACK_CFLAGS).

$(prefix) will be passed to perl/Makefile.PL.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
  2006-06-22 13:12   ` Petr Baudis
@ 2006-06-22 17:11     ` Junio C Hamano
  2006-06-22 17:58       ` Petr Baudis
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2006-06-22 17:11 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

> Dear diary, on Thu, Jun 22, 2006 at 09:19:52AM CEST, I got a letter
> where Junio C Hamano <junkio@cox.net> said that...
>> For that matter, I do not think tracking prefix_SQ makes much
>> sense since what matters are bindir, gitexecdir and template_dir
>> which are already covered, and prefix is merely a convenience to
>> set these three (four, counting GIT_PYTHON_DIR; we probably
>> should add it to TRACK_CFLAGS).
>
> $(prefix) will be passed to perl/Makefile.PL.

Then probably it shouldn't; instead we woulld probably want to
pass the moral equivalent of GIT_PYTHON_DIR.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
  2006-06-22 17:11     ` Junio C Hamano
@ 2006-06-22 17:58       ` Petr Baudis
  2006-06-22 18:58         ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Petr Baudis @ 2006-06-22 17:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Dear diary, on Thu, Jun 22, 2006 at 07:11:49PM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> writes:
> 
> > Dear diary, on Thu, Jun 22, 2006 at 09:19:52AM CEST, I got a letter
> > where Junio C Hamano <junkio@cox.net> said that...
> >> For that matter, I do not think tracking prefix_SQ makes much
> >> sense since what matters are bindir, gitexecdir and template_dir
> >> which are already covered, and prefix is merely a convenience to
> >> set these three (four, counting GIT_PYTHON_DIR; we probably
> >> should add it to TRACK_CFLAGS).
> >
> > $(prefix) will be passed to perl/Makefile.PL.
> 
> Then probably it shouldn't; instead we woulld probably want to
> pass the moral equivalent of GIT_PYTHON_DIR.

I'm not sure about what the rationale behind GIT_PYTHON_DIR was, but it
seems to be used only by a library supposedly internal to some Git
commands, while the Git.pm module should be available systemwide even
for non-Git applications, so it's really best to leave it to Perl where
to put it.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used.
  2006-06-22 17:58       ` Petr Baudis
@ 2006-06-22 18:58         ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2006-06-22 18:58 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

> ... while the Git.pm module should be available systemwide even
> for non-Git applications, so it's really best to leave it to Perl where
> to put it.

OK, if that is the intention passing prefix might be sensible.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-06-22 18:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-22  1:47 [PATCH] Pass -DDEFAULT_GIT_TEMPLATE_DIR only where actually used Yakov Lerner
2006-06-22  7:19 ` Junio C Hamano
2006-06-22  7:49   ` Timo Hirvonen
2006-06-22  9:04     ` Junio C Hamano
2006-06-22 13:12   ` Petr Baudis
2006-06-22 17:11     ` Junio C Hamano
2006-06-22 17:58       ` Petr Baudis
2006-06-22 18:58         ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox