Commit 997baf01 authored by Måns Rullgård's avatar Måns Rullgård

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
parent 94b594c6
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
include config.mak include config.mak
VPATH=$(SRC_PATH) VPATH=$(SRC_PATH_BARE)
CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \ CFLAGS=$(OPTFLAGS) -I$(BUILD_ROOT) -I$(SRC_PATH) -I$(SRC_PATH)/libavutil \
-I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \ -I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale \
...@@ -91,7 +91,7 @@ ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs ...@@ -91,7 +91,7 @@ ffplay_g$(EXESUF): ffplay.o cmdutils.o .libs
$(STRIP) $@ $(STRIP) $@
version.h: version.h:
$(SRC_PATH)/version.sh "$(SRC_PATH)" $(SRC_PATH)/version.sh $(SRC_PATH)
output_example$(EXESUF): output_example.o .libs output_example$(EXESUF): output_example.o .libs
$(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS) $(CC) $(LDFLAGS) -o $@ output_example.o $(EXTRALIBS)
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# common bits used by all libraries # common bits used by all libraries
# #
SRC_DIR = $(SRC_PATH)/lib$(NAME) VPATH = $(SRC_PATH_BARE)/lib$(NAME)
VPATH = $(SRC_DIR) SRC_DIR = "$(VPATH)"
CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ CFLAGS += -DHAVE_AV_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
-D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \ -D_ISOC9X_SOURCE -I$(BUILD_ROOT) -I$(SRC_PATH) \
...@@ -78,7 +78,7 @@ install-lib-static: $(LIB) ...@@ -78,7 +78,7 @@ install-lib-static: $(LIB)
install-headers: install-headers:
install -d "$(incdir)" install -d "$(incdir)"
install -d "$(libdir)/pkgconfig" 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" install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(libdir)/pkgconfig"
uninstall: uninstall-libs uninstall-headers uninstall: uninstall-libs uninstall-headers
......
...@@ -662,13 +662,15 @@ targetos="${targetos}-UNKNOWN" ...@@ -662,13 +662,15 @@ targetos="${targetos}-UNKNOWN"
esac esac
# find source path # find source path
source_path="`dirname $0`" source_path="`dirname \"$0\"`"
source_path_used="yes" source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then if test -z "$source_path" -o "$source_path" = "." ; then
source_path=`pwd` source_path="`pwd`"
source_path_used="no" source_path_used="no"
else else
source_path="`cd \"$source_path\"; pwd`" 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 fi
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
...@@ -2156,6 +2158,7 @@ if test "$source_path_used" = "yes" ; then ...@@ -2156,6 +2158,7 @@ if test "$source_path_used" = "yes" ; then
" "
FILES="\ FILES="\
Makefile \ Makefile \
common.mak \
libavformat/Makefile \ libavformat/Makefile \
libavcodec/Makefile \ libavcodec/Makefile \
libpostproc/Makefile \ libpostproc/Makefile \
...@@ -2173,8 +2176,9 @@ if test "$source_path_used" = "yes" ; then ...@@ -2173,8 +2176,9 @@ if test "$source_path_used" = "yes" ; then
ln -sf "$source_path/$f" $f ln -sf "$source_path/$f" $f
done done
fi fi
echo "SRC_PATH=$source_path" >> config.mak echo "SRC_PATH=\"$source_path\"" >> config.mak
echo "BUILD_ROOT=$PWD" >> config.mak echo "SRC_PATH_BARE=$source_path" >> config.mak
echo "BUILD_ROOT=\"$PWD\"" >> config.mak
if test "$amr" = "yes" ; then if test "$amr" = "yes" ; then
echo "#define CONFIG_AMR 1" >> $TMPH echo "#define CONFIG_AMR 1" >> $TMPH
......
-include ../config.mak -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 \ all: ffmpeg-doc.html faq.html ffserver-doc.html ffplay-doc.html hooks.html \
ffmpeg.1 ffserver.1 ffplay.1 ffmpeg.1 ffserver.1 ffplay.1
......
...@@ -412,7 +412,7 @@ ifeq ($(TARGET_ARCH_X86),yes) ...@@ -412,7 +412,7 @@ ifeq ($(TARGET_ARCH_X86),yes)
TESTS+= cpuid_test dct-test motion-test TESTS+= cpuid_test dct-test motion-test
endif endif
include $(SRC_PATH)/common.mak include ../common.mak
amrlibs: amrlibs:
$(MAKE) -C amr spclib fipoplib $(MAKE) -C amr spclib fipoplib
......
...@@ -192,4 +192,4 @@ LIBVERSION=$(LAVFVERSION) ...@@ -192,4 +192,4 @@ LIBVERSION=$(LAVFVERSION)
LIBMAJOR=$(LAVFMAJOR) LIBMAJOR=$(LAVFMAJOR)
endif endif
include $(SRC_PATH)/common.mak include ../common.mak
...@@ -25,4 +25,4 @@ LIBVERSION=$(LAVUVERSION) ...@@ -25,4 +25,4 @@ LIBVERSION=$(LAVUVERSION)
LIBMAJOR=$(LAVUMAJOR) LIBMAJOR=$(LAVUMAJOR)
endif endif
include $(SRC_PATH)/common.mak include ../common.mak
...@@ -17,7 +17,7 @@ SHARED_OBJS=postprocess_pic.o ...@@ -17,7 +17,7 @@ SHARED_OBJS=postprocess_pic.o
HEADERS = postprocess.h HEADERS = postprocess.h
include $(SRC_PATH)/common.mak include ../common.mak
depend dep: postprocess.c depend dep: postprocess.c
......
...@@ -4,30 +4,31 @@ ...@@ -4,30 +4,31 @@
# #
include ../config.mak include ../config.mak
VPATH=$(SRC_PATH)/tests VPATH=$(SRC_PATH_BARE)/tests
SRC_DIR=$(SRC_PATH)/tests
CFLAGS=-O2 -Wall -g CFLAGS=-O2 -Wall -g
REFFILE1=$(VPATH)/ffmpeg.regression.ref REFFILE1=$(SRC_DIR)/ffmpeg.regression.ref
REFFILE2=$(VPATH)/rotozoom.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 all fulltest test: codectest libavtest test-server
test-server: vsynth1/00.pgm asynth1.sw 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 # fast regression tests for all codecs
codectest mpeg4 mpeg ac3 snow snowll: vsynth1/00.pgm vsynth2/00.pgm asynth1.sw tiny_psnr$(EXESUF) codectest mpeg4 mpeg ac3 snow snowll: vsynth1/00.pgm vsynth2/00.pgm asynth1.sw tiny_psnr$(EXESUF)
@$(VPATH)/regression.sh $@ $(REFFILE1) vsynth1 @$(SRC_DIR)/regression.sh $@ $(REFFILE1) vsynth1
@$(VPATH)/regression.sh $@ $(REFFILE2) vsynth2 @$(SRC_DIR)/regression.sh $@ $(REFFILE2) vsynth2
# fast regression for libav formats # fast regression for libav formats
ifeq ($(CONFIG_GPL),yes) ifeq ($(CONFIG_GPL),yes)
libavtest: vsynth1/00.pgm asynth1.sw libavtest: vsynth1/00.pgm asynth1.sw
@$(VPATH)/regression.sh $@ $(LIBAV_REFFILE) vsynth1 @$(SRC_DIR)/regression.sh $@ $(LIBAV_REFFILE) vsynth1
else else
libavtest: libavtest:
@echo @echo
...@@ -43,7 +44,7 @@ vsynth1/00.pgm: videogen$(EXESUF) ...@@ -43,7 +44,7 @@ vsynth1/00.pgm: videogen$(EXESUF)
vsynth2/00.pgm: rotozoom$(EXESUF) vsynth2/00.pgm: rotozoom$(EXESUF)
@mkdir -p vsynth2 @mkdir -p vsynth2
./rotozoom 'vsynth2/' $(VPATH)/lena.pnm ./rotozoom 'vsynth2/' $(SRC_DIR)/lena.pnm
videogen$(EXESUF): videogen.c videogen$(EXESUF): videogen.c
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $<
......
...@@ -39,7 +39,7 @@ sleep 2 ...@@ -39,7 +39,7 @@ sleep 2
) )
kill $FFSERVER_PID kill $FFSERVER_PID
wait > /dev/null 2>&1 wait > /dev/null 2>&1
if $diff_cmd data/ffserver.regression $1 ; then if $diff_cmd data/ffserver.regression "$1" ; then
echo echo
echo Server regression test succeeded. echo Server regression test succeeded.
exit 0 exit 0
......
include ../config.mak 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 \ 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 -I$(SRC_PATH)/libavformat -I$(SRC_PATH)/libswscale $(VHOOKCFLAGS) -DHAVE_AV_CONFIG_H
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment