Created
March 1, 2014 23:40
-
-
Save qyot27/9299420 to your computer and use it in GitHub Desktop.
x264-0001-Add-FFmpeg-style-silent-build-rules.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 5bbf876bd857beb0b9f7795bea5f93f04cdee15d Mon Sep 17 00:00:00 2001 | |
From: Stephen Hutchinson <[email protected]> | |
Date: Sat, 4 Aug 2012 12:23:18 -0400 | |
Subject: [PATCH 1/2] Add FFmpeg-style silent build rules | |
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 | 27 ++++++++++++++++++++++++--- | |
configure | 14 ++++++++++++++ | |
2 files changed, 38 insertions(+), 3 deletions(-) | |
diff --git a/Makefile b/Makefile | |
index a2bc0dc..3bac43d 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -2,6 +2,19 @@ | |
include config.mak | |
+# Silent make rules, adapted from FFmpeg's common.mak | |
+ifeq ($(V), 0) | |
+ECHO = printf "$(1)\t%s\n" $(2) | |
+BRIEF = CC HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES RANLIB | |
+ | |
+MSG = $@ | |
+M = @$(call ECHO,$(TAG),$@); | |
+$(foreach VAR,$(BRIEF), \ | |
+ $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR)))) | |
+$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR)))) | |
+endif | |
+# End of main silent make rules definition | |
+ | |
vpath %.c $(SRCPATH) | |
vpath %.h $(SRCPATH) | |
vpath %.S $(SRCPATH) | |
@@ -164,7 +177,7 @@ lib-static: $(LIBX264) | |
lib-shared: $(SONAME) | |
$(LIBX264): $(GENERATED) .depend $(OBJS) $(OBJASM) | |
- rm -f $(LIBX264) | |
+ @rm -f $(LIBX264) | |
$(AR)$@ $(OBJS) $(OBJASM) | |
$(if $(RANLIB), $(RANLIB) $@) | |
@@ -199,9 +212,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 +280,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 0177cfc..3c5b883 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" | |
;; | |
@@ -993,6 +998,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 | |
@@ -1149,6 +1160,7 @@ includedir=$includedir | |
ARCH=$ARCH | |
SYS=$SYS | |
CC=$CC | |
+CC_SILENT=$CC | |
CFLAGS=$CFLAGS | |
DEPMM=$DEPMM | |
DEPMT=$DEPMT | |
@@ -1157,6 +1169,7 @@ LDFLAGS=$LDFLAGS | |
LIBX264=$LIBX264 | |
AR=$AR | |
RANLIB=$RANLIB | |
+RANLIB_VERBOSE=$RANLIB | |
STRIP=$STRIP | |
INSTALL=$INSTALL | |
AS=$AS | |
@@ -1171,6 +1184,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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment