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 \
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
.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
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
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'
chroma_format="all"
compiler="GNU"
-CFLAGS="$CFLAGS -Wall -I."
+CFLAGS="$CFLAGS -Wall -I. -I\$(SRCPATH)"
LDFLAGS="$LDFLAGS"
LDFLAGSCLI="$LDFLAGSCLI"
ASFLAGS="$ASFLAGS"
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%%-*}"
# generate config files
cat > config.mak << EOF
+SRCPATH=$SRCPATH
prefix=$prefix
exec_prefix=$exec_prefix
bindir=$bindir
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
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"
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."