From 93b6a5727b6ceeecf4d0ce19b35168e35fceab32 Mon Sep 17 00:00:00 2001
From: Alain <carpikemail@gmail.com>
Date: Sat, 28 Nov 2015 16:43:30 +0100
Subject: [PATCH] Compiler output beautified

Signed-off-by: Terraneo Federico <fede.tft@miosix.org>
---
 Makefile        | 21 ++++++++++++++++-----
 miosix/Makefile | 23 ++++++++++++++++++-----
 2 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 4fd8d5a1..80b90568 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,14 @@ KPATH := miosix
 CONFPATH := $(KPATH)
 include $(CONFPATH)/config/Makefile.inc
 
+ifeq ("$(BUILD_VERBOSE)","1")
+Q := @
+ECHO := @echo
+else
+Q := 
+ECHO := @true
+endif
+
 ##
 ## List here subdirectories which contains makefiles
 ##
@@ -79,17 +87,20 @@ main: main.elf
 	$(SZ) main.elf
 
 main.elf: $(OBJ) all-recursive
-	@ echo "linking"
-	$(CXX) $(LFLAGS) -o main.elf $(OBJ) $(KPATH)/$(BOOT_FILE) $(LINK_LIBS)
+	$(ECHO) "[LD]   main.elf"
+	$(Q)$(CXX) $(LFLAGS) -o main.elf $(OBJ) $(KPATH)/$(BOOT_FILE) $(LINK_LIBS)
 
 %.o: %.s
-	$(AS)  $(AFLAGS) $< -o $@
+	$(ECHO) "[AS]   $<" 
+	$(Q)$(AS)  $(AFLAGS) $< -o $@
 
 %.o : %.c
-	$(CC)  $(DFLAGS) $(CFLAGS) $< -o $@
+	$(ECHO) "[CC]   $<" 
+	$(Q)$(CC)  $(DFLAGS) $(CFLAGS) $< -o $@
 
 %.o : %.cpp
-	$(CXX) $(DFLAGS) $(CXXFLAGS) $< -o $@
+	$(ECHO) "[CXX]  $<" 
+	$(Q)$(CXX) $(DFLAGS) $(CXXFLAGS) $< -o $@
 
 #pull in dependecy info for existing .o files
 -include $(OBJ:.o=.d)
diff --git a/miosix/Makefile b/miosix/Makefile
index 811c16d8..6156fa0c 100644
--- a/miosix/Makefile
+++ b/miosix/Makefile
@@ -6,6 +6,14 @@ MAKEFILE_VERSION := 1.06
 ## KPATH and CONFPATH are forwarded by the parent Makefile
 include $(CONFPATH)/config/Makefile.inc
 
+ifeq ("$(BUILD_VERBOSE)","1")
+Q :=
+ECHO := @true
+else
+Q := @
+ECHO := @echo
+endif
+
 ## List of all Miosix OS source files that have no special requirements
 ## and that must be built for each architecture (both .c and .cpp)
 ## These files will end up in libmiosix.a
@@ -64,21 +72,26 @@ DFLAGS    := -MMD -MP
 ## The file stage_1_boot.o is compiled separately because
 ## it must not end up in libmiosix.a
 all: $(OBJ) $(BOOT_FILE)
-	perl _tools/check_global_objects.pl $(OBJ)
-	$(AR) rcs libmiosix.a $(OBJ)
+	$(ECHO) "[PERL] Checking global objects"
+	$(Q)perl _tools/check_global_objects.pl $(OBJ)
+	$(ECHO) "[AR]   libmiosix.a"
+	$(Q)$(AR) rcs libmiosix.a $(OBJ)
 
 clean:
 	-rm -f $(OBJ) $(BOOT_FILE) libmiosix.a $(OBJ:.o=.d)
 	-rm -f $(BOOT_FILE:.o=.d)
 
 %.o: %.s
-	$(AS)  $(AFLAGS) $< -o $@
+	$(ECHO) "[AS]   $<"
+	$(Q)$(AS)  $(AFLAGS) $< -o $@
 
 %.o : %.c
-	$(CC)  $(DFLAGS) $(CFLAGS) $< -o $@
+	$(ECHO) "[CC]   $<"
+	$(Q)$(CC)  $(DFLAGS) $(CFLAGS) $< -o $@
 
 %.o : %.cpp
-	$(CXX) $(DFLAGS) $(CXXFLAGS) $< -o $@
+	$(ECHO) "[CXX]  $<"
+	$(Q)$(CXX) $(DFLAGS) $(CXXFLAGS) $< -o $@
 
 #pull in dependecy info for existing .o files
 -include $(OBJ:.o=.d)
-- 
GitLab