1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# $NetBSD: bsd.kinc.mk,v 1.1.1.1 2004/03/11 13:04:17 grant Exp $
# 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.
#
# DEPINCS Headers to install which are built dynamically.
#
# 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.
incinstall:: ${DESTDIR}${INCSDIR}
.PRECIOUS: ${DESTDIR}${INCSDIR}
.PHONY: ${DESTDIR}${INCSDIR}
${DESTDIR}${INCSDIR}:
@if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \
echo creating ${.TARGET}; \
/bin/rm -rf ${.TARGET}; \
${INSTALL} ${INSTPRIV} -d -o ${BINOWN} \
-g ${BINGRP} -m 755 ${.TARGET}; \
fi
.if defined(INCS)
incinstall:: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.PRECIOUS: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.if !defined(UPDATE)
.PHONY: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.endif
__incinstall: .USE
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${INSTALL} ${RENAME} ${PRESERVE} ${INSTPRIV} -c \
-o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
${.ALLSRC} ${.TARGET}" && \
${INSTALL} ${RENAME} ${PRESERVE} ${INSTPRIV} -c \
-o ${BINOWN} \
-g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
.for I in ${INCS:O:u}
${DESTDIR}${INCSDIR}/$I: $I __incinstall
.endfor
.endif
.if defined(DEPINCS)
incinstall:: ${DEPINCS:@I@${DESTDIR}${INCSDIR}/$I@}
.PRECIOUS: ${DEPINCS:@I@${DESTDIR}${INCSDIR}/$I@}
.if !defined(UPDATE)
.PHONY: ${DEPINCS:@I@${DESTDIR}${INCSDIR}/$I@}
.endif
__depincinstall: .USE
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${INSTALL} ${RENAME} ${PRESERVE} -c \
-o ${BINOWN} \
-g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \
${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} \
-g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
.for I in ${DEPINCS:O:u}
${DESTDIR}${INCSDIR}/$I: $I __depincinstall
.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; \
if [ -h $$t ]; then \
cur=`ls -ld $$t | awk '{print $$NF}'` ; \
if [ "$$cur" = "$$l" ]; then \
continue ; \
fi; \
fi; \
echo "$$t -> $$l"; \
rm -rf $$t; ln -s $$l $$t; \
done; )
.endif
.if !target(incinstall)
incinstall::
.endif
.include <bsd.subdir.mk>
|