Subject: Re: Using BSD-style Makefiles & pkgsrc
To: Peter Bex <>
From: Frederick Bruckman <>
List: netbsd-users
Date: 11/04/2004 22:16:36
In article <>, (Peter Bex) writes:
> For example, I know pkgsrc sets PREFIX and with DESTDIR I can control where
> BSD-style Makefiles see the `root' for installation (although it expects
> that there is a /usr dir, which isn't under /usr/local usually), so I
> currently have something that looks like this in
> PREFIX?=	/usr/local
> LIBDIR?=	/lib
> BINDIR?=	/bin
> Is this the correct way to do this or is this something I should not want (=
> or isn't even possible)?

The usual convention, is that ${DESTDIR} is reserved for cross-building.
It's empty by default. You install to ${DESTDIR}${PREFIX}, but any paths,
including run-paths embedded in shared libraries, omit the ${DESTDIR}
part.  If you use <>, or <>, the ${DESTDIR} handling
is automatic.  ${PREFIX} isn't recognized as anything special though, so
your ${LIBDIR} should probably be ${PREFIX}/lib, and ${BINDIR} should be

"pkgsrc" does know about ${PREFIX}, and will set it in the environment
before invoking the package's own "make" mechanism. It tries to do the
right thing with ${DESTDIR}, too. In fact, it typically sets ${PREFIX}
to "${DESTDIR}/usr/pkg". Therefore, you shouldn't set or use ${DESTDIR}
at all, but just set ${PREFIX} conditionally, and key off of that.