allow spaces in source and build directory names
authorMåns Rullgård <mans@mansr.com>
Wed, 8 Nov 2006 00:02:15 +0000 (00:02 +0000)
committerMåns Rullgård <mans@mansr.com>
Wed, 8 Nov 2006 00:02:15 +0000 (00:02 +0000)
out of tree builds from a source dir with spaces is impossible
due to how make handles vpath

Originally committed as revision 6938 to svn://svn.ffmpeg.org/ffmpeg/trunk

Makefile
common.mak
configure
doc/Makefile
libavcodec/Makefile
libavformat/Makefile
libavutil/Makefile
libpostproc/Makefile
tests/Makefile
tests/server-regression.sh
vhook/Makefile

index 09e5fc6..ebcb2d8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
 #
 include config.mak
 
-VPATH=$(SRC_PATH)
+VPATH=$(SRC_PATH_BARE)
 
 CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
        -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
@@ -91,7 +91,7 @@ ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
        $(STRIP) $@
 
 version.h:
-       $(SRC_PATH)/version.sh "$(SRC_PATH)"
+       $(SRC_PATH)/version.sh $(SRC_PATH)
 
 output_example$(EXESUF): output_example.o .libs
        $(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
index d045c08..cecb488 100644 (file)
@@ -2,8 +2,8 @@
 # common bits used by all libraries
 #
 
-SRC_DIR = $(SRC_PATH)/lib$(NAME)
-VPATH = $(SRC_DIR)
+VPATH = $(SRC_PATH_BARE)/lib$(NAME)
+SRC_DIR = "$(VPATH)"
 
 CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
           -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
@@ -78,7 +78,7 @@ install-lib-static: $(LIB)
 install-headers:
        install -d "$(incdir)"
        install -d "$(libdir)/pkgconfig"
-       install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(incdir)"
+       install -m 644 $(addprefix $(SRC_DIR)/,$(HEADERS)) "$(incdir)"
        install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
 
 uninstall: uninstall-libs uninstall-headers
index 2ae0c9c..1e06b49 100755 (executable)
--- a/configure
+++ b/configure
@@ -662,13 +662,15 @@ targetos="${targetos}-UNKNOWN"
 esac
 
 # find source path
-source_path="`dirname $0`"
+source_path="`dirname \"$0\"`"
 source_path_used="yes"
 if test -z "$source_path" -o "$source_path" = "." ; then
-    source_path=`pwd`
+    source_path="`pwd`"
     source_path_used="no"
 else
     source_path="`cd \"$source_path\"; pwd`"
+    echo "$source_path" | grep -q '[[:blank:]]' &&
+      die "Out of tree builds are impossible with whitespace in source path."
 fi
 
 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
@@ -2156,6 +2158,7 @@ if test "$source_path_used" = "yes" ; then
          "
     FILES="\
           Makefile \
+          common.mak \
           libavformat/Makefile \
           libavcodec/Makefile \
           libpostproc/Makefile \
@@ -2173,8 +2176,9 @@ if test "$source_path_used" = "yes" ; then
         ln -sf "$source_path/$f" $f
     done
 fi
-echo "SRC_PATH=$source_path" >> config.mak
-echo "BUILD_ROOT=$PWD" >> config.mak
+echo "SRC_PATH=\"$source_path\"" >> config.mak
+echo "SRC_PATH_BARE=$source_path" >> config.mak
+echo "BUILD_ROOT=\"$PWD\"" >> config.mak
 
 if test "$amr" = "yes" ; then
   echo "#define CONFIG_AMR 1" >> $TMPH
index 287836f..4fc9dfb 100644 (file)
@@ -1,6 +1,6 @@
 -include ../config.mak
 
-VPATH=$(SRC_PATH)/doc
+VPATH=$(SRC_PATH_BARE)/doc
 
 all: ffmpeg-doc.html faq.html ffserver-doc.html ffplay-doc.html hooks.html \
      ffmpeg.1 ffserver.1 ffplay.1
index f96fa70..d6d09d2 100644 (file)
@@ -412,7 +412,7 @@ ifeq ($(TARGET_ARCH_X86),yes)
 TESTS+= cpuid_test dct-test motion-test
 endif
 
-include $(SRC_PATH)/common.mak
+include ../common.mak
 
 amrlibs:
        $(MAKE) -C amr spclib fipoplib
index 32f8ea4..2f3ef01 100644 (file)
@@ -192,4 +192,4 @@ LIBVERSION=$(LAVFVERSION)
 LIBMAJOR=$(LAVFMAJOR)
 endif
 
-include $(SRC_PATH)/common.mak
+include ../common.mak
index 2427a70..a96e4c0 100644 (file)
@@ -25,4 +25,4 @@ LIBVERSION=$(LAVUVERSION)
 LIBMAJOR=$(LAVUMAJOR)
 endif
 
-include $(SRC_PATH)/common.mak
+include ../common.mak
index 44434e8..a676536 100644 (file)
@@ -17,7 +17,7 @@ SHARED_OBJS=postprocess_pic.o
 
 HEADERS = postprocess.h
 
-include $(SRC_PATH)/common.mak
+include ../common.mak
 
 depend dep: postprocess.c
 
index 6f26bd6..c4c6925 100644 (file)
@@ -4,30 +4,31 @@
 #
 include ../config.mak
 
-VPATH=$(SRC_PATH)/tests
+VPATH=$(SRC_PATH_BARE)/tests
+SRC_DIR=$(SRC_PATH)/tests
 CFLAGS=-O2 -Wall -g
 
-REFFILE1=$(VPATH)/ffmpeg.regression.ref
-REFFILE2=$(VPATH)/rotozoom.regression.ref
+REFFILE1=$(SRC_DIR)/ffmpeg.regression.ref
+REFFILE2=$(SRC_DIR)/rotozoom.regression.ref
 
-SERVER_REFFILE=$(VPATH)/ffserver.regression.ref
+SERVER_REFFILE=$(SRC_DIR)/ffserver.regression.ref
 
-LIBAV_REFFILE=$(VPATH)/libav.regression.ref
+LIBAV_REFFILE=$(SRC_DIR)/libav.regression.ref
 
 all fulltest test: codectest libavtest test-server
 
 test-server: vsynth1/00.pgm asynth1.sw
-       @$(VPATH)/server-regression.sh $(SERVER_REFFILE) $(VPATH)/test.conf
+       @$(SRC_DIR)/server-regression.sh $(SERVER_REFFILE) $(SRC_DIR)/test.conf
 
 # fast regression tests for all codecs
 codectest mpeg4 mpeg ac3 snow snowll: vsynth1/00.pgm vsynth2/00.pgm asynth1.sw tiny_psnr$(EXESUF)
-       @$(VPATH)/regression.sh $@ $(REFFILE1) vsynth1
-       @$(VPATH)/regression.sh $@ $(REFFILE2) vsynth2
+       @$(SRC_DIR)/regression.sh $@ $(REFFILE1) vsynth1
+       @$(SRC_DIR)/regression.sh $@ $(REFFILE2) vsynth2
 
 # fast regression for libav formats
 ifeq ($(CONFIG_GPL),yes)
 libavtest: vsynth1/00.pgm asynth1.sw
-       @$(VPATH)/regression.sh $@ $(LIBAV_REFFILE) vsynth1
+       @$(SRC_DIR)/regression.sh $@ $(LIBAV_REFFILE) vsynth1
 else
 libavtest:
        @echo
@@ -43,7 +44,7 @@ vsynth1/00.pgm: videogen$(EXESUF)
 
 vsynth2/00.pgm: rotozoom$(EXESUF)
        @mkdir -p vsynth2
-       ./rotozoom 'vsynth2/' $(VPATH)/lena.pnm
+       ./rotozoom 'vsynth2/' $(SRC_DIR)/lena.pnm
 
 videogen$(EXESUF): videogen.c
        $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
index e3562f1..fb28fba 100755 (executable)
@@ -39,7 +39,7 @@ sleep 2
 )
 kill $FFSERVER_PID
 wait > /dev/null 2>&1
-if $diff_cmd data/ffserver.regression $1 ; then
+if $diff_cmd data/ffserver.regression "$1" ; then
     echo
     echo Server regression test succeeded.
     exit 0
index e784d50..06b4893 100644 (file)
@@ -1,6 +1,6 @@
 include ../config.mak
 
-VPATH=$(SRC_PATH)/vhook
+VPATH=$(SRC_PATH_BARE)/vhook
 
 CFLAGS=-I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil -I$(SRC_PATH)/libavcodec \
        -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale $(VHOOKCFLAGS) -DHAVE_AV_CONFIG_H