summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 c290f0b..a820d5f 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 e77d960..c0ed6b9 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 c8e701b..c1eecf5 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 f8b111c..121a8d3 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
OpenPOWER on IntegriCloud