* [PATCH] Makefile: quiet shell commands when "make --silent"
@ 2012-09-09 23:09 Pete Wyckoff
2012-09-10 0:35 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Pete Wyckoff @ 2012-09-09 23:09 UTC (permalink / raw)
To: git; +Cc: Jeff King
Option "--silent", "--quiet" or "-s" to make prevents
echoing of commands as they are executed. However, there
are some explicit "echo" commands in the Makefile and in
the two GIT-VERSION-GEN scripts that always echo.
Quiet the explicit "echo"s in Makefile when MAKEFLAG "s"
is set. Pass this information into both GIT-VERSION-GEN
helpers so that they can run silently too.
Before:
$ echo >>git.c
$ make -s
GIT_VERSION = 1.7.12.378.gaeb1945.dirty
* new script parameters
GITGUI_VERSION = 0.16.GITGUI-dirty
$
After:
$ echo >>git.c
$ make -s
$
Signed-off-by: Pete Wyckoff <pw@padd.com>
---
Make should be silent when given "--silent".
This may help tools that post-process make output, like the
"check-docs" command. Peff noticed in 5fafce0 (check-docs: get
documented command list from Makefile, 2012-08-08) that:
> ... make will print extra cruft like
> "GIT-VERSION-FILE is up to date" to stdout.
They now can use "make -s" to avoid filtering out the cruft.
-- Pete
GIT-VERSION-GEN | 11 ++++++++++-
Makefile | 13 ++++++++-----
git-gui/GIT-VERSION-GEN | 11 ++++++++++-
3 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index d2d2d69..97f0825 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -6,6 +6,12 @@ DEF_VER=v1.7.12.GIT
LF='
'
+silent=
+if test "${1:-}" = "#"
+then
+ silent=1
+fi
+
# First see if there is a version file (included in release tarballs),
# then try git-describe, then default.
if test -f version
@@ -35,7 +41,10 @@ else
VC=unset
fi
test "$VN" = "$VC" || {
- echo >&2 "GIT_VERSION = $VN"
+ if test -z "$silent"
+ then
+ echo >&2 "GIT_VERSION = $VN"
+ fi
echo "GIT_VERSION = $VN" >$GVF
}
diff --git a/Makefile b/Makefile
index 66e8216..dac5aab 100644
--- a/Makefile
+++ b/Makefile
@@ -305,7 +305,7 @@ all::
# "git help" is called without a parameter specifying the format.
GIT-VERSION-FILE: FORCE
- @$(SHELL_PATH) ./GIT-VERSION-GEN
+ @$(SHELL_PATH) ./GIT-VERSION-GEN "$(SILENT_SH_ECHO)"
-include GIT-VERSION-FILE
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
@@ -1850,6 +1850,9 @@ ifndef V
export QUIET_GEN
export QUIET_BUILT_IN
endif
+else
+# in --silent mode, suppress echo command in shell commands
+SILENT_SH_ECHO = \#
endif
ifdef NO_INSTALL_HARDLINKS
@@ -2074,7 +2077,7 @@ endef
GIT-SCRIPT-DEFINES: FORCE
@FLAGS='$(SCRIPT_DEFINES)'; \
if test x"$$FLAGS" != x"`cat $@ 2>/dev/null`" ; then \
- echo 1>&2 " * new script parameters"; \
+ $(SILENT_SH_ECHO)echo 1>&2 " * new script parameters"; \
echo "$$FLAGS" >$@; \
fi
@@ -2451,7 +2454,7 @@ TRACK_PREFIX = $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):\
GIT-PREFIX: FORCE
@FLAGS='$(TRACK_PREFIX)'; \
if test x"$$FLAGS" != x"`cat GIT-PREFIX 2>/dev/null`" ; then \
- echo 1>&2 " * new prefix flags"; \
+ $(SILENT_SH_ECHO)echo 1>&2 " * new prefix flags"; \
echo "$$FLAGS" >GIT-PREFIX; \
fi
@@ -2460,7 +2463,7 @@ TRACK_CFLAGS = $(CC):$(subst ','\'',$(ALL_CFLAGS)):$(USE_GETTEXT_SCHEME)
GIT-CFLAGS: FORCE
@FLAGS='$(TRACK_CFLAGS)'; \
if test x"$$FLAGS" != x"`cat GIT-CFLAGS 2>/dev/null`" ; then \
- echo 1>&2 " * new build flags"; \
+ $(SILENT_SH_ECHO)echo 1>&2 " * new build flags"; \
echo "$$FLAGS" >GIT-CFLAGS; \
fi
@@ -2469,7 +2472,7 @@ TRACK_LDFLAGS = $(subst ','\'',$(ALL_LDFLAGS))
GIT-LDFLAGS: FORCE
@FLAGS='$(TRACK_LDFLAGS)'; \
if test x"$$FLAGS" != x"`cat GIT-LDFLAGS 2>/dev/null`" ; then \
- echo 1>&2 " * new link flags"; \
+ $(SILENT_SH_ECHO)echo 1>&2 " * new link flags"; \
echo "$$FLAGS" >GIT-LDFLAGS; \
fi
diff --git a/git-gui/GIT-VERSION-GEN b/git-gui/GIT-VERSION-GEN
index 6570943..ba17163 100755
--- a/git-gui/GIT-VERSION-GEN
+++ b/git-gui/GIT-VERSION-GEN
@@ -6,6 +6,12 @@ DEF_VER=0.16.GITGUI
LF='
'
+silent=
+if test "${1:-}" = "#"
+then
+ silent=1
+fi
+
tree_search ()
{
head=$1
@@ -75,6 +81,9 @@ else
VC=unset
fi
test "$VN" = "$VC" || {
- echo >&2 "GITGUI_VERSION = $VN"
+ if test -z "$silent"
+ then
+ echo >&2 "GITGUI_VERSION = $VN"
+ fi
echo "GITGUI_VERSION = $VN" >$GVF
}
--
1.7.12.378.gaeb1945.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Makefile: quiet shell commands when "make --silent"
2012-09-09 23:09 [PATCH] Makefile: quiet shell commands when "make --silent" Pete Wyckoff
@ 2012-09-10 0:35 ` Junio C Hamano
2012-09-10 12:16 ` Pete Wyckoff
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2012-09-10 0:35 UTC (permalink / raw)
To: Pete Wyckoff; +Cc: git, Jeff King
Pete Wyckoff <pw@padd.com> writes:
> Option "--silent", "--quiet" or "-s" to make prevents
> echoing of commands as they are executed. However, there
> are some explicit "echo" commands in the Makefile and in
> the two GIT-VERSION-GEN scripts that always echo.
"make -s clean"?
I am not very enthused, especially if the primary motivation is
about "check-docs". Such a script must be prepared to filter out
cruft from the output of $(MAKE) and to pick out the bits that
interests it and that has been the way of life with $(MAKE) way
before Git started as a project ;-).
In order to make it more robust, targets like "print-man1" can (and
should) arrange their output in such a way that interesting parts
are easily findable.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Makefile: quiet shell commands when "make --silent"
2012-09-10 0:35 ` Junio C Hamano
@ 2012-09-10 12:16 ` Pete Wyckoff
0 siblings, 0 replies; 3+ messages in thread
From: Pete Wyckoff @ 2012-09-10 12:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King
gitster@pobox.com wrote on Sun, 09 Sep 2012 17:35 -0700:
> Pete Wyckoff <pw@padd.com> writes:
>
> > Option "--silent", "--quiet" or "-s" to make prevents
> > echoing of commands as they are executed. However, there
> > are some explicit "echo" commands in the Makefile and in
> > the two GIT-VERSION-GEN scripts that always echo.
>
> "make -s clean"?
Fixed here.
> I am not very enthused, especially if the primary motivation is
> about "check-docs". Such a script must be prepared to filter out
> cruft from the output of $(MAKE) and to pick out the bits that
> interests it and that has been the way of life with $(MAKE) way
> before Git started as a project ;-).
My motivation was to quiet output from a script I use
to test bisectability. I sent it out because I noticed
someone else found the verbosity annoying too.
Agreed that "fixing" check-docs is not important; that's
why I didn't bother in this patch.
-- Pete
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-10 12:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-09 23:09 [PATCH] Makefile: quiet shell commands when "make --silent" Pete Wyckoff
2012-09-10 0:35 ` Junio C Hamano
2012-09-10 12:16 ` Pete Wyckoff
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).