Skip to contentSkip to conversation

xfsprogs: Cleaner build output

PATCH In review Dave Chinner 2 participants 6 messages Jan 19, 2010 Kbuild

lore
Share & tools
lore
#4 lore raw

PATCH 2/2 xfsprogs: Make the compile output cleaner V3

We don't need to see every compiler command line for every file that is compiled. This makes it hard to see warnings and errors during compile. For progress notification, we really only need to see the diretory/file being operated on.

Turn down the verbosity of output by suppressing various make output and provide better overall visibility of which directory is being operated on, what the operation is and what is being done to the files by the build/clean process.

Sample output from a build:

....
Building libxlog

    [CC] xfs_log_recover.c
    [CC] util.c
    [LD] libxlog.la
Building libxcmd
    [CC] command.c
    [CC] input.c
    [CC] paths.c
    [CC] projects.c
    [CC] help.c
    [CC] quit.c
    [LD] libxcmd.la

....

Sample output from cleaning:

$ make clean
Cleaning include
Cleaning libxfs
Cleaning libxlog
Cleaning libxcmd
Cleaning libhandle
Cleaning libdisk
Cleaning copy
Cleaning db
....

If you want to see a noisy build (i.e. every command), use:

$ make V=1

and that will output all the commands that are now suppressed by default.

Portions of this patch were contributed by Eric Sandeen.

---
 Makefile            |   41 ++++++++++++++++++++++++++++-------------
 doc/Makefile        |    3 ++-
 include/Makefile    |    3 ++-
 include/buildmacros |   10 +++++-----
 include/buildrules  |   30 +++++++++++++++++++++---------
 mkfs/Makefile       |    3 ++-
 6 files changed, 60 insertions(+), 30 deletions(-)
Makefile +28 -13
index a7615ca..62c4258 100644
@@ -2,6 +2,21 @@
 # Copyright (c) 2000-2006 Silicon Graphics, Inc.  All Rights Reserved.
 #
 
+ifeq ("$(origin V)", "command line")
+  BUILD_VERBOSE = $(V)
+endif
+ifndef BUILD_VERBOSE
+  BUILD_VERBOSE = 0
+endif
+
+ifeq ($(BUILD_VERBOSE),1)
+  Q =
+else
+  Q = @
+endif
+
+MAKEOPTS = --no-print-directory Q=$(Q)
+
 TOPDIR = .
 HAVE_BUILDDEFS = $(shell test -f $(TOPDIR)/include/builddefs && echo yes || echo no)
 
@@ -36,9 +51,9 @@ SUBDIRS = include $(LIB_SUBDIRS) $(TOOL_SUBDIRS)
 
 default: include/builddefs include/platform_defs.h
 ifeq ($(HAVE_BUILDDEFS), no)
-	$(MAKE) -C . $@
+	$(Q)$(MAKE) $(MAKEOPTS) -C . $@
 else
-	$(MAKE) $(SUBDIRS)
+	$(Q)$(MAKE) $(MAKEOPTS) $(SUBDIRS)
 endif
 
 # tool/lib dependencies
@@ -80,7 +95,7 @@ include/platform_defs.h: include/builddefs
 ## Recover from the removal of $@
 	@if test -f $@; then :; else \
 		rm -f include/builddefs; \
-		$(MAKE) $(AM_MAKEFLAGS) include/builddefs; \
+		$(MAKE) $(MAKEOPTS) $(AM_MAKEFLAGS) include/builddefs; \
 	fi
 
 install: default $(addsuffix -install,$(SUBDIRS))
@@ -101,29 +116,29 @@ install-qa: install $(addsuffix -install-qa,$(SUBDIRS))
 	$(MAKE) -C $* install-qa
 
 distclean: clean
-	rm -f $(DISTDIRT)
+	$(Q)rm -f $(DISTDIRT)
 
 realclean: distclean
-	rm -f $(CONFIGURE)
+	$(Q)rm -f $(CONFIGURE)
 
 #
 # All this gunk is to allow for a make dist on an unconfigured tree
 #
 dist: include/builddefs include/platform_defs.h default
 ifeq ($(HAVE_BUILDDEFS), no)
-	$(MAKE) -C . $@
+	$(Q)$(MAKE) $(MAKEOPTS) -C . $@
 else
-	$(MAKE) $(SRCTAR)
+	$(Q)$(MAKE) $(MAKEOPTS) $(SRCTAR)
 endif
 
 deb: include/builddefs include/platform_defs.h
 ifeq ($(HAVE_BUILDDEFS), no)
-	$(MAKE) -C . $@
+	$(Q)$(MAKE) $(MAKEOPTS) -C . $@
 else
-	$(MAKE) $(SRCDIR)
-	$(MAKE) -C po
-	$(MAKE) source-link
-	cd $(SRCDIR) && dpkg-buildpackage
+	$(Q)$(MAKE) $(MAKEOPTS) $(SRCDIR)
+	$(Q)$(MAKE) $(MAKEOPTS) -C po
+	$(Q)$(MAKE) $(MAKEOPTS) source-link
+	$(Q)cd $(SRCDIR) && dpkg-buildpackage
 endif
 
 $(SRCDIR) : $(_FORCE)
@@ -131,6 +146,6 @@ $(SRCDIR) : $(_FORCE)
 	mkdir -p $@
 
 $(SRCTAR) : default $(SRCDIR)
-	$(MAKE) source-link
+	$(Q)$(MAKE) $(MAKEOPTS) source-link
 	unset TAPE; $(TAR) -cf - $(SRCDIR) | $(ZIP) --best > $@ && \
 	echo Wrote: $@
doc/Makefile +2 -1
index 8f65b66..86ac2ca 100644
@@ -13,7 +13,8 @@ default: CHANGES.gz
 include $(BUILDRULES)
 
 CHANGES.gz:
-	$(ZIP) --best -c < CHANGES > $@
+	@echo "    [ZIP]    $@"
+	$(Q)$(ZIP) --best -c < CHANGES > $@
 
 install: default
 	$(INSTALL) -m 755 -d $(PKG_DOC_DIR)
include/Makefile +2 -1
index d89480e..bc787db 100644
@@ -43,7 +43,8 @@ LDIRT = xfs disk
 default install: xfs disk
 
 xfs disk:
-	$(LN_S) . $@
+	@echo "    [LN]     $@"
+	$(Q)$(LN_S) . $@
 
 include $(BUILDRULES)
 
include/buildmacros +5 -5
index 099570f..62babca 100644
@@ -13,7 +13,7 @@ LDFLAGS += $(LOADERFLAGS) $(LLDFLAGS)
 LTLDFLAGS += $(LOADERFLAGS)
 LDLIBS = $(LLDLIBS) $(PLDLIBS) $(MALLOCLIB)
 
-MAKEOPTS = --no-print-directory
+MAKEOPTS = --no-print-directory Q=$(Q)
 SRCFILES = Makefile $(HFILES) $(CFILES) $(LSRCFILES) $(LFILES) $(YFILES)
 SRCFILES += $(QAHFILES)
 
@@ -45,10 +45,10 @@ LIBNAME = $(basename $(LTLIBRARY))
 LTOBJECTS = $(OBJECTS:.o=.lo)
 LTVERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
 
-LTLINK = $(LIBTOOL) --tag=CC --mode=link $(CC)
-LTEXEC = $(LIBTOOL) --mode=execute
-LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL)
-LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CCF)
+LTLINK = $(LIBTOOL) --quiet --tag=CC --mode=link $(CC)
+LTEXEC = $(LIBTOOL) --quiet --mode=execute
+LTINSTALL = $(LIBTOOL) --quiet --mode=install $(INSTALL)
+LTCOMPILE = $(LIBTOOL) --quiet --tag=CC --mode=compile $(CCF)
 
 ifeq ($(ENABLE_SHARED),yes)
 LTLDFLAGS += -rpath $(PKG_ROOT_LIB_DIR)
include/buildrules +21 -9
index a06d480..fdc60e6 100644
@@ -7,10 +7,11 @@ _BUILDRULES_INCLUDED_ = 1
 include $(TOPDIR)/include/builddefs
 
 clean clobber : $(addsuffix -clean,$(SUBDIRS))
-	rm -f $(DIRT)
-	rm -fr $(DIRDIRT)
+	@rm -f $(DIRT)
+	@rm -fr $(DIRDIRT)
 %-clean:
-	$(MAKE) -C $* clean
+	@echo "Cleaning $*"
+	$(Q)$(MAKE) $(MAKEOPTS) -C $* clean
 
 # Never blow away subdirs
 ifdef SUBDIRS
@@ -18,7 +19,8 @@ ifdef SUBDIRS
 .PHONY: $(SUBDIRS)
 
 $(SUBDIRS):
-	$(MAKE) -C $@
+	@echo "Building $@"
+	$(Q)$(MAKE) $(MAKEOPTS) -q -C $@ || $(MAKE) $(MAKEOPTS) -C $@
 endif
 
 source-link: 
@@ -38,20 +40,29 @@ source-link:
 
 ifdef LTCOMMAND
 $(LTCOMMAND) : $(SUBDIRS) $(OBJECTS) $(LTDEPENDENCIES)
-	$(LTLINK) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
+	@echo "    [LD]     $@"
+	$(Q)$(LTLINK) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
 endif
 
 ifdef LTLIBRARY
 $(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS)
-	$(LTLINK) $(LTLDFLAGS) -o $(LTLIBRARY) $(LTOBJECTS) $(LTLIBS)
+	@echo "    [LD]     $@"
+	$(Q)$(LTLINK) $(LTLDFLAGS) -o $(LTLIBRARY) $(LTOBJECTS) $(LTLIBS)
 
 %.lo: %.c
-	$(LTCOMPILE) -c $<
+	@echo "    [CC]     $@"
+	$(Q)$(LTCOMPILE) -c $<
+else
+%.o: %.c
+	@echo "    [CC]     $@"
+	$(Q)$(CC) $(CFLAGS) -c $<
+
 endif
 
 ifdef POTHEAD
 $(POTHEAD): $(XGETTEXTFILES)
-	$(XGETTEXT) --language=C --keyword=_ --keyword=N_ -o $@ $(XGETTEXTFILES)
+	@echo "    [GETTXT] $@"
+	$(Q)$(XGETTEXT) --language=C --keyword=_ --keyword=N_ -o $@ $(XGETTEXTFILES)
 
 # Update translations
 update-po: $(POTHEAD) $(wildcard $(TOPDIR)/po/*.po)
@@ -70,7 +81,8 @@ update-po: $(POTHEAD) $(wildcard $(TOPDIR)/po/*.po)
 	done
 
 %.mo: %.po
-	$(MSGFMT) -c --statistics -o $@ $<
+	@echo "    [MSGFMT] $@"
+	$(Q)$(MSGFMT) -c --statistics -o $@ $<
 endif
 
 endif # _BUILDRULES_INCLUDED_
mkfs/Makefile +2 -1
index 9fcadf2..a749262 100644
@@ -36,7 +36,8 @@ endif
 include $(BUILDRULES)
 
 $(FSTYP):
-	$(LTLINK) [email protected] -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS)
+	@echo "    [CC]     $@"
+	$(Q)$(LTLINK) [email protected] -o $@ $(CFLAGS) $(LDFLAGS) $(LIBDISK) $(PLDLIBS)
 
 install: default
 	$(INSTALL) -m 755 -d $(PKG_ROOT_SBIN_DIR)
Signature · 6 lines
1.6.5

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw

PATCH 1/2 xfsprogs: Do not remove configure information on clean

In reply to Dave Chinner

Ŋormal packaging practice is to remove the configure scripts on a 'make distclean' so that a 'make clean' doesn't result in having to rerun the configure scripts. Change the clean targets in the top level makefile to only clear configure files on a distclean.

---
 Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 2d394e4..a7615ca 100644
@@ -15,7 +15,7 @@ SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
 CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
 LSRCFILES = configure.in release.sh README VERSION $(CONFIGURE)
 
-LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
+DISTDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
 	built .census install.* install-dev.* *.gz autom4te.cache/* libtool \
 	include/builddefs include/platform_defs.h
 
@@ -101,7 +101,7 @@ install-qa: install $(addsuffix -install-qa,$(SUBDIRS))
 	$(MAKE) -C $* install-qa
 
 distclean: clean
-	rm -f $(LDIRT)
+	rm -f $(DISTDIRT)
 
 realclean: distclean
 	rm -f $(CONFIGURE)
Signature · 6 lines
1.6.5

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw

Re: [PATCH 1/2] xfsprogs: Do not remove configure information on clean

Quoted 16 lines · Dave Chinner

??ormal packaging practice is to remove the configure scripts on a 'make distclean' so that a 'make clean' doesn't result in having to rerun the configure scripts. Change the clean targets in the top level makefile to only clear configure files on a distclean.

---
 Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Makefile +0 -0
index 2d394e4..a7615ca 100644

Makefile SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz · line 20

Quoted 7 lines
Makefile +1 -1
@@ -15,7 +15,7 @@ SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
 CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
 LSRCFILES = configure.in release.sh README VERSION $(CONFIGURE)
 
-LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
+DISTDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
 	built .census install.* install-dev.* *.gz autom4te.cache/* libtool \
 	include/builddefs include/platform_defs.h

But this isn't all configure stuff, is it? install.* install-dev.* *.gz is from the install process, and .dep is part of make dep.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw

Re: [PATCH 1/2] xfsprogs: Do not remove configure information on clean

In reply to Christoph Hellwig
Quoted 20 lines · Christoph Hellwig
Quoted 19 lines · Dave Chinner

??ormal packaging practice is to remove the configure scripts on a 'make distclean' so that a 'make clean' doesn't result in having to rerun the configure scripts. Change the clean targets in the top level makefile to only clear configure files on a distclean.

---
 Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Makefile +0 -0
index 2d394e4..a7615ca 100644
@@ -15,7 +15,7 @@ SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz
 CONFIGURE = aclocal.m4 configure config.guess config.sub install-sh ltmain.sh
 LSRCFILES = configure.in release.sh README VERSION $(CONFIGURE)
 
Quoted 7 lines

Makefile SRCTAR = $(PKG_NAME)-$(PKG_VERSION).tar.gz · line 20

Quoted 4 lines
Makefile +1 -1
-LDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
+DISTDIRT = config.log .dep config.status config.cache confdefs.h conftest* \
 	built .census install.* install-dev.* *.gz autom4te.cache/* libtool \
 	include/builddefs include/platform_defs.h

But this isn't all configure stuff, is it? install.* install-dev.* *.gz is from the install process, and .dep is part of make dep.

Hmm - I never do make installs - I always build packages because I build on a different machine to the ones I test one. I'll check it out, but I've never seen install* files generated in the top level.

For the *.gz files, the tarballs are generated by "make dist", so shouldn't they be removed by "make distclean"?

As to depenencies, we have no "make dep" target, there doesn't appear to be any makefile gunk to generate them, and the dependencies are completely busted. That's on my list to fix.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs