about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-10T21·31+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-01-10T21·31+0100
commitca73c0102fc68ece171d7cc062e464b4d418d07c (patch)
treed35048277993d852c173bdf6d2ffbe78bff1ec67
parente991ab942b6ed1bc50a63afafe55ffe5cae8cbad (diff)
Nicer Make output
E.g.

  CXX    src/nix-log2xml/log2xml.o
  CC     src/bsdiff-4.3/bsdiff.o
  GEN    scripts/nix-channel
  LD     src/libmain/libnixmain.so
-rw-r--r--clean.mk2
-rw-r--r--dist.mk2
-rw-r--r--install.mk6
-rw-r--r--jars.mk4
-rw-r--r--lib.mk2
-rw-r--r--libraries.mk6
-rw-r--r--patterns.mk6
-rw-r--r--programs.mk4
-rw-r--r--templates.mk2
-rw-r--r--tracing.mk16
10 files changed, 33 insertions, 17 deletions
diff --git a/clean.mk b/clean.mk
index 7dba76c5d910..f45d578aa4b6 100644
--- a/clean.mk
+++ b/clean.mk
@@ -1,7 +1,7 @@
 clean_files :=
 
 clean:
-	$(QUIET) rm -fv -- $(clean_files)
+	$(suppress) rm -fv -- $(clean_files)
 
 dryclean:
 	@for i in $(clean_files); do if [ -e $$i ]; then echo $$i; fi; done | sort
diff --git a/dist.mk b/dist.mk
index 444c58b3fe23..bf97b697f95f 100644
--- a/dist.mk
+++ b/dist.mk
@@ -7,7 +7,7 @@ dist_files :=
 dist: $(dist_name).tar.bz2
 
 $(dist_name).tar.bz2: $(dist_files)
-	$(QUIET) tar cvfj $@ $(dist_files) --transform 's,^,$(dist_name)/,'
+	$(suppress) tar cvfj $@ $(dist_files) --transform 's,^,$(dist_name)/,'
 
 clean_files += $(dist_name).tar.bz2
 
diff --git a/install.mk b/install.mk
index c5eb8eb37743..aee4bf38ba7a 100644
--- a/install.mk
+++ b/install.mk
@@ -4,7 +4,7 @@ define create-dir =
   ifndef $(1)_SEEN
     $(1)_SEEN = 1
     $(1):
-	$(QUIET) install -d $(1)
+	$$(trace-install) install -d $(1)
   endif
 endef
 
@@ -18,7 +18,7 @@ define install-file-as =
   $$(eval $$(call create-dir,$$(dir $(2))))
 
   $(2): $(1) | $$(dir $(2))
-	$(QUIET) install -m $(3) $(1) $(2)
+	$$(trace-install) install -m $(3) $(1) $(2)
 
 endef
 
@@ -48,6 +48,6 @@ define install-symlink =
   $$(eval $$(call create-dir,$$(dir $(2))))
 
   $(2): | $$(dir $(2))
-	$(QUIET) ln -sfn $(1) $(2)
+	$$(trace-install) ln -sfn $(1) $(2)
 
 endef
diff --git a/jars.mk b/jars.mk
index 5d459c0a9d70..c8075cde167f 100644
--- a/jars.mk
+++ b/jars.mk
@@ -10,8 +10,8 @@ define build-jar =
   $$($(1)_PATH): $$($(1)_SOURCES)
 	@rm -rf $$($(1)_TMPDIR)
 	@mkdir -p $$($(1)_TMPDIR)
-	$(QUIET) javac $(GLOBAL_JAVACFLAGS) $$($(1)_JAVACFLAGS) -d $$($(1)_TMPDIR) $$($(1)_SOURCES)
-	$(QUIET) jar cf $$($(1)_PATH) -C $$($(1)_TMPDIR) .
+	$$(trace-javac) javac $(GLOBAL_JAVACFLAGS) $$($(1)_JAVACFLAGS) -d $$($(1)_TMPDIR) $$($(1)_SOURCES)
+	$$(trace-jar) jar cf $$($(1)_PATH) -C $$($(1)_TMPDIR) .
 	@rm -rf $$($(1)_TMPDIR)
 
   $(1)_INSTALL_DIR ?= $$(libdir)/java
diff --git a/lib.mk b/lib.mk
index 5b0d2633cce4..8894d5308b8a 100644
--- a/lib.mk
+++ b/lib.mk
@@ -6,7 +6,6 @@ default: all
 
 
 # Initialise some variables.
-QUIET = @
 bin_SCRIPTS :=
 noinst_SCRIPTS :=
 OS = $(shell uname -s)
@@ -49,6 +48,7 @@ endif
 rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
 
 
+include mk/tracing.mk
 include mk/clean.mk
 include mk/dist.mk
 include mk/install.mk
diff --git a/libraries.mk b/libraries.mk
index 818c3d2172a1..1e0fe49a53ef 100644
--- a/libraries.mk
+++ b/libraries.mk
@@ -65,7 +65,7 @@ define build-library =
     $(1)_PATH := $$(_d)/$$($(1)_NAME).$(SO_EXT)
 
     $$($(1)_PATH): $$($(1)_OBJS) $$(_libs)
-	$(QUIET) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
+	$$(trace-ld) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
 
     $(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
 
@@ -76,7 +76,7 @@ define build-library =
     $$(eval $$(call create-dir,$$($(1)_INSTALL_DIR)))
 
     $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $$($(1)_INSTALL_DIR)
-	$(QUIET) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
+	$$(trace-ld) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
 
     $(1)_LDFLAGS_USE_INSTALLED += -L$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
 
@@ -89,7 +89,7 @@ define build-library =
     $(1)_PATH := $$(_d)/$$($(1)_NAME).a
 
     $$($(1)_PATH): $$($(1)_OBJS)
-	$(QUIET) ar crs $$@ $$?
+	$(trace-ar) ar crs $$@ $$?
 
     $(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)
 
diff --git a/patterns.mk b/patterns.mk
index 77e17213613d..91a758f3389d 100644
--- a/patterns.mk
+++ b/patterns.mk
@@ -1,8 +1,8 @@
 %.o: %.cc
-	$(QUIET) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(basename $@).dep -MP
+	$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(basename $@).dep -MP
 
 %.o: %.cpp
-	$(QUIET) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(basename $@).dep -MP
+	$(trace-cxx) $(CXX) -o $@ -c $< $(GLOBAL_CXXFLAGS) $(CXXFLAGS) $($@_CXXFLAGS) -MMD -MF $(basename $@).dep -MP
 
 %.o: %.c
-	$(QUIET) $(CC) -o $@ -c $< $(GLOBAL_CFLAGS) $(CFLAGS) $($@_CFLAGS) -MMD -MF $(basename $@).dep -MP
+	$(trace-cc) $(CC) -o $@ -c $< $(GLOBAL_CFLAGS) $(CFLAGS) $($@_CFLAGS) -MMD -MF $(basename $@).dep -MP
diff --git a/programs.mk b/programs.mk
index a97a51635264..c608a6f25aa4 100644
--- a/programs.mk
+++ b/programs.mk
@@ -23,7 +23,7 @@ define build-program =
   $(1)_PATH := $$(_d)/$(1)
 
   $$($(1)_PATH): $$($(1)_OBJS) $$(_libs)
-	$(QUIET) $(CXX) -o $$@ $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
+	$$(trace-ld) $(CXX) -o $$@ $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
 
   $(1)_INSTALL_DIR ?= $$(bindir)
   $(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$(1)
@@ -37,7 +37,7 @@ define build-program =
     _libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH))
 
     $$($(1)_INSTALL_PATH): $$($(1)_OBJS) $$(_libs_final) | $$($(1)_INSTALL_DIR)
-	$(QUIET) $(CXX) -o $$@ $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
+	$$(trace-ld) $(CXX) -o $$@ $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
 
   else
 
diff --git a/templates.mk b/templates.mk
index 01b9d9d749a1..82f9d6025557 100644
--- a/templates.mk
+++ b/templates.mk
@@ -9,4 +9,4 @@ define instantiate-template =
 endef
 
 %: %.in
-	$(QUIET) ./config.status --quiet --file $@
+	$(trace-gen) ./config.status --quiet --file $@
diff --git a/tracing.mk b/tracing.mk
new file mode 100644
index 000000000000..08c4ec106656
--- /dev/null
+++ b/tracing.mk
@@ -0,0 +1,16 @@
+V ?= 0
+
+ifeq ($(V), 0)
+
+  trace-gen     = @echo "  GEN   " $@;
+  trace-cc      = @echo "  CC    " $@;
+  trace-cxx     = @echo "  CXX   " $@;
+  trace-ld      = @echo "  LD    " $@;
+  trace-ar      = @echo "  AR    " $@;
+  trace-install = @echo "  INST  " $@;
+  trace-javac   = @echo "  JAVAC " $@;
+  trace-jar     = @echo "  JAR   " $@;
+
+  suppress  = @
+
+endif