Subject: Making "distrib-dirs" in /usr/src/Makefile
To: None <current-users@NetBSD.ORG>
From: Greg Earle <earle@isolar.Tujunga.CA.US>
List: current-users
Date: 05/20/1996 00:56:28
In the current /usr/src/Makefile, there is the following snippet:

beforeinstall:
.ifndef DESTDIR
	(cd ${.CURDIR}/etc && ${MAKE} obj && ${MAKE} DESTDIR=/ distrib-dirs)
.else
	(cd ${.CURDIR}/etc && ${MAKE} obj && ${MAKE} distrib-dirs)
.endif

This only gets invoked at the very end of a "make build", i.e. during the last
step:

	${MAKE} depend && ${MAKE} && ${MAKE} install

But if you're using DESTDIR, you probably don't have (or might not have, if
you've just freshly created it) the $DESTDIR directory heirarchy all in place.
So you kinda need to do "make distrib-dirs" right off the bat, even before
the "make install" in /usr/src/share/mk (since either the "make install" or
the subsequent "make includes" installs will fail, as there won't be target
installation directories under $DESTDIR).

I'm not sure what's the right way to deal with this, though.  Anyone more
conversant with "make" and the build process care to offer their opinion?

I was thinking of changing

build:
	(cd ${.CURDIR}/share/mk && ${MAKE} install)

to

build:
	${MAKE} beforeinstall
	(cd ${.CURDIR}/share/mk && ${MAKE} install)

but this looks kludgy and of course it will get run twice as a result.

Wouldn't it be better to remove it from being a "beforeinstall:" target and
just put it at the start of the build target?  Or Am I Missing Something[tm]?

	- Greg