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 09e5fc6d88dc559adee2361119a45d8b5a2b4788..ebcb2d826dd42afb8b3910146bf1eb494879e4c8 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 d045c0895d634247b4f1046cb922c0950f7a0c21..cecb48897df8cc58fe380305f6fe1638009c777f 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 2ae0c9cf532f81a79d884e026d3caaffe7d7488f..1e06b4940eb4547536374d211bfd564b5a222d39 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 287836f71f3875a3f785985c45b5d45d83b07a6d..4fc9dfb8f96d8e87418a696d181952376ee6b6f5 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 f96fa70cb66e7ce275e248de51ac8c815ff83b72..d6d09d2258a6929df745813e2cd029356bb985a2 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 32f8ea498f1692f353c1d94bc546b7695d9f138f..2f3ef0108150693395dda088c192e7041c9ead9a 100644 (file)
@@ -192,4 +192,4 @@ LIBVERSION=$(LAVFVERSION)
 LIBMAJOR=$(LAVFMAJOR)
 endif
 
-include $(SRC_PATH)/common.mak
+include ../common.mak
index 2427a705cd41928dc7a461fd9ceebff649ceebe3..a96e4c0968779b3e41ba15104b27c54313d8861f 100644 (file)
@@ -25,4 +25,4 @@ LIBVERSION=$(LAVUVERSION)
 LIBMAJOR=$(LAVUMAJOR)
 endif
 
-include $(SRC_PATH)/common.mak
+include ../common.mak
index 44434e8b74c24620776d7412bd40e39b3b40f0de..a6765365d83b27cb14ba54c630721d981185fdd4 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 6f26bd6dca4832ea867da579c1c8a6d5e4de0fcc..c4c6925f851c47e595de65538d50f8089a5d03fa 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 e3562f118cc794922c81d6e969593e2a228e820c..fb28fbae8b54c1412c1e275d685e757dcf4658cd 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 e784d501d89fc3baff1c6a47c7d05d31dc81b48d..06b48935e0168905f811f3114eff19c47d7329ab 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