From ca73c0102fc68ece171d7cc062e464b4d418d07c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Jan 2014 22:31:38 +0100 Subject: [PATCH] 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 --- clean.mk | 2 +- dist.mk | 2 +- install.mk | 6 +++--- jars.mk | 4 ++-- lib.mk | 2 +- libraries.mk | 6 +++--- patterns.mk | 6 +++--- programs.mk | 4 ++-- templates.mk | 2 +- tracing.mk | 16 ++++++++++++++++ 10 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 tracing.mk diff --git a/clean.mk b/clean.mk index 7dba76c5d..f45d578aa 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 444c58b3f..bf97b697f 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 c5eb8eb37..aee4bf38b 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 5d459c0a9..c8075cde1 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 5b0d2633c..8894d5308 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 818c3d217..1e0fe49a5 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 77e172136..91a758f33 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 a97a51635..c608a6f25 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 01b9d9d74..82f9d6025 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 000000000..08c4ec106 --- /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