build: Add redirect Makefile for when $srcdir != $builddir

This commit is contained in:
Stef Walter 2016-02-13 12:27:18 +01:00
parent ba2c57d842
commit a3a6f5c9d8
2 changed files with 16 additions and 1 deletions

View File

@ -104,6 +104,12 @@ cd $ORIGDIR || exit $?
if test -z "$NOCONFIGURE"; then
$srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $?
echo
# Put a redirect makefile here
if [ ! -f $srcdir/Makefile ]; then
cat $srcdir/build/Makefile.redirect > $srcdir/Makefile
printf "\nREDIRECT = %s\n" "$(realpath $ORIGDIR)" >> $srcdir/Makefile
fi
echo
echo "Now type 'make' to compile $PROJECT."
fi

9
build/Makefile.redirect Normal file
View File

@ -0,0 +1,9 @@
# This redirects all make targets to builddir
all:
$(MAKE) -C $(REDIRECT) all
%:
$(MAKE) -C $(REDIRECT) $@
ifeq ($(MAKEFLAGS), )
JOBARG = -j4
endif
# REDIRECT=build