[kvm-unit-tests PATCH 3/4] build: Make build output pretty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Unless make V=1 is specified, silence make recipe echoing and print
an abbreviated line for major build steps.

Signed-off-by: Nicholas Piggin <npiggin@xxxxxxxxx>
---
 Makefile                | 14 ++++++++++++++
 arm/Makefile.common     |  7 +++++++
 powerpc/Makefile.common | 11 +++++++----
 riscv/Makefile          |  5 +++++
 s390x/Makefile          | 18 +++++++++++++++++-
 scripts/mkstandalone.sh |  2 +-
 x86/Makefile.common     |  5 +++++
 7 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 5b7998b79..cbb2fdbf1 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,11 @@ include config.mak
 # Set search path for all sources
 VPATH = $(SRCDIR)
 
+V=0
+ifeq ($V, 0)
+.SILENT:
+endif
+
 libdirs-get = $(shell [ -d "lib/$(1)" ] && echo "lib/$(1) lib/$(1)/asm")
 ARCH_LIBDIRS := $(call libdirs-get,$(ARCH_LIBDIR)) $(call libdirs-get,$(TEST_DIR))
 OBJDIRS := $(ARCH_LIBDIRS)
@@ -95,11 +100,13 @@ autodepend-flags = -MMD -MP -MF $(dir $*).$(notdir $*).d
 LDFLAGS += -nostdlib $(no_pie) -z noexecstack
 
 $(libcflat): $(cflatobjs)
+	@echo " [AR]      $@"
 	$(AR) rcs $@ $^
 
 include $(LIBFDT_srcdir)/Makefile.libfdt
 $(LIBFDT_archive): CFLAGS += -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt -Wno-sign-compare
 $(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
+	@echo " [AR]      $@"
 	$(AR) rcs $@ $^
 
 libfdt_clean: VECHO = echo " "
@@ -112,7 +119,12 @@ libfdt_clean: SHAREDLIB_EXT = so
 directories:
 	@mkdir -p $(OBJDIRS)
 
+%.o: %.c
+	@echo " [CC]      $@"
+	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
+
 %.o: %.S
+	@echo " [AS]      $@"
 	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
 
 -include */.*.d */*/.*.d
@@ -123,6 +135,7 @@ standalone: all
 	@scripts/mkstandalone.sh
 
 install: standalone
+	@echo " [INSTALL] tests -> $(DESTDIR)"
 	mkdir -p $(DESTDIR)
 	install tests/* $(DESTDIR)
 
@@ -136,6 +149,7 @@ distclean: clean
 
 cscope: cscope_dirs = lib lib/libfdt lib/linux $(TEST_DIR) $(ARCH_LIBDIRS) lib/asm-generic
 cscope:
+	@echo " [CSCOPE]"
 	$(RM) ./cscope.*
 	find -L $(cscope_dirs) -maxdepth 1 \
 		-name '*.[chsS]' -exec realpath --relative-base=$(CURDIR) {} \; | sort -u > ./cscope.files
diff --git a/arm/Makefile.common b/arm/Makefile.common
index f828dbe01..9d6b31239 100644
--- a/arm/Makefile.common
+++ b/arm/Makefile.common
@@ -73,15 +73,18 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libeabi)
 
 ifeq ($(CONFIG_EFI),y)
 %.aux.o: $(SRCDIR)/lib/auxinfo.c
+	@echo " [CC]      $@"
 	$(CC) $(CFLAGS) -c -o $@ $< \
 		-DPROGNAME=\"$(@:.aux.o=.efi)\" -DAUXFLAGS=$(AUXFLAGS)
 
 %.so: EFI_LDFLAGS += -defsym=EFI_SUBSYSTEM=0xa --no-undefined
 %.so: %.o $(FLATLIBS) $(SRCDIR)/arm/efi/elf_aarch64_efi.lds $(cstart.o) %.aux.o
+	@echo " [LD]      $@"
 	$(LD) $(EFI_LDFLAGS) -o $@ -T $(SRCDIR)/arm/efi/elf_aarch64_efi.lds \
 		$(filter %.o, $^) $(FLATLIBS) $(EFI_LIBS)
 
 %.efi: %.so
+	@echo " [OBJCOPY] $@"
 	$(call arch_elf_check, $^)
 	$(OBJCOPY) --only-keep-debug $^ $@.debug
 	$(OBJCOPY) --strip-debug $^
@@ -93,22 +96,26 @@ ifeq ($(CONFIG_EFI),y)
 		-O binary $^ $@
 else
 %.aux.o: $(SRCDIR)/lib/auxinfo.c
+	@echo " [CC]      $@"
 	$(CC) $(CFLAGS) -c -o $@ $< \
 		-DPROGNAME=\"$(@:.aux.o=.flat)\" -DAUXFLAGS=$(AUXFLAGS)
 
 %.elf: LDFLAGS += $(arch_LDFLAGS)
 %.elf: %.o $(FLATLIBS) $(SRCDIR)/arm/flat.lds $(cstart.o) %.aux.o
+	@echo " [LD]      $@"
 	$(LD) $(LDFLAGS) -o $@ -T $(SRCDIR)/arm/flat.lds \
 		$(filter %.o, $^) $(FLATLIBS)
 	@chmod a-x $@
 
 %.flat: %.elf
+	@echo " [OBJCOPY] $@"
 	$(call arch_elf_check, $^)
 	$(OBJCOPY) -O binary $^ $@
 	@chmod a-x $@
 endif
 
 $(libeabi): $(eabiobjs)
+	@echo " [AR]      $@"
 	$(AR) rcs $@ $^
 
 arm_clean: asm_offsets_clean
diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
index 68165fc25..b0af9fc00 100644
--- a/powerpc/Makefile.common
+++ b/powerpc/Makefile.common
@@ -51,31 +51,34 @@ cflatobjs += lib/powerpc/smp.o
 OBJDIRS += lib/powerpc
 
 %.aux.o: $(SRCDIR)/lib/auxinfo.c
+	@echo " [LD]      $@"
 	$(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\"
 
 FLATLIBS = $(libcflat) $(LIBFDT_archive)
 %.elf: CFLAGS += $(arch_CFLAGS)
 %.elf: LDFLAGS += $(arch_LDFLAGS) -pie -n
 %.elf: %.o $(FLATLIBS) $(SRCDIR)/powerpc/flat.lds $(cstart.o) $(reloc.o) %.aux.o
+	@echo " [LD]      $@"
 	$(LD) $(LDFLAGS) -o $@ \
 		-T $(SRCDIR)/powerpc/flat.lds --build-id=none \
 		$(filter %.o, $^) $(FLATLIBS)
 	@chmod a-x $@
-	@echo -n Checking $@ for unsupported reloc types...
 	@if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then	\
+		@echo "Unsupported reloc types in $@"			\
 		false;							\
-	else								\
-		echo " looks good.";					\
 	fi
 
 $(TEST_DIR)/boot_rom.bin: $(TEST_DIR)/boot_rom.elf
-	dd if=/dev/zero of=$@ bs=256 count=1
+	@echo " [DD]      $@"
+	dd if=/dev/zero of=$@ bs=256 count=1 status=none
+	@echo " [OBJCOPY] $@"
 	$(OBJCOPY) -O binary $^ $@.tmp
 	cat $@.tmp >> $@
 	$(RM) $@.tmp
 
 $(TEST_DIR)/boot_rom.elf: CFLAGS = -mbig-endian
 $(TEST_DIR)/boot_rom.elf: $(TEST_DIR)/boot_rom.o
+	@echo " [LD]      $@"
 	$(LD) -EB -nostdlib -Ttext=0x100 --entry=start --build-id=none -o $@ $<
 	@chmod a-x $@
 
diff --git a/riscv/Makefile b/riscv/Makefile
index 919a3ebb5..ca33d4960 100644
--- a/riscv/Makefile
+++ b/riscv/Makefile
@@ -82,6 +82,7 @@ asm-offsets = lib/riscv/asm-offsets.h
 include $(SRCDIR)/scripts/asm-offsets.mak
 
 %.aux.o: $(SRCDIR)/lib/auxinfo.c
+	@echo " [CC]      $@"
 	$(CC) $(CFLAGS) -c -o $@ $< \
 		-DPROGNAME=\"$(notdir $(@:.aux.o=.$(exe)))\" -DAUXFLAGS=$(AUXFLAGS)
 
@@ -96,10 +97,12 @@ cflatobjs += lib/efi.o
 
 %.so: EFI_LDFLAGS += -defsym=EFI_SUBSYSTEM=0xa --no-undefined
 %.so: %.o $(FLATLIBS) $(SRCDIR)/riscv/efi/elf_riscv64_efi.lds $(cstart.o) %.aux.o
+	@echo " [LD]      $@"
 	$(LD) $(EFI_LDFLAGS) -o $@ -T $(SRCDIR)/riscv/efi/elf_riscv64_efi.lds \
 		$(filter %.o, $^) $(FLATLIBS) $(EFI_LIBS)
 
 %.efi: %.so
+	@echo " [OBJCOPY] $@"
 	$(call arch_elf_check, $^)
 	$(OBJCOPY) --only-keep-debug $^ $@.debug
 	$(OBJCOPY) --strip-debug $^
@@ -112,11 +115,13 @@ cflatobjs += lib/efi.o
 else
 %.elf: LDFLAGS += -pie -n -z notext
 %.elf: %.o $(FLATLIBS) $(SRCDIR)/riscv/flat.lds $(cstart.o) %.aux.o
+	@echo " [LD]      $@"
 	$(LD) $(LDFLAGS) -o $@ -T $(SRCDIR)/riscv/flat.lds \
 		$(filter %.o, $^) $(FLATLIBS)
 	@chmod a-x $@
 
 %.flat: %.elf
+	@echo " [OBJCOPY] $@"
 	$(call arch_elf_check, $^)
 	$(OBJCOPY) -O binary $^ $@
 	@chmod a-x $@
diff --git a/s390x/Makefile b/s390x/Makefile
index 8603a523c..19c41a2ec 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -148,42 +148,54 @@ endif
 
 # the asm/c snippets %.o have additional generated files as dependencies
 $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets)
+	@echo " [CC]      $@"
 	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
 
 $(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets)
+	@echo " [CC]      $@"
 	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
 
 $(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SNIPPET_DIR)/asm/flat.lds
+	@echo " [LD]      $@"
 	$(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/asm/flat.lds $<
+	@echo " [OBJCOPY] $@"
 	$(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@
 	truncate -s '%4096' $@
 
 $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SNIPPET_DIR)/c/flat.lds
+	@echo " [LD]      $@"
 	$(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/c/flat.lds $< $(snippet_lib) $(FLATLIBS)
+	@echo " [OBJCOPY] $@"
 	$(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@
 	truncate -s '%4096' $@
 
 %.hdr: %.gbin $(HOST_KEY_DOCUMENT)
+	@echo " [SEHDR  ] $@"
 	$(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@
 
 .SECONDARY:
 %.gobj: %.gbin
+	@echo " [OBJCOPY] $@"
 	$(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@
 
 .SECONDARY:
 %.hdr.obj: %.hdr
+	@echo " [OBJCOPY] $@"
 	$(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@
 
 lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@
 %.lds: %.lds.S $(asm-offsets)
+	@echo " [CPP]     $@"
 	$(CPP) $(lds-autodepend-flags) $(CPPFLAGS) -P -C -o $@ $<
 
 %.aux.o: $(SRCDIR)/lib/auxinfo.c
+	@echo " [CC]      $@"
 	$(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\"
 
 .SECONDEXPANSION:
 %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
-	@$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \
+	@echo " [CC]      $@"
+	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \
 		$(filter %.o, $^) $(FLATLIBS) $(snippets-obj) $(snippet-hdr-obj) || \
 		{ echo "Failure probably caused by missing definition of gen-se-header executable"; exit 1; }
 	@chmod a-x $@
@@ -192,9 +204,11 @@ lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@
 # 32 bytes of key material, uses existing one if available
 comm-key = $(TEST_DIR)/comm.key
 $(comm-key):
+	@echo " [DD]      $@"
 	dd if=/dev/urandom of=$@ bs=32 count=1 status=none
 
 %.bin: %.elf
+	@echo " [OBJCOPY] $@"
 	$(OBJCOPY) -O binary  $< $@
 
 # The genprotimg arguments for the cck changed over time so we need to
@@ -216,10 +230,12 @@ endif
 
 $(patsubst %.parmfile,%.pv.bin,$(wildcard s390x/*.parmfile)): %.pv.bin: %.parmfile
 %.pv.bin: %.bin $(HOST_KEY_DOCUMENT) $(comm-key)
+	@echo " [GENPROT] $@"
 	$(eval parmfile_args = $(if $(filter %.parmfile,$^),--parmfile $(filter %.parmfile,$^),))
 	$(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify $(GENPROTIMG_COMM_OPTION) $(comm-key) --x-pcf $(GENPROTIMG_PCF) $(parmfile_args) --image $(filter %.bin,$^) -o $@
 
 $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets)
+	@echo " [CC]      $@"
 	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
 
 
diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 2318a85f0..3307c25b1 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -94,7 +94,7 @@ function mkstandalone()
 	generate_test "$@" > $standalone
 
 	chmod +x $standalone
-	echo Written $standalone.
+	echo " [WRITE]   $standalone"
 }
 
 if [ "$ENVIRON_DEFAULT" = "yes" ] && [ "$ERRATATXT" ] && [ ! -f "$ERRATATXT" ]; then
diff --git a/x86/Makefile.common b/x86/Makefile.common
index 4ae9a5579..96fb0660c 100644
--- a/x86/Makefile.common
+++ b/x86/Makefile.common
@@ -49,11 +49,13 @@ ifeq ($(CONFIG_EFI),y)
 .PRECIOUS: %.efi %.so
 
 %.so: %.o $(FLATLIBS) $(SRCDIR)/x86/efi/elf_x86_64_efi.lds $(cstart.o)
+	@echo " [LD]      $@"
 	$(LD) -T $(SRCDIR)/x86/efi/elf_x86_64_efi.lds $(EFI_LDFLAGS) -o $@ \
 		$(filter %.o, $^) $(FLATLIBS)
 	@chmod a-x $@
 
 %.efi: %.so
+	@echo " [OBJCOPY] $@"
 	$(OBJCOPY) --only-keep-debug $^ $@.debug
 	$(OBJCOPY) --strip-debug $^
 	$(OBJCOPY) --add-gnu-debuglink=$@.debug $^
@@ -67,11 +69,13 @@ else
 
 %.elf: LDFLAGS += $(arch_LDFLAGS)
 %.elf: %.o $(FLATLIBS) $(SRCDIR)/x86/flat.lds $(cstart.o)
+	@echo " [LD]      $@"
 	$(LD) $(LDFLAGS) -T $(SRCDIR)/x86/flat.lds -o $@ \
 		$(filter %.o, $^) $(FLATLIBS)
 	@chmod a-x $@
 
 %.flat: %.elf
+	@echo " [OBJCOPY] $@"
 	$(OBJCOPY) -O elf32-i386 $^ $@
 	@chmod a-x $@
 endif
@@ -104,6 +108,7 @@ test_cases: $(tests-common) $(tests)
 $(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I $(SRCDIR)/lib -I $(SRCDIR)/lib/x86 -I lib
 
 $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o
+	@echo " [LD]      $@"
 	$(LD) -m elf_i386 -nostdlib -o $@ \
 	      -T $(SRCDIR)/$(TEST_DIR)/realmode.lds $^
 
-- 
2.43.0





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux