shithub: openh264

Download patch

ref: a164436d9801ac13f604e788adba9b59b611b56d
parent: 977768ac880deaa63c43998a84d0b0f68651f67e
author: Martin Storsjö <[email protected]>
date: Thu Jan 23 10:16:29 EST 2014

Automatically track per-file dependencies

This is enabled for platforms/compilers that support the -MMD
option, which creates a dependency file named out.d when compiling
to a file named out.o, only including local, not system headers.

The additional -MP option adds phony targets for all included
headers, to avoid having make error out due to "no rule to make
target foo.h" if a header is renamed/removed.

This makes sure that all the right files are rebuilt if a header
is changed, avoiding the need for a full rebuild if only a few
files are affected.

--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@
 *.o
 *.ko
 
+# Dependency files
+*.d
+
 # Libraries
 *.lib
 *.a
--- a/Makefile
+++ b/Makefile
@@ -94,7 +94,7 @@
 all:	libraries binaries
 
 clean:
-	rm -f $(OBJS) $(LIBRARIES) $(BINARIES)
+	rm -f $(OBJS) $(OBJS:.o=.d) $(LIBRARIES) $(BINARIES)
 
 gtest-bootstrap:
 	svn co https://googletest.googlecode.com/svn/trunk/ gtest
@@ -119,3 +119,5 @@
 include build/gtest-targets.mk
 include test/targets.mk
 endif
+
+-include $(OBJS:.o=.d)
--- a/build/platform-darwin.mk
+++ b/build/platform-darwin.mk
@@ -1,6 +1,6 @@
 
 ASM = nasm
-CFLAGS += -Wno-deprecated-declarations -Werror -fPIC -DMACOS -DMT_ENABLED
+CFLAGS += -Wno-deprecated-declarations -Werror -fPIC -DMACOS -DMT_ENABLED -MMD -MP
 LDFLAGS += -lpthread
 ASMFLAGS += --prefix _ -DNOPREFIX
 ifeq ($(ENABLE64BIT), Yes)
--- a/build/platform-linux.mk
+++ b/build/platform-linux.mk
@@ -1,5 +1,5 @@
 ASM = nasm
-CFLAGS += -Werror -fPIC -DLINUX -DMT_ENABLED
+CFLAGS += -Werror -fPIC -DLINUX -DMT_ENABLED -MMD -MP
 LDFLAGS += -lpthread
 ASMFLAGS += -DNOPREFIX
 ifeq ($(ENABLE64BIT), Yes)
--- a/build/platform-mingw_nt.mk
+++ b/build/platform-mingw_nt.mk
@@ -1,5 +1,5 @@
 ASM = nasm
-CFLAGS += -DMT_ENABLED
+CFLAGS += -DMT_ENABLED -MMD -MP
 LDFLAGS +=
 ifeq ($(ENABLE64BIT), Yes)
 ASMFLAGS += -f win64