summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2016-02-13 14:24:13 +0100
committerStef Walter <stefw@gnome.org>2016-02-13 14:25:26 +0100
commit166a72d726d578f1550a8dd8610950c5a8b0b777 (patch)
tree422a7f1db4cc2142459f40f2f7619e4eb756a2b7
parentd7bab63cf6e6330555cc84c9391a5ff39f2053c6 (diff)
downloadgcr-166a72d726d578f1550a8dd8610950c5a8b0b777.tar.gz
build: Add easy way to run make when $srcdir != $builddir
-rwxr-xr-xautogen.sh7
-rw-r--r--build/Makefile.redirect9
2 files changed, 16 insertions, 0 deletions
diff --git a/autogen.sh b/autogen.sh
index d5c782b..794e1c5 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -5,6 +5,7 @@ PKG_NAME="gcr"
USE_GNOME2_MACROS=1
REQUIRED_AUTOMAKE_VERSION=1.11
+olddir=`pwd`
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
@@ -20,3 +21,9 @@ which gnome-autogen.sh || {
}
. gnome-autogen.sh
+
+# Put a redirect makefile here
+if [ ! -f $srcdir/Makefile ]; then
+ cat $srcdir/build/Makefile.redirect > $srcdir/Makefile
+ printf "\nREDIRECT = %s\n" "$(realpath $olddir)" >> $srcdir/Makefile
+fi
diff --git a/build/Makefile.redirect b/build/Makefile.redirect
new file mode 100644
index 0000000..db371eb
--- /dev/null
+++ b/build/Makefile.redirect
@@ -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