add bsd.kinc.mk, a template to support the new kernel include file

installation mechanism.
This commit is contained in:
cgd 1998-06-12 23:28:53 +00:00
parent 651b44e211
commit 2125120c77
3 changed files with 135 additions and 5 deletions

View File

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.20 1998/04/14 07:56:56 agc Exp $
# $NetBSD: Makefile,v 1.21 1998/06/12 23:28:53 cgd Exp $
# @(#)Makefile 8.1 (Berkeley) 6/8/93
FILES= bsd.README bsd.doc.mk bsd.dep.mk bsd.files.mk bsd.inc.mk bsd.kmod.mk \
bsd.lib.mk bsd.links.mk bsd.man.mk bsd.nls.mk bsd.obj.mk bsd.own.mk \
bsd.prog.mk bsd.subdir.mk bsd.sys.mk sys.mk
FILES= bsd.README bsd.doc.mk bsd.dep.mk bsd.files.mk bsd.inc.mk bsd.kinc.mk \
bsd.kmod.mk bsd.lib.mk bsd.links.mk bsd.man.mk bsd.nls.mk bsd.obj.mk \
bsd.own.mk bsd.prog.mk bsd.subdir.mk bsd.sys.mk sys.mk
FILESDIR=/usr/share/mk
NOOBJ= noobj

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.README,v 1.38 1998/05/13 13:58:00 simonb Exp $
# $NetBSD: bsd.README,v 1.39 1998/06/12 23:28:53 cgd Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the new make "include" files for the BSD
@ -424,6 +424,14 @@ INCSDIR The location to install the include files.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.kinc.mk> defines the many targets (includes,
subdirectories, etc.), and is used by kernel makefiles to handle
include file installation. It is intended to be included alone, by
kernel Makefiles. Please see bsd.kinc.mk for more details, and keep
the documentation in that file up to date.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
<bsd.lib.mk>. It contains overrides that are used when building
the NetBSD source tree. For instance, if "PARALLEL" is defined by

122
share/mk/bsd.kinc.mk Normal file
View File

@ -0,0 +1,122 @@
# $NetBSD: bsd.kinc.mk,v 1.1 1998/06/12 23:28:53 cgd Exp $
# Notes:
# * no obj dir support
# * kernel headers are supposed to exist, i.e. they're not
# expected to be built.
#
# System configuration variables:
#
# SYS_INCLUDE "symlinks": symlinks to include directories are created.
# This may not work 100% properly for all headers.
#
# "copies": directories are made, if necessary, and headers
# are installed into them.
#
# Variables:
#
# INCSDIR Directory to install includes into (and/or make, and/or
# symlink, depending on what's going on).
#
# KDIR Kernel directory to symlink to, if SYS_INCLUDE is symlinks.
# If unspecified, no action will be taken when making include
# for the directory if SYS_INCLUDE is symlinks.
#
# INCS Headers to install, if SYS_INCLUDE is copies.
#
# SUBDIR Subdirectories to enter
#
# SYMLINKS Symlinks to make (unconditionally), a la bsd.links.mk.
# Note that the original bits will be 'rm -rf'd rather than
# just 'rm -f'd, to make the right thing happen with include
# directories.
#
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.MAIN: all
.endif
# Change SYS_INCLUDE in bsd.own.mk or /etc/mk.conf to "symlinks" if you
# don't want copies
SYS_INCLUDE?= copies
# If DESTDIR is set, we're probably building a release, so force "copies".
.if defined(DESTDIR) && (${DESTDIR} != "/" && !empty(DESTDIR))
SYS_INCLUDE= copies
.endif
.PHONY: incinstall
includes: ${INCS} incinstall
.if ${SYS_INCLUDE} == "symlinks"
# don't install includes, just make symlinks.
.if defined(KDIR)
SYMLINKS+= ${KDIR} ${INCSDIR}
.endif
.else # not symlinks
# make sure the directory is OK, and install includes.
.PRECIOUS: ${DESTDIR}${INCSDIR}
.PHONY: ${DESTDIR}${INCSDIR}
${DESTDIR}${INCSDIR}:
@if [ ! -d ${.TARGET} ] || [ -L ${.TARGET} ] ; then \
echo creating ${.TARGET}; \
/bin/rm -rf ${.TARGET}; \
${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 ${.TARGET}; \
fi
incinstall:: ${DESTDIR}${INCSDIR}
.if defined(INCS)
.for I in ${INCS}
incinstall:: ${DESTDIR}${INCSDIR}/$I
.PRECIOUS: ${DESTDIR}${INCSDIR}/$I
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${INCSDIR}/$I
.endif
${DESTDIR}${INCSDIR}/$I: ${DESTDIR}${INCSDIR} $I
@cmp -s $I ${.TARGET} > /dev/null 2>&1 || \
(echo "${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
$I ${.TARGET}" && \
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
$I ${.TARGET})
.endfor
.endif
.endif # not symlinks
.if defined(SYMLINKS) && !empty(SYMLINKS)
incinstall::
@set ${SYMLINKS}; \
while test $$# -ge 2; do \
l=$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
echo ".include <bsd.own.mk>"; \
echo "all:: $$t"; \
echo ".PHONY: $$t"; \
echo "$$t:"; \
echo " @echo \"$$t -> $$l\""; \
echo " @rm -rf $$t"; \
echo " @ln -s $$l $$t"; \
done | make -f-
.endif
.if !target(incinstall)
incinstall::
.endif
.include <bsd.subdir.mk>