Re: [CFT] Separate obj dir [2]

Sam Ravnborg (sam@ravnborg.org)
Sun, 24 Nov 2002 08:09:41 +0100


Hi all.

I the previous mail I forgot the kbuild script - sorry.
Here it comes (as a patch).

Sam

--- /dev/null 2002-08-31 01:31:37.000000000 +0200
+++ kbuild 2002-11-24 08:06:33.000000000 +0100
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# This script is used to build a kernel from a directory
+# separate from the kernel src tree.
+# The location of this script is assumed to be the root of
+# the kernel src tree. Do not copy it elsewhere.
+# Usage: kbuild [Usual options provided to make]
+
+# kbuild prints out SRCTREE and OBJTREE when started, and then makes
+# symlinks of relevant files from the kernelsrc.
+
+# Files we do not care about in the kernel src
+RCS_FIND_IGNORE="-name SCCS -o -name BitKeeper -o -name .svn -o -name CVS"
+
+# Obtain absolute paths for SRCTREE and OBJTREE
+OBJTREE=$PWD
+cd `dirname $0`
+SRCTREE=$PWD
+cd $OBJTREE
+echo OBJTREE $OBJTREE
+echo SRCTREE $SRCTREE
+
+# If kbuild is executed from the root of the kernel src tree just call make
+if [ "$SRCTREE" == "$OBJTREE" ]; then
+ rm -f .tmp_make_config
+ make $*
+else
+ # A directory separate from kernel src tree
+ # Test if make has been executed in kernel src tree already
+ if [ -f $SRCTREE/.config -o -d $SRCTREE/include/asm ]; then
+ echo '$SRCTREE contains generated files, please run "make mrproper" in the SRCTREE'
+ else
+ # Symlink relevant files
+ for a in `cd $SRCTREE; \
+ find \( $RCS_FIND_IGNORE \) -prune -o -name Makefile\*`; do
+ if [ ! -d `dirname $a` ]; then
+ mkdir -p $a
+ fi
+ ln -fs $SRCTREE/$a $a
+ done
+
+ ( echo "srctree := $SRCTREE";
+ echo "objtree := $OBJTREE";
+ ) > .tmp_make_config
+ echo "#Dummy file" > Rules.make
+ make $*
+ fi
+fi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/