[x264-devel] [PATCH 1/2] Add FFmpeg-style silent build rules
Stephen Hutchinson
qyot27 at gmail.com
Fri Apr 4 15:41:53 CEST 2014
Similar to autotools, the V variable can be passed directly to
make in order to enable or disable the silent rules. V=0 (the
default) turns them on, anything other than zero turns them off.
The --verbose-build-rules option has been added for those that
want to disable them through configure instead.
---
Makefile | 24 ++++++++++++++++++++++--
configure | 14 ++++++++++++++
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index a2bc0dc..487af1c 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,18 @@
include config.mak
+# Silent make rules, adapted from FFmpeg's common.mak
+ifeq ($(V), 0)
+ECHO = printf "$(1)\t%s\n" $(2)
+BRIEF = CC AS YASM AR LD STRIP CP RC RANLIB
+
+MSG = $@
+M = @$(call ECHO,$(TAG),$@);
+$(foreach VAR,$(BRIEF), \
+ $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
+endif
+# End of main silent make rules definition
+
vpath %.c $(SRCPATH)
vpath %.h $(SRCPATH)
vpath %.S $(SRCPATH)
@@ -199,9 +211,17 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK): .depend
%.o: %.rc x264.h
$(RC) $(RCFLAGS)$@ $<
+# Force a newline after generating each .depend, or else we get spammed with
+# '@printf: not found' errors when the silent build rules are enabled. The
+# define is necessary in order to actually use typical newline \n notation.
+define \n
+
+
+endef
+
.depend: config.mak
@rm -f .depend
- @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;)
+ @$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO)), $(CC_SILENT) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;${\n})
config.mak:
./configure
@@ -259,7 +279,7 @@ install-lib-dev:
install-lib-static: lib-static install-lib-dev
$(INSTALL) -m 644 $(LIBX264) $(DESTDIR)$(libdir)
- $(if $(RANLIB), $(RANLIB) $(DESTDIR)$(libdir)/$(LIBX264))
+ $(if $(RANLIB), $(RANLIB_VERBOSE) $(DESTDIR)$(libdir)/$(LIBX264))
install-lib-shared: lib-shared install-lib-dev
ifneq ($(IMPLIBNAME),)
diff --git a/configure b/configure
index 5401753..606fa65 100755
--- a/configure
+++ b/configure
@@ -39,6 +39,7 @@ Advanced options:
--enable-gprof add -pg
--enable-strip add -s
--enable-pic build position-independent code
+ --verbose-build-rules disables silent build rules
Cross-compilation:
--host=HOST build programs to run on HOST
@@ -275,6 +276,7 @@ debug="no"
gprof="no"
strip="no"
pic="no"
+verbose="no"
bit_depth="8"
chroma_format="all"
compiler="GNU"
@@ -385,6 +387,9 @@ for opt do
--enable-pic)
pic="yes"
;;
+ --verbose-build-rules)
+ verbose="yes"
+ ;;
--host=*)
host="$optarg"
;;
@@ -1000,6 +1005,12 @@ if [ "$pic" = "yes" ] ; then
[ $SYS = SunOS -a "$ARCH" = "X86" ] && SOFLAGS="$SOFLAGS -mimpure-text"
fi
+if [ "$verbose" = "yes" ] ; then
+ V=1
+else
+ V=0
+fi
+
if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
CFLAGS="$CFLAGS -fomit-frame-pointer"
fi
@@ -1156,6 +1167,7 @@ includedir=$includedir
ARCH=$ARCH
SYS=$SYS
CC=$CC
+CC_SILENT=$CC
CFLAGS=$CFLAGS
DEPMM=$DEPMM
DEPMT=$DEPMT
@@ -1164,6 +1176,7 @@ LDFLAGS=$LDFLAGS
LIBX264=$LIBX264
AR=$AR
RANLIB=$RANLIB
+RANLIB_VERBOSE=$RANLIB
STRIP=$STRIP
INSTALL=$INSTALL
AS=$AS
@@ -1178,6 +1191,7 @@ PROF_GEN_LD=$PROF_GEN_LD
PROF_USE_CC=$PROF_USE_CC
PROF_USE_LD=$PROF_USE_LD
HAVE_OPENCL=$opencl
+V=$V
EOF
if [ $compiler = ICL ]; then
--
1.8.3.2
More information about the x264-devel
mailing list