NetBSD/share/mk/bsd.inc.mk
cjs 5fd7ce7066 These updates to the build allow building against include files
and libs in the object tree, if you use a separate object tree,
while maintaining backward compatability with other build methods.
See the notes in src/share/mk/bsd.README for full details. Note
that the `make includes' target now only installs the include files
in the build directory (if you use one--otherwise they go in DESTDIR
just like before); `make install' will install include files in
DESTDIR.
1997-05-26 03:55:19 +00:00

62 lines
1.5 KiB
Makefile

# $NetBSD: bsd.inc.mk,v 1.8 1997/05/26 03:58:00 cjs Exp $
#
# If an include file is already installed, this always compares the
# installed file to the one we are about to install. If they are the
# same, it doesn't do the install. This is to avoid triggering massive
# amounts of rebuilding.
#
# Targets:
#
# includes:
# Installs the include files in BUILDDIR if we are using one, DESTDIR
# otherwise. This is to be run before `make depend' or `make'.
#
# install:
# Installs the include files in DESTDIR.
#
.PHONY: incbuild incinstall
.if defined(INCS)
.for I in ${INCS}
.if defined(OBJDIR)
.PRECIOUS: ${BUILDDIR}${INCSDIR}/$I
${BUILDDIR}${INCSDIR}/$I: $I
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${INSTALL} -d `dirname ${.TARGET}`" && \
${INSTALL} -d `dirname ${.TARGET}` && \
echo "${INSTALL} -c -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \
${INSTALL} -c -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
incbuild:: ${BUILDDIR}${INCSDIR}/$I
.else
incbuild:: ${DESTDIR}${INCSDIR}/$I
.endif # defined(OBJDIR)
.PRECIOUS: ${DESTDIR}${INCSDIR}/$I
${DESTDIR}${INCSDIR}/$I: $I
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
${.ALLSRC} ${.TARGET}" && \
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
${.ALLSRC} ${.TARGET})
incinstall:: ${DESTDIR}${INCSDIR}/$I
.endfor
includes: ${INCS} incbuild
install: ${INCS} incinstall
.endif # defined(INCS)
.if !target(incbuild)
incbuild::
.endif
.if !target(incinstall)
incinstall::
.endif