xref: /freebsd/share/mk/bsd.incs.mk (revision 1a682d2cea21bc46d683533c5368c3a2c6dc1fc2)
1c7b111cbSRuslan Ermilov# $FreeBSD$
2c7b111cbSRuslan Ermilov
3c7b111cbSRuslan Ermilov.if !target(__<bsd.init.mk>__)
4c7b111cbSRuslan Ermilov.error bsd.incs.mk cannot be included directly.
5c7b111cbSRuslan Ermilov.endif
6c7b111cbSRuslan Ermilov
7347c9de0SWarner Losh.if ${MK_TOOLCHAIN} != "no"
8b8435aa8SRuslan Ermilov
9c7b111cbSRuslan ErmilovINCSGROUPS?=	INCS
10c7b111cbSRuslan Ermilov
115d862037SRuslan Ermilov.if !target(buildincludes)
12c7b111cbSRuslan Ermilov.for group in ${INCSGROUPS}
135d862037SRuslan Ermilovbuildincludes: ${${group}}
14c7b111cbSRuslan Ermilov.endfor
15c7b111cbSRuslan Ermilov.endif
16c7b111cbSRuslan Ermilov
175d862037SRuslan Ermilovall: buildincludes
18c7b111cbSRuslan Ermilov
195d862037SRuslan Ermilov.if !target(installincludes)
20c7b111cbSRuslan Ermilov.for group in ${INCSGROUPS}
21c7b111cbSRuslan Ermilov.if defined(${group}) && !empty(${group})
22c7b111cbSRuslan Ermilov
23c7b111cbSRuslan Ermilov${group}OWN?=	${BINOWN}
24c7b111cbSRuslan Ermilov${group}GRP?=	${BINGRP}
25c7b111cbSRuslan Ermilov${group}MODE?=	${NOBINMODE}
26c7b111cbSRuslan Ermilov${group}DIR?=	${INCLUDEDIR}
277750ad47SMarcel MoolenaarSTAGE_SETS+=	${group}
287750ad47SMarcel MoolenaarSTAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR}
29bd64a3c9SSimon J. GerratySTAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP}
30c7b111cbSRuslan Ermilov
31c7b111cbSRuslan Ermilov_${group}INCS=
32c7b111cbSRuslan Ermilov.for header in ${${group}}
33c7b111cbSRuslan Ermilov.if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \
34c7b111cbSRuslan Ermilov    defined(${group}MODE_${header:T}) || defined(${group}DIR_${header:T}) || \
356427a5d4SSimon J. Gerraty    defined(${group}NAME_${header:T}) || defined(${group}NAME)
36c7b111cbSRuslan Ermilov${group}OWN_${header:T}?=	${${group}OWN}
37c7b111cbSRuslan Ermilov${group}GRP_${header:T}?=	${${group}GRP}
38c7b111cbSRuslan Ermilov${group}MODE_${header:T}?=	${${group}MODE}
39c7b111cbSRuslan Ermilov${group}DIR_${header:T}?=	${${group}DIR}
40c7b111cbSRuslan Ermilov.if defined(${group}NAME)
41c7b111cbSRuslan Ermilov${group}NAME_${header:T}?=	${${group}NAME}
42c7b111cbSRuslan Ermilov.else
43c7b111cbSRuslan Ermilov${group}NAME_${header:T}?=	${header:T}
44c7b111cbSRuslan Ermilov.endif
457750ad47SMarcel MoolenaarSTAGE_AS_SETS+= ${group}
467750ad47SMarcel MoolenaarSTAGE_AS_${header:T}= ${${group}NAME_${header:T}}
477750ad47SMarcel Moolenaarstage_as.${group}: ${header}
48*1a682d2cSSimon J. Gerratystage_includes: stage_as.${group}
497750ad47SMarcel Moolenaar
505d862037SRuslan Ermilovinstallincludes: _${group}INS_${header:T}
51c7b111cbSRuslan Ermilov_${group}INS_${header:T}: ${header}
52c7b111cbSRuslan Ermilov	${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
53c7b111cbSRuslan Ermilov	    -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
54c7b111cbSRuslan Ermilov	    ${.ALLSRC} \
55c7b111cbSRuslan Ermilov	    ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
56c7b111cbSRuslan Ermilov.else
57c7b111cbSRuslan Ermilov_${group}INCS+= ${header}
58c7b111cbSRuslan Ermilov.endif
59c7b111cbSRuslan Ermilov.endfor
60c7b111cbSRuslan Ermilov.if !empty(_${group}INCS)
617750ad47SMarcel Moolenaarstage_files.${group}: ${_${group}INCS}
62*1a682d2cSSimon J. Gerratystage_includes: stage_files.${group}
637750ad47SMarcel Moolenaar
645d862037SRuslan Ermilovinstallincludes: _${group}INS
65c7b111cbSRuslan Ermilov_${group}INS: ${_${group}INCS}
66c7b111cbSRuslan Ermilov.if defined(${group}NAME)
67c7b111cbSRuslan Ermilov	${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
68c7b111cbSRuslan Ermilov	    ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
69c7b111cbSRuslan Ermilov.else
70c7b111cbSRuslan Ermilov	${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
71c7b111cbSRuslan Ermilov	    ${.ALLSRC} ${DESTDIR}${${group}DIR}
72c7b111cbSRuslan Ermilov.endif
73c7b111cbSRuslan Ermilov.endif
74c7b111cbSRuslan Ermilov
7584aac273SHartmut Brandt.endif # defined(${group}) && !empty(${group})
76c7b111cbSRuslan Ermilov.endfor
77c7b111cbSRuslan Ermilov
78c7b111cbSRuslan Ermilov.if defined(INCSLINKS) && !empty(INCSLINKS)
795d862037SRuslan Ermilovinstallincludes:
80c7b111cbSRuslan Ermilov	@set ${INCSLINKS}; \
81c7b111cbSRuslan Ermilov	while test $$# -ge 2; do \
82c7b111cbSRuslan Ermilov		l=$$1; \
83c7b111cbSRuslan Ermilov		shift; \
84c7b111cbSRuslan Ermilov		t=${DESTDIR}$$1; \
85c7b111cbSRuslan Ermilov		shift; \
86c7b111cbSRuslan Ermilov		${ECHO} $$t -\> $$l; \
8712dd8cb1SBrooks Davis		${INSTALL_SYMLINK} $$l $$t; \
88c7b111cbSRuslan Ermilov	done; true
89c7b111cbSRuslan Ermilov.endif
9084aac273SHartmut Brandt.endif # !target(installincludes)
915d862037SRuslan Ermilov
925d862037SRuslan Ermilovrealinstall: installincludes
93badb7c1cSRuslan Ermilov.ORDER: beforeinstall installincludes
94b8435aa8SRuslan Ermilov
956427a5d4SSimon J. Gerraty.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD)
96*1a682d2cSSimon J. Gerraty.if !defined(NO_STAGE_INCLUDES)
97*1a682d2cSSimon J. Gerratystaging: stage_includes
986427a5d4SSimon J. Gerraty.if !empty(INCSLINKS)
998fe4beeeSSimon J. Gerratystaging: stage_symlinks
1005ac3e457SSimon J. GerratySTAGE_SYMLINKS.INCS= ${INCSLINKS}
1017750ad47SMarcel Moolenaar.endif
1027750ad47SMarcel Moolenaar.endif
1037750ad47SMarcel Moolenaar.endif
1047750ad47SMarcel Moolenaar
105347c9de0SWarner Losh.endif # ${MK_TOOLCHAIN} != "no"
106