Subject: Need DESTDIR (or equivalent) for installs without -nostdinc &c?
To: None <tech-toolchain@netbsd.org>
From: Jonathan Stone <jonathan@dsg.stanford.edu>
List: tech-toolchain
Date: 12/02/2004 12:52:55
I have an application with Makefiles that want to set DESTDIR, to
prefix the target-tree for `install' targets, so that the result of
various different builds get installed in various places.
The extant Makefiles are from an older derivative of bmake, wherein
setting DESTDIR has just the effect I describe.
I haven't looked hard, but the simplest and cleanest way I can see to
get the effect I desire is smoething liek this:
1. Move all the ${DESTDIR:D ...} checks from our
bsd.{dep,lib,prog,sys}.mk into a new file, say bsd.cross.mk.
bsd.cross.mk will be responsible for giving appropriate values
to a few new make symbols, say DESTCFLAGS, DESTCXXFLAGS,
DESTLINTFLAGS, DESTSYSFLAGS.
2. Instead of using ${DESTDIR:D} macros directly in in-place rules,
or setting CFLAGS or CXXFLAGS directly to ${DESTDIR:D ...} expansions,
bsd.*.mk files will include bsd.cross.mk, and then add DESTCFLAGS
to CFLAGS, DESTCXXFLAGS to CFLAGS, etc., as appropriate.
3. bsd.cross.mk will have its assignments of the DEST*FLAGS symbols
all protected by some suitable .ifndef/.endif test, enabling
those who wish to set DESTDIR but to also disable the NetBSD-normal
implicit side effects of setting DESTDIR.
I'll be testing on a patch based on this scheme later today. But is
there some simpler way to achieve this that I'm totally missing?