[PATCH] out-of-tree builds

From: Geert Uytterhoeven
Date: Sun Mar 14 2004 - 08:01:32 EST



Although I like the feature to build a kernel in a different directory a lot, I
don't like its syntax. I prefer to just have a build directory where I can run
`make whatever'.

The following patch adds a configure script to the kernel. If you run

/path/to/kernel/source/tree/configure

it will create a Makefile in the current directory, after which you can just do
`make whatever', just like in the source directory.

The configure script contains a simple protection for when run in the source
directory, but this may be approved (I'm not a configure script guru).

Comments?

--- /dev/null 2004-02-08 10:50:36.000000000 +0100
+++ linux-2.6.4/Makefile.in 2004-03-14 13:00:40.000000000 +0100
@@ -0,0 +1,11 @@
+
+srcdir = @srcdir@
+
+dstdir = $(shell pwd)
+
+all:
+ make -C $(srcdir) O=$(dstdir)
+
+%:
+ make -C $(srcdir) O=$(dstdir) $@
+
--- /dev/null 2004-02-08 10:50:36.000000000 +0100
+++ linux-2.6.4/configure 2004-03-14 13:03:35.000000000 +0100
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+srcdir=$(dirname $0)
+dstdir=$(pwd)
+
+if [ $srcdir = . -o $srcdir = $dstdir ]; then
+ echo Building in Linux kernel source tree, nothing changed
+else
+ if [ -e Makefile ]; then
+ /bin/mv Makefile Makefile.bak
+ fi
+ echo '# Generated automatically from Makefile.in by configure.' > Makefile
+ /bin/sed -e s+@srcdir@+$srcdir+ < $srcdir/Makefile.in >> Makefile
+ echo Linux kernel source tree in directory $srcdir
+ echo Building in directory $dstdir
+fi
+

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/