Web lists-archives.org

[MPlayer-dev-eng] [PATCH] shorten make output




Hi,

this patch makes build output much shorter and, IMO, more pleasant to the eye. 
Instead of long gcc command lines only 'CC filename' or 'LINK filename' is 
printed. The idea and the implementation are taken from linux kernel build 
system. It can be turned off with 'make V=1'.

As I mentioned on -cvslog, with the latest changes to the build system, the 
last linking command takes almost 3 screens on my monitor, and it becomes 
tiresome to scroll back and check for warnings all the time. With this patch, 
the warnings are much more noticable. Even better, there is more motivation 
to fix them, because the output then becomes even more beautiful.

The patch is slightly incomplete, it only hides the most popular build 
commands. It can be finished in no time, but I wanted to here the opinion of 
other developers first.
diff --git a/Makefile b/Makefile
index d5a11d9..e75a8d2 100644
--- a/Makefile
+++ b/Makefile
@@ -698,22 +698,56 @@ PARTS = libavcodec \
 
 ###### generic rules #######
 
+quiet = QUIET_
+Q = @
+ifeq ($(V),1)
+  quiet =
+  Q =
+endif
+
 all: $(ALL_PRG)
 
+QUIET_CMD_DEPEND = "  DEPEND  $@"
+      CMD_DEPEND = $(MPDEPEND_CMD) > $@
+
+QUIET_CMD_DEPEND_CXX = "  DEPEND  $@"
+      CMD_DEPEND_CXX = $(MPDEPEND_CMD_CXX) > $@
+
+QUIET_CMD_CC = "  CC      $@"
+      CMD_CC = $(CC) $(CFLAGS) -c -o $@ $<
+
+QUIET_CMD_CC_H = "  CC(H)   $@"
+      CMD_CC_H = $(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
+
+QUIET_CMD_LINK_MP = "  LINK    $@"
+      CMD_LINK_MP = $(CC) -o $@ $^ $(LDFLAGS_MPLAYER)
+
+QUIET_CMD_LINK_ME = "  LINK    $@"
+      CMD_LINK_ME = $(CC) -o $@ $^ $(LDFLAGS_MENCODER)
+
 %.d: %.c
-	$(MPDEPEND_CMD) > $@
+	$(Q)echo $($(quiet)CMD_DEPEND)
+	$(Q)$(CMD_DEPEND)
 
 %.d: %.cpp
-	$(MPDEPEND_CMD_CXX) > $@
+	$(Q)echo $($(quiet)CMD_DEPEND_CXX)
+	$(Q)$(CMD_DEPEND_CXX)
 
 %.d: %.m
-	$(MPDEPEND_CMD) > $@
+	$(Q)echo $($(quiet)CMD_DEPEND)
+	$(Q)$(CMD_DEPEND)
+
+%.o: %.c
+	$(Q)echo $($(quiet)CMD_CC)
+	$(Q)$(CMD_CC)
 
 %.o: %.m
-	$(CC) $(CFLAGS) -c -o $@ $<
+	$(Q)echo $($(quiet)CMD_CC)
+	$(Q)$(CMD_CC)
 
 %.ho: %.h
-	$(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
+	$(Q)echo $($(quiet)CMD_CC_H)
+	$(Q)$(CMD_CC_H)
 
 ALLHEADERS = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.h))
 checkheaders: $(ALLHEADERS:.h=.ho)
@@ -729,10 +763,12 @@ endef
 $(foreach part,$(PARTS),$(eval $(RECURSIVE_RULE)))
 
 mplayer$(EXESUF): $(MPLAYER_DEPS)
-	$(CC) -o $@ $^ $(LDFLAGS_MPLAYER)
+	$(Q)echo $($(quiet)CMD_LINK_MP)
+	$(Q)$(CMD_LINK_MP)
 
 mencoder$(EXESUF): $(MENCODER_DEPS)
-	$(CC) -o $@ $^ $(LDFLAGS_MENCODER)
+	$(Q)echo $($(quiet)CMD_LINK_ME)
+	$(Q)$(CMD_LINK_ME)
 
 codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h
 	$(HOST_CC) -O -I. -DCODECS2HTML $< -o $@
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng