Re: [RFC/CFT] Separate obj/src dir

From: Sam Ravnborg (sam@ravnborg.org)
Date: Tue Nov 19 2002 - 16:57:41 EST


On Tue, Nov 19, 2002 at 02:48:09PM -0600, Kai Germaschewski wrote:
> Wrt the original patch, I like it, one preliminary comment is that I think
> symlinks are nicer than copying. They are faster, shouldn't cause any
> trouble on NFS, make uses "stat" and not "lstat", so it gets the
> timestamps right, too. And if you edit a Makefile/Kconfig in the source
> tree, you rather want that to take effect immediately, I guess ;)

Second try on the script.
Create symlinks as suggested, and optimised find a liitle.

        Sam

#!/bin/sh
#
# This script is used to build a kernel from a separate directory.
# The location of this script is assumed to be the root of
# the kernel tree.
# Usage:
# kernel src located in:
# ~/kernelsrc
# compile in:
# ~/compile
# cd ~/compile <= Change to the directory where the compile shall take place
# ../kernelsrc/kbuild
#
# Arguments to kbuild is the same as used to make in the kernel build
# kbuild prints out SRCTREE and OBJTREE when started, and then makes a mirror
# 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"

OBJTREE=$PWD
cd `dirname $0`
SRCTREE=$PWD
cd $OBJTREE
echo OBJTREE $OBJTREE
echo SRCTREE $SRCTREE
if [ "$SRCTREE" != "$OBJTREE" ]; then
  if [ -f $SRCTREE/.config -o -d $SRCTREE/include/asm ]; then
    echo '$SRCTREE contains generated files, please run "make mrproper" in the SRCTREE'
  else
    for a in `cd $SRCTREE; \
      find \( $RCS_FIND_IGNORE \) -prune -o -name Makefile\* -o -name Kconfig\* -o -name defconfig`; 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
    touch Rules.make
  make $*
  fi
else
  rm -f .tmp_make_config
  make $*
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/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:29 EST