From 997baf014130b85828d918cb4054c17e57a8e1e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5ns=20Rullg=C3=A5rd?= Date: Wed, 8 Nov 2006 00:02:15 +0000 Subject: [PATCH] allow spaces in source and build directory names 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 | 4 ++-- common.mak | 6 +++--- configure | 12 ++++++++---- doc/Makefile | 2 +- libavcodec/Makefile | 2 +- libavformat/Makefile | 2 +- libavutil/Makefile | 2 +- libpostproc/Makefile | 2 +- tests/Makefile | 21 +++++++++++---------- tests/server-regression.sh | 2 +- vhook/Makefile | 2 +- 11 files changed, 31 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 09e5fc6d88..ebcb2d826d 100644 --- 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) diff --git a/common.mak b/common.mak index d045c0895d..cecb48897d 100644 --- a/common.mak +++ b/common.mak @@ -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 diff --git a/configure b/configure index 2ae0c9cf53..1e06b4940e 100755 --- 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 diff --git a/doc/Makefile b/doc/Makefile index 287836f71f..4fc9dfb8f9 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -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 diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f96fa70cb6..d6d09d2258 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -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 diff --git a/libavformat/Makefile b/libavformat/Makefile index 32f8ea498f..2f3ef01081 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -192,4 +192,4 @@ LIBVERSION=$(LAVFVERSION) LIBMAJOR=$(LAVFMAJOR) endif -include $(SRC_PATH)/common.mak +include ../common.mak diff --git a/libavutil/Makefile b/libavutil/Makefile index 2427a705cd..a96e4c0968 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -25,4 +25,4 @@ LIBVERSION=$(LAVUVERSION) LIBMAJOR=$(LAVUMAJOR) endif -include $(SRC_PATH)/common.mak +include ../common.mak diff --git a/libpostproc/Makefile b/libpostproc/Makefile index 44434e8b74..a6765365d8 100644 --- a/libpostproc/Makefile +++ b/libpostproc/Makefile @@ -17,7 +17,7 @@ SHARED_OBJS=postprocess_pic.o HEADERS = postprocess.h -include $(SRC_PATH)/common.mak +include ../common.mak depend dep: postprocess.c diff --git a/tests/Makefile b/tests/Makefile index 6f26bd6dca..c4c6925f85 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -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 $@ $< diff --git a/tests/server-regression.sh b/tests/server-regression.sh index e3562f118c..fb28fbae8b 100755 --- a/tests/server-regression.sh +++ b/tests/server-regression.sh @@ -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 diff --git a/vhook/Makefile b/vhook/Makefile index e784d501d8..06b48935e0 100644 --- a/vhook/Makefile +++ b/vhook/Makefile @@ -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