Make variables to force non default libraries and includes?

Ian Lepore ian at FreeBSD.org
Tue Apr 29 00:58:02 UTC 2014


On Mon, 2014-04-28 at 18:36 -0600, Warner Losh wrote:
> On Apr 28, 2014, at 1:48 AM, Julian Elischer <julian at FreeBSD.org> wrote:
> 
> > I need to do the equivalent of  "cd /usr/src/cddl/usr.sbin/dtrace; make DESTDIR=/mumble all install”
> 
> cd /usr/src
> make distributeworld DESTDIR=/mumble
> cd cddl/usr.sbin/dtrace
> make buildenv
> make all install
> 
> > but it pulls in libraries from the base system, which differ slightly from those in the source tree.
> 
> The above will create the right /mumble hierarchy, and will pull the libraries from the build rather than the local system.
> 
> > How can I force it to use /mumble2/include and /mumble2/lib instead of / ?
> > 
> > I can pre-populate /mumble2 using "make buildworld", "make libraries", and "make includes" but
> > I need to be able to do selective builds of just subdirectories after that..  I haven't spotted the right way of forcing the use of the "--system_root /mumble2" option in the compiles.
> > 
> > I know we do it in 'buildworld' is there a more generic way?
> > 
> > I have been looking in the .mk files but I haven't spotted it so far.
> 
> You’re asking for some serious split-brain action. chroot builds are likely your best option. There’s no easy way to force this, although you might get some milage out of WMAKEENV options, but I think we bake most of the where to look for things options into the binaries. One crazy option would be to set CC=“cc —sysroot /mumble” but I’m sure there be dragons there…
> 
> Good luck with this crazy, never have we supported it very well, option :)
> 
> Warner

Actually the hooks are in place to do this stuff.  Instead of make
buildenv to get an interactive shell you can do something like

  BLDENV=`${MAKE} buildenvvars`
  chroot buildchroot/ "env -i $${BLDENV} cd /usr/src/somewhere && \
       make all install" 

-- Ian




More information about the freebsd-current mailing list