Subject: Re: build sourcesets problem
To: NetBSD-current Discussion List <current-users@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 08/21/2003 13:32:49
[ On Thursday, August 21, 2003 at 08:36:54 (+0100), David Laight wrote: ]
> Subject: Re: build sourcesets problem
>
> > I developed the `sourcesets' option on a system where I have read-only
> > source and separate objdirs, and I don't think there's an easy way to
> > support this option with "in-tree" builds. So, using objdirs is the
> > recommended approach here.
> >
> > The difference between -M and -O is as follows:
> >
> > -M modp set MAKEOBJDIRPREFIX to `modp'.
> > OBJDIR for /path/to/src/bin/ls becomes
> > modp/path/to/src/bin/ls
> > (I.e., $MAKEOBJDIRPREFIX/`pwd`).
> >
> > -O mod set MAKEOBJDIR to `mod'.
> > OBJDIR for /path/to/src/bin/ls becomes
> > mod/bin/ls
> > (I.e., a "sanitized" path)
> >
> > -O results in shorter paths under the top of the obj tree, but -M
> > allows for shell tricks like ls $MAKEOBJDIRPREFIX/$cwd
> > to get to the objdir. It's all a matter of personal preference.
>
> With -O you can do other shell tricks like (cd src obj;ls).
Actually you can just about as easily with -M as well, especially given
that any shell supporting that Korn Shell trick has full support for
command aliases too thus making it easy to avoid the extra typing.
For example here's a snippet from my ksh helpers for building netbsd-1-6
on various hosts with target machines being any one of several:
export HOST_MACHINE=$(uname -m)
export BUILD_SERVER=proven
export BUILD_HOME=/$BUILD_SERVER/home/$BUILD_SERVER/$USER
alias cdalphaobj="cd / ${BUILD_HOME}/NetBSD-1.6.x-${HOST_MACHINE}-alpha-obj/"
alias cdi386obj="cd / ${BUILD_HOME}/NetBSD-1.6.x-${HOST_MACHINE}-i386-obj/"
alias cdpmaxobj="cd / ${BUILD_HOME}/NetBSD-1.6.x-${HOST_MACHINE}-pmax-obj/"
alias cdsparcobj="cd / ${BUILD_HOME}/NetBSD-1.6.x-${HOST_MACHINE}-sparc-obj/"
alias cdsun3obj="cd / ${BUILD_HOME}/NetBSD-1.6.x-${HOST_MACHINE}-sun3-obj/"
alias cdvaxobj="cd / ${BUILD_HOME}/NetBSD-1.6.x-${HOST_MACHINE}-vax-obj/"
("cd -" of course gets you back to the source directory where you
started from, assuming you've done no intermediate "cd"s)
The "build.sh -M" parameter in this case is of course:
build.sh -M ${BUILD_HOME}/NetBSD-1.6.x-${HOST_MACHINE}-${TARGET_MACHINE}-obj
Because of symlink and NFS maddness I have to put extra symlinks in
place to make the cd substitution work:
# assume we have a /usr/src-1.6.x symlink pointing to the real CVS
# working directory:
#
# ln -s ../work/woods/m-NetBSD-1.6 /usr/src-1.6.x
#
# in order to handle going from a $PWD in the /usr/src-1.6.x symlink
# location to the object directory you first need to make sure you
# have any necessary symlinks (for each architecture), such as:
#
# ln -s work ~/NetBSD-1.6.x-${HOST_MACHINE}-${TARGET}-obj/usr
# ln -s woods/m-NetBSD-1.6 ~/NetBSD-1.6.x-${HOST_MACHINE}-${TARGET}-obj/usr/src-1.6.x
#
# or, on an NFS client:
#
# ln -s proven/work ~/NetBSD-1.6.x-${HOST_MACHINE}-${TARGET}-obj/usr
# ln -s woods/m-NetBSD-1.6 ~/NetBSD-1.6.x-${HOST_MACHINE}-${TARGET}-obj/usr/src
#
> Maybe there should be an option to tell make that there must always
> be an OBJDIR, and that it should never stay in the source directory?
If you want to go that way then maybe X11's "lndir" is better?
> Maybe even be able to make make create the directory on the fly?
That's something I've always wondered about -- avoiding the objdir
creation pass is one step towards avoiding the whole recursive make
inanity! ;-)
--
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Secrets of the Weird <woods@weird.com>