@matheusbsbs / matheus-bagliano / commits / 74f2b2a8d0
Fork 0

Make 'make' quieter while building git

I find it difficult to see compiler warnings amongst the massive spewing produced by GNU make as it works through our productions. This is especially true if CFLAGS winds up being rather long, due to a large number of -W options being enabled and due to a number of -D options being configured/required by my platform. By defining QUIET_MAKE (e.g. make QUIET_MAKE=YesPlease) during compilation users will get a less verbose output, such as: ... CC builtin-grep.c builtin-grep.c:187: warning: 'external_grep' defined but not used CC builtin-init-db.c CC builtin-log.c CC builtin-ls-files.c CC builtin-ls-tree.c ... The verbose (normal make) output is still the default. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn O. Pearce committed Mar 6, 2007 at 01:35 UTC 74f2b2a8d006a49e1be7e30731c2f7365d2741d1
3 files changed +62 -42
Makefile
+49 -37
@@ -1,6 +1,8 @@
1 # The default target of this Makefile is...
2 all::
3
4 +# Define QUIET_MAKE to have a less verbose compile.
5 +#
6 # Define NO_OPENSSL environment variable if you do not have OpenSSL.
7 # This also implies MOZILLA_SHA1.
8 #
@@ -602,6 +604,19 @@ endif
604 ifdef NO_PERL_MAKEMAKER
605 export NO_PERL_MAKEMAKER
606 endif
607 +ifdef QUIET_MAKE
608 + QUIET_CC = @echo ' ' CC $<;
609 + QUIET_AR = @echo ' ' AR $@;
610 + QUIET_LINK = @echo ' ' LINK $@;
611 + QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
612 + QUIET_GEN = @echo ' ' GEN $@;
613 + QUIET_SUBDIR0 = @subdir=
614 + QUIET_SUBDIR1 = ;echo ' ' SUBDIR $$subdir; $(MAKE) -C$$subdir
615 + export QUIET_MAKE
616 +else
617 + QUIET_SUBDIR0 = $(MAKE) -C
618 + QUIET_SUBDIR1 =
619 +endif
620
621 # Shell quote (do not use $(call) to accommodate ancient setups);
622
@@ -637,35 +652,34 @@ ifneq (,$X)
652 endif
653
654 all::
640 - $(MAKE) -C git-gui all
641 - $(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
642 - $(MAKE) -C templates
655 + $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) all
656 + $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
657 + $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
658
659 strip: $(PROGRAMS) git$X
660 $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
661
662 git$X: git.c common-cmds.h $(BUILTIN_OBJS) $(GITLIBS) GIT-CFLAGS
648 - $(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
663 + $(QUIET_LINK)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
664 $(ALL_CFLAGS) -o $@ $(filter %.c,$^) \
665 $(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
666
667 help.o: common-cmds.h
668
669 $(BUILT_INS): git$X
655 - rm -f $@ && ln git$X $@
670 + $(QUIET_BUILT_IN)rm -f $@ && ln git$X $@
671
672 common-cmds.h: Documentation/git-*.txt
658 - ./generate-cmdlist.sh > $@+
659 - mv $@+ $@
673 + $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
674
675 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
662 - rm -f $@ $@+
676 + $(QUIET_GEN)rm -f $@ $@+ && \
677 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
678 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
679 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
680 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
667 - $@.sh >$@+
668 - chmod +x $@+
681 + $@.sh >$@+ && \
682 + chmod +x $@+ && \
683 mv $@+ $@
684
685 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
@@ -674,7 +688,7 @@ perl/perl.mak: GIT-CFLAGS
688 $(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
689
690 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
677 - rm -f $@ $@+
691 + $(QUIET_GEN)rm -f $@ $@+ && \
692 INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
693 sed -e '1{' \
694 -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
@@ -685,20 +699,18 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
699 -e '}' \
700 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
701 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
688 - $@.perl >$@+
689 - chmod +x $@+
702 + $@.perl >$@+ && \
703 + chmod +x $@+ && \
704 mv $@+ $@
705
706 git-cherry-pick: git-revert
693 - cp $< $@+
694 - mv $@+ $@
707 + $(QUIET_GEN)cp $< $@+ && mv $@+ $@
708
709 git-status: git-commit
697 - cp $< $@+
698 - mv $@+ $@
710 + $(QUIET_GEN)cp $< $@+ && mv $@+ $@
711
712 gitweb/gitweb.cgi: gitweb/gitweb.perl
701 - rm -f $@ $@+
713 + $(QUIET_GEN)rm -f $@ $@+ && \
714 sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
715 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
716 -e 's|++GIT_BINDIR++|$(bindir)|g' \
@@ -716,12 +728,12 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
728 -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
729 -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
730 -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
719 - $< >$@+
720 - chmod +x $@+
731 + $< >$@+ && \
732 + chmod +x $@+ && \
733 mv $@+ $@
734
735 git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
724 - rm -f $@ $@+
736 + $(QUIET_GEN)rm -f $@ $@+ && \
737 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
738 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
739 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
@@ -729,15 +741,15 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
741 -e '/@@GITWEB_CGI@@/d' \
742 -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
743 -e '/@@GITWEB_CSS@@/d' \
732 - $@.sh > $@+
733 - chmod +x $@+
744 + $@.sh > $@+ && \
745 + chmod +x $@+ && \
746 mv $@+ $@
747
748 configure: configure.ac
737 - rm -f $@ $<+
749 + $(QUIET_GEN)rm -f $@ $<+ && \
750 sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
739 - $< > $<+
740 - autoconf -o $@ $<+
751 + $< > $<+ && \
752 + autoconf -o $@ $<+ && \
753 rm -f $<+
754
755 # These can record GIT_VERSION
@@ -747,25 +759,25 @@ git$X git.spec \
759 : GIT-VERSION-FILE
760
761 %.o: %.c GIT-CFLAGS
750 - $(CC) -o $*.o -c $(ALL_CFLAGS) $<
762 + $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
763 %.o: %.S
752 - $(CC) -o $*.o -c $(ALL_CFLAGS) $<
764 + $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
765
766 exec_cmd.o: exec_cmd.c GIT-CFLAGS
755 - $(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
767 + $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
768 builtin-init-db.o: builtin-init-db.c GIT-CFLAGS
757 - $(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
769 + $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
770
771 http.o: http.c GIT-CFLAGS
760 - $(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
772 + $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
773
774 ifdef NO_EXPAT
775 http-fetch.o: http-fetch.c http.h GIT-CFLAGS
764 - $(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
776 + $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
777 endif
778
779 git-%$X: %.o $(GITLIBS)
768 - $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
780 + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
781
782 ssh-pull.o: ssh-fetch.c
783 ssh-push.o: ssh-upload.c
@@ -779,11 +791,11 @@ git-imap-send$X: imap-send.o $(LIB_FILE)
791
792 http.o http-fetch.o http-push.o: http.h
793 git-http-fetch$X: fetch.o http.o http-fetch.o $(GITLIBS)
782 - $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
794 + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
795 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
796
797 git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
786 - $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
798 + $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
799 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
800
801 $(LIB_OBJS) $(BUILTIN_OBJS) fetch.o: $(LIB_H)
@@ -791,7 +803,7 @@ $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
803 $(DIFF_OBJS): diffcore.h
804
805 $(LIB_FILE): $(LIB_OBJS)
794 - rm -f $@ && $(AR) rcs $@ $(LIB_OBJS)
806 + $(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(LIB_OBJS)
807
808 XDIFF_OBJS=xdiff/xdiffi.o xdiff/xprepare.o xdiff/xutils.o xdiff/xemit.o \
809 xdiff/xmerge.o
@@ -799,7 +811,7 @@ $(XDIFF_OBJS): xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
811 xdiff/xutils.h xdiff/xprepare.h xdiff/xdiffi.h xdiff/xemit.h
812
813 $(XDIFF_LIB): $(XDIFF_OBJS)
802 - rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
814 + $(QUIET_AR)rm -f $@ && $(AR) rcs $@ $(XDIFF_OBJS)
815
816
817 perl/Makefile: perl/Git.pm perl/Makefile.PL GIT-CFLAGS
perl/Makefile
+6 -2
@@ -6,11 +6,15 @@ makfile:=perl.mak
6 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
7 prefix_SQ = $(subst ','\'',$(prefix))
8
9 +ifdef QUIET_MAKE
10 + QUIET = @
11 +endif
12 +
13 all install instlibdir: $(makfile)
10 - $(MAKE) -f $(makfile) $@
14 + $(QUIET)$(MAKE) -f $(makfile) $@
15
16 clean:
13 - test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0
17 + $(QUIET)test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0
18 $(RM) ppport.h
19 $(RM) $(makfile)
20 $(RM) $(makfile).old
templates/Makefile
+7 -3
@@ -1,5 +1,9 @@
1 # make and install sample templates
2
3 +ifdef QUIET_MAKE
4 + QUIET = @
5 +endif
6 +
7 INSTALL ?= install
8 TAR ?= tar
9 prefix ?= $(HOME)
@@ -18,7 +22,7 @@ all: boilerplates.made custom
22
23 bpsrc = $(filter-out %~,$(wildcard *--*))
24 boilerplates.made : $(bpsrc)
21 - ls *--* 2>/dev/null | \
25 + $(QUIET)ls *--* 2>/dev/null | \
26 while read boilerplate; \
27 do \
28 case "$$boilerplate" in *~) continue ;; esac && \
@@ -29,13 +33,13 @@ boilerplates.made : $(bpsrc)
33 *--) ;; \
34 *) cp $$boilerplate blt/$$dst ;; \
35 esac || exit; \
32 - done || exit
36 + done && \
37 date >$@
38
39 # If you need build-tailored templates, build them into blt/
40 # directory yourself here.
41 custom:
38 - : no custom templates yet
42 + $(QUIET): no custom templates yet
43
44 clean:
45 rm -rf blt boilerplates.made