Commit f71d047d authored by Oka Motofumi's avatar Oka Motofumi Committed by Fiona Glaser

Add out-of-tree build support

parent 5539220e
......@@ -2,6 +2,11 @@
include config.mak
vpath %.c $(SRCPATH)
vpath %.h $(SRCPATH)
vpath %.S $(SRCPATH)
vpath %.asm $(SRCPATH)
all: default
SRCS = common/mc.c common/predict.c common/pixel.c common/macroblock.c \
......@@ -86,7 +91,7 @@ ASFLAGS += -DARCH_X86_64
endif
ifdef ARCH_X86
ASFLAGS += -Icommon/x86/
ASFLAGS += -I$(SRCPATH)/common/x86/
SRCS += common/x86/mc-c.c common/x86/predict-c.c
OBJASM = $(ASMSRC:%.asm=%.o)
$(OBJASM): common/x86/x86inc.asm common/x86/x86util.asm
......@@ -177,7 +182,7 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK): .depend
.depend: config.mak
@rm -f .depend
@$(foreach SRC, $(SRCS) $(SRCCLI) $(SRCSO), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:%.c=%.o) $(DEPMM) 1>> .depend;)
@$(foreach SRC, $(addprefix $(SRCPATH)/, $(SRCS) $(SRCCLI) $(SRCSO)), $(CC) $(CFLAGS) $(SRC) $(DEPMT) $(SRC:$(SRCPATH)/%.c=%.o) $(DEPMM) 1>> .depend;)
config.mak:
./configure
......@@ -229,7 +234,7 @@ install-lib-dev:
install -d $(DESTDIR)$(includedir)
install -d $(DESTDIR)$(libdir)
install -d $(DESTDIR)$(libdir)/pkgconfig
install -m 644 x264.h $(DESTDIR)$(includedir)
install -m 644 $(SRCPATH)/x264.h $(DESTDIR)$(includedir)
install -m 644 x264_config.h $(DESTDIR)$(includedir)
install -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig
......
......@@ -212,6 +212,10 @@ die() {
rm -f x264_config.h config.h config.mak config.log x264.pc x264.def conftest*
SRCPATH="$(cd $(dirname $0); pwd)"
[ "$SRCPATH" = "$(pwd)" ] && SRCPATH=.
[ -n "$(echo $SRCPATH | grep ' ')" ] && die "Out of tree builds are impossible with whitespace in source path."
prefix='/usr/local'
exec_prefix='${prefix}'
bindir='${exec_prefix}/bin'
......@@ -241,7 +245,7 @@ bit_depth="8"
chroma_format="all"
compiler="GNU"
CFLAGS="$CFLAGS -Wall -I."
CFLAGS="$CFLAGS -Wall -I. -I\$(SRCPATH)"
LDFLAGS="$LDFLAGS"
LDFLAGSCLI="$LDFLAGSCLI"
ASFLAGS="$ASFLAGS"
......@@ -380,10 +384,10 @@ RANLIB="${RANLIB-${cross_prefix}ranlib}"
STRIP="${STRIP-${cross_prefix}strip}"
if [ "x$host" = x ]; then
host=`./config.guess`
host=`${SRCPATH}/config.guess`
fi
# normalize a triplet into a quadruplet
host=`./config.sub $host`
host=`${SRCPATH}/config.sub $host`
# split $host
host_cpu="${host%%-*}"
......@@ -997,6 +1001,7 @@ EOF
# generate config files
cat > config.mak << EOF
SRCPATH=$SRCPATH
prefix=$prefix
exec_prefix=$exec_prefix
bindir=$bindir
......@@ -1036,7 +1041,7 @@ if [ "$cli" = "yes" ]; then
fi
if [ "$shared" = "yes" ]; then
API=$(grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' ')
API=$(grep '#define X264_BUILD' < ${SRCPATH}/x264.h | cut -f 3 -d ' ')
if [ "$SYS" = "WINDOWS" -o "$SYS" = "CYGWIN" ]; then
echo "SONAME=libx264-$API.dll" >> config.mak
if [ $compiler = ICL ]; then
......@@ -1087,7 +1092,7 @@ fi
echo "LDFLAGSCLI = $LDFLAGSCLI" >> config.mak
echo "CLI_LIBX264 = $CLI_LIBX264" >> config.mak
./version.sh >> x264_config.h
${SRCPATH}/version.sh "${SRCPATH}" >> x264_config.h
pclibs="-L$libdir -lx264 $libpthread"
......@@ -1139,6 +1144,9 @@ cat conftest.log >> config.log
cat conftest.log
rm conftest.log
[ "$SRCPATH" != "." ] && ln -sf ${SRCPATH}/Makefile ./Makefile
mkdir -p common/{arm,ppc,sparc,x86} encoder extras filters/video input output tools
echo
echo "You can run 'make' or 'make fprofiled' now."
#!/bin/bash
[ -n "$1" ] && cd $1
git rev-list HEAD | sort > config.git-hash
LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
if [ $LOCALVER \> 1 ] ; then
......
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