1
# $NetBSD: bsd.kinc.mk,v 1.5 1999/02/04 11:58:30 christos Exp $
3
# System configuration variables:
5
# SYS_INCLUDE "symlinks": symlinks to include directories are created.
6
# This may not work 100% properly for all headers.
8
# "copies": directories are made, if necessary, and headers
9
# are installed into them.
13
# INCSDIR Directory to install includes into (and/or make, and/or
14
# symlink, depending on what's going on).
16
# KDIR Kernel directory to symlink to, if SYS_INCLUDE is symlinks.
17
# If unspecified, no action will be taken when making include
18
# for the directory if SYS_INCLUDE is symlinks.
20
# INCS Headers to install, if SYS_INCLUDE is copies.
22
# DEPINCS Headers to install which are built dynamically.
24
# SUBDIR Subdirectories to enter
26
# SYMLINKS Symlinks to make (unconditionally), a la bsd.links.mk.
27
# Note that the original bits will be 'rm -rf'd rather than
28
# just 'rm -f'd, to make the right thing happen with include
32
.if !target(__initialized__)
34
.if exists(${.CURDIR}/../Makefile.inc)
35
.include "${.CURDIR}/../Makefile.inc"
41
# Change SYS_INCLUDE in bsd.own.mk or /etc/mk.conf to "symlinks" if you
45
# If DESTDIR is set, we're probably building a release, so force "copies".
46
.if defined(DESTDIR) && (${DESTDIR} != "/" && !empty(DESTDIR))
52
includes: ${INCS} incinstall
55
.if ${SYS_INCLUDE} == "symlinks"
57
# don't install includes, just make symlinks.
60
SYMLINKS+= ${KDIR} ${INCSDIR}
65
# make sure the directory is OK, and install includes.
67
.PRECIOUS: ${DESTDIR}${INCSDIR}
68
.PHONY: ${DESTDIR}${INCSDIR}
70
@if [ ! -d ${.TARGET} ] || [ -L ${.TARGET} ] ; then \
71
echo creating ${.TARGET}; \
72
/bin/rm -rf ${.TARGET}; \
73
${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 ${.TARGET}; \
76
incinstall:: ${DESTDIR}${INCSDIR}
80
incinstall:: ${DESTDIR}${INCSDIR}/$I
82
.PRECIOUS: ${DESTDIR}${INCSDIR}/$I
84
.PHONY: ${DESTDIR}${INCSDIR}/$I
86
${DESTDIR}${INCSDIR}/$I: ${DESTDIR}${INCSDIR} $I
87
@cmp -s ${.CURDIR}/$I ${.TARGET} > /dev/null 2>&1 || \
88
(echo "${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} \
89
-g ${BINGRP} -m ${NONBINMODE} ${.CURDIR}/$I ${.TARGET}" && \
90
${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} -g ${BINGRP} \
91
-m ${NONBINMODE} ${.CURDIR}/$I ${.TARGET})
97
incinstall:: ${DESTDIR}${INCSDIR}/$I
99
.PRECIOUS: ${DESTDIR}${INCSDIR}/$I
101
.PHONY: ${DESTDIR}${INCSDIR}/$I
103
${DESTDIR}${INCSDIR}/$I: ${DESTDIR}${INCSDIR} $I
104
@cmp -s $I ${.TARGET} > /dev/null 2>&1 || \
105
(echo "${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} \
106
-g ${BINGRP} -m ${NONBINMODE} $I ${.TARGET}" && \
107
${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} -g ${BINGRP} \
108
-m ${NONBINMODE} $I ${.TARGET})
112
.endif # not symlinks
114
.if defined(SYMLINKS) && !empty(SYMLINKS)
117
while test $$# -ge 2; do \
122
echo ".include <bsd.own.mk>"; \
124
echo ".PHONY: $$t"; \
126
echo " @echo \"$$t -> $$l\""; \
127
echo " @rm -rf $$t"; \
128
echo " @ln -s $$l $$t"; \
132
.if !target(incinstall)
136
.include <bsd.subdir.mk>