* [PATCH 0/3] fix minor Makefile annoyances
@ 2015-05-29 7:21 Jeff King
2015-05-29 7:25 ` [PATCH 1/3] Makefile: drop dependency between git-instaweb and gitweb Jeff King
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jeff King @ 2015-05-29 7:21 UTC (permalink / raw)
To: git
I've noticed that running "make" on a fully-built git tree still builds
a lot of things:
$ make >/dev/null 2>&1 && make
GEN perl/PM.stamp
SUBDIR gitweb
GEN git-add--interactive
GEN git-difftool
GEN git-archimport
GEN git-cvsexportcommit
GEN git-cvsimport
GEN git-cvsserver
GEN git-relink
GEN git-send-email
GEN git-svn
GEN git-p4
SUBDIR ../
make[2]: 'GIT-VERSION-FILE' is up to date.
GEN git-instaweb
SUBDIR perl
SUBDIR templates
Here it is after this series:
$ make >/dev/null 2>&1 && make
SUBDIR perl
SUBDIR templates
The patches are:
[1/3]: Makefile: drop dependency between git-instaweb and gitweb
[2/3]: Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS
[3/3]: Makefile: silence perl/PM.stamp recipe
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] Makefile: drop dependency between git-instaweb and gitweb
2015-05-29 7:21 [PATCH 0/3] fix minor Makefile annoyances Jeff King
@ 2015-05-29 7:25 ` Jeff King
2015-05-29 7:26 ` [PATCH 2/3] Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS Jeff King
2015-05-29 7:26 ` [PATCH 3/3] Makefile: silence perl/PM.stamp recipe Jeff King
2 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2015-05-29 7:25 UTC (permalink / raw)
To: git
The rule for "git-instaweb" depends on "gitweb". This makes
no sense, because:
1. git-instaweb has no build-time dependency on gitweb; it
is a run-time dependency
2. gitweb is a directory that we want to recursively make
in. As a result, its recipe is marked .PHONY, which
causes "make" to rebuild git-instaweb every time it is
run.
Signed-off-by: Jeff King <peff@peff.net>
---
Note that this actually means we won't build "gitweb" at all with just
"make". It's possible that might break somebody's packaging script that
does:
make &&
cp gitweb/gitweb /some/place
I'm not incredibly concerned with that, as it was only being built as a
bizarre side effect here, and they should probably be doing "make
gitweb" (or "cd gitweb && make") if that's what they want to build.
But if we do want to build it by default, we can add it into the "all::"
rule, as we do for "templates".
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 323c401..6283353 100644
--- a/Makefile
+++ b/Makefile
@@ -1784,7 +1784,7 @@ GIT-PERL-DEFINES: FORCE
gitweb:
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
-git-instaweb: git-instaweb.sh gitweb GIT-SCRIPT-DEFINES
+git-instaweb: git-instaweb.sh GIT-SCRIPT-DEFINES
$(QUIET_GEN)$(cmd_munge_script) && \
chmod +x $@+ && \
mv $@+ $@
--
2.4.2.668.gc3b1ade.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS
2015-05-29 7:21 [PATCH 0/3] fix minor Makefile annoyances Jeff King
2015-05-29 7:25 ` [PATCH 1/3] Makefile: drop dependency between git-instaweb and gitweb Jeff King
@ 2015-05-29 7:26 ` Jeff King
2015-05-29 7:26 ` [PATCH 3/3] Makefile: silence perl/PM.stamp recipe Jeff King
2 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2015-05-29 7:26 UTC (permalink / raw)
To: git
We force the GIT-BUILD-OPTIONS recipe to run every time
"make" is invoked. We must do this to catch new options
which may have come from the command-line or environment.
However, we actually update the file's timestamp each time
the recipe is run, whether anything changed or not. As a
result, any files which depend on it (for example, all of
the perl scripts, which need to know whether NO_PERL was
set) will be re-built every time.
Let's do our usual trick of writing to a tempfile, then
doing a "cmp || mv" to update the file only when something
changed.
Signed-off-by: Jeff King <peff@peff.net>
---
Makefile | 45 +++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/Makefile b/Makefile
index 6283353..6b4fbeb 100644
--- a/Makefile
+++ b/Makefile
@@ -2103,46 +2103,47 @@ GIT-LDFLAGS: FORCE
# that runs GIT-BUILD-OPTIONS, and then again to protect it
# and the first level quoting from the shell that runs "echo".
GIT-BUILD-OPTIONS: FORCE
- @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
- @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
- @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@
- @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@
- @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
- @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@
- @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@
- @echo USE_LIBPCRE=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE)))'\' >>$@
- @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@
- @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@
- @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@
+ @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+
+ @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+
+ @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+
+ @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
+ @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
+ @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
+ @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
+ @echo USE_LIBPCRE=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE)))'\' >>$@+
+ @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
+ @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+
+ @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+
ifdef TEST_OUTPUT_DIRECTORY
- @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@
+ @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+
endif
ifdef GIT_TEST_OPTS
- @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@
+ @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+
endif
ifdef GIT_TEST_CMP
- @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@
+ @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+
endif
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
- @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
+ @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+
endif
- @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@
- @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
+ @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+
+ @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@+
ifdef GIT_PERF_REPEAT_COUNT
- @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@
+ @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+
endif
ifdef GIT_PERF_REPO
- @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@
+ @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+
endif
ifdef GIT_PERF_LARGE_REPO
- @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@
+ @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+
endif
ifdef GIT_PERF_MAKE_OPTS
- @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@
+ @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+
endif
ifdef TEST_GIT_INDEX_VERSION
- @echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@
+ @echo TEST_GIT_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(TEST_GIT_INDEX_VERSION)))'\' >>$@+
endif
+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
### Detect Python interpreter path changes
ifndef NO_PYTHON
--
2.4.2.668.gc3b1ade.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] Makefile: silence perl/PM.stamp recipe
2015-05-29 7:21 [PATCH 0/3] fix minor Makefile annoyances Jeff King
2015-05-29 7:25 ` [PATCH 1/3] Makefile: drop dependency between git-instaweb and gitweb Jeff King
2015-05-29 7:26 ` [PATCH 2/3] Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS Jeff King
@ 2015-05-29 7:26 ` Jeff King
2 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2015-05-29 7:26 UTC (permalink / raw)
To: git
Every time we run "make", we update perl/PM.stamp, which
contains a list of all of the perl module files (if it's
updated, we need to rebuild perl/perl.mak, since the
Makefile will not otherwise know about the new files).
This means that every time "make" is run, we see:
GEN perl/PM.stamp
in the output, even though it is not likely to have changed.
Let's make this recipe completely silent, as we do for other
auto-generated dependency files (e.g., GIT-CFLAGS).
Signed-off-by: Jeff King <peff@peff.net>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 6b4fbeb..6b0dd47 100644
--- a/Makefile
+++ b/Makefile
@@ -1747,7 +1747,7 @@ $(SCRIPT_PERL_GEN): perl/perl.mak
perl/perl.mak: perl/PM.stamp
perl/PM.stamp: FORCE
- $(QUIET_GEN)$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
+ @$(FIND) perl -type f -name '*.pm' | sort >$@+ && \
{ cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@; } && \
$(RM) $@+
--
2.4.2.668.gc3b1ade.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-29 7:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-29 7:21 [PATCH 0/3] fix minor Makefile annoyances Jeff King
2015-05-29 7:25 ` [PATCH 1/3] Makefile: drop dependency between git-instaweb and gitweb Jeff King
2015-05-29 7:26 ` [PATCH 2/3] Makefile: avoid timestamp updates to GIT-BUILD-OPTIONS Jeff King
2015-05-29 7:26 ` [PATCH 3/3] Makefile: silence perl/PM.stamp recipe Jeff King
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.