aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2008-06-19 16:57:38 +0000
committerMåns Rullgård <mans@mansr.com>2008-06-19 16:57:38 +0000
commit9e6165b53eeef2932f2fd13a46c1b636719f7825 (patch)
tree124bb4be4ebc3f306a4c791cb1703db080834dc0
parent74d9441715a2c4b459df50f40025eac5ccb15e96 (diff)
downloadffmpeg-9e6165b53eeef2932f2fd13a46c1b636719f7825.tar.gz
enable version.h to be created from subdirs
Originally committed as revision 13819 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--Makefile8
-rw-r--r--common.mak18
-rwxr-xr-xconfigure2
-rwxr-xr-xversion.sh2
4 files changed, 18 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index c290f0b86d..a820d5f360 100644
--- a/Makefile
+++ b/Makefile
@@ -67,14 +67,6 @@ ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
$(CC) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
-SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
-ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
-version.h: $(SVN_ENTRIES)
-endif
-
-version.h:
- $(SRC_PATH)/version.sh $(SRC_PATH)
-
output_example$(EXESUF): output_example.o $(FF_DEP_LIBS)
$(CC) $(CFLAGS) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
diff --git a/common.mak b/common.mak
index e77d960d9c..c0ed6b957e 100644
--- a/common.mak
+++ b/common.mak
@@ -9,10 +9,16 @@ vpath %.c $(SRC_DIR)
vpath %.h $(SRC_DIR)
vpath %.S $(SRC_DIR)
+ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
+BUILD_ROOT_REL = .
+else
+BUILD_ROOT_REL = ..
+endif
+
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
-CFLAGS = -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
- -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) $(OPTFLAGS)
+CFLAGS := -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
+ -D_ISOC9X_SOURCE -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(OPTFLAGS)
%.o: %.c
$(CC) $(CFLAGS) $(LIBOBJFLAGS) -c -o $@ $<
@@ -34,6 +40,14 @@ CFLAGS = -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
%$(EXESUF): %.c
+SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
+ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
+$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
+endif
+
+$(BUILD_ROOT_REL)/version.h:
+ $(SRC_PATH)/version.sh $(SRC_PATH) $@
+
install: install-libs install-headers
uninstall: uninstall-libs uninstall-headers
diff --git a/configure b/configure
index c8e701b9e6..c1eecf5d0a 100755
--- a/configure
+++ b/configure
@@ -969,7 +969,7 @@ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
# gcc stupidly only outputs the basename of targets with -MM
-DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "1s,^,$(@D)/,"'
+DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "1s,^,$(@D)/," -e "s,[[:space:]]version\\.h,\$$(BUILD_ROOT_REL)/&,"'
# find source path
source_path="`dirname \"$0\"`"
diff --git a/version.sh b/version.sh
index f8b111cc72..121a8d3300 100755
--- a/version.sh
+++ b/version.sh
@@ -20,5 +20,5 @@ OLD_REVISION=`cat version.h 2> /dev/null`
# Update version.h only on revision changes to avoid spurious rebuilds
if test "$NEW_REVISION" != "$OLD_REVISION"; then
- echo "$NEW_REVISION" > version.h
+ echo "$NEW_REVISION" > "$2"
fi