bsd.incs.mk revision 156813
11556Srgrimes# $FreeBSD: head/share/mk/bsd.incs.mk 156813 2006-03-17 18:54:44Z ru $
21556Srgrimes
31556Srgrimes.if !target(__<bsd.init.mk>__)
41556Srgrimes.error bsd.incs.mk cannot be included directly.
51556Srgrimes.endif
61556Srgrimes
71556Srgrimes.if !defined(NO_INCS) && ${MK_TOOLCHAIN} != "no"
81556Srgrimes
91556SrgrimesINCSGROUPS?=	INCS
101556Srgrimes
111556Srgrimes.if !target(buildincludes)
121556Srgrimes.for group in ${INCSGROUPS}
131556Srgrimesbuildincludes: ${${group}}
141556Srgrimes.endfor
151556Srgrimes.endif
161556Srgrimes
171556Srgrimesall: buildincludes
181556Srgrimes
191556Srgrimes.if !target(installincludes)
201556Srgrimes.for group in ${INCSGROUPS}
211556Srgrimes.if defined(${group}) && !empty(${group})
221556Srgrimes
231556Srgrimes${group}OWN?=	${BINOWN}
241556Srgrimes${group}GRP?=	${BINGRP}
251556Srgrimes${group}MODE?=	${NOBINMODE}
261556Srgrimes${group}DIR?=	${INCLUDEDIR}
271556Srgrimes
281556Srgrimes_${group}INCS=
291556Srgrimes.for header in ${${group}}
301556Srgrimes.if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \
311556Srgrimes    defined(${group}MODE_${header:T}) || defined(${group}DIR_${header:T}) || \
3217987Speter    defined(${group}NAME_${header:T})
3350471Speter${group}OWN_${header:T}?=	${${group}OWN}
341556Srgrimes${group}GRP_${header:T}?=	${${group}GRP}
351556Srgrimes${group}MODE_${header:T}?=	${${group}MODE}
36111422Smarcel${group}DIR_${header:T}?=	${${group}DIR}
3717987Speter.if defined(${group}NAME)
38196483Sjilles${group}NAME_${header:T}?=	${${group}NAME}
391556Srgrimes.else
401556Srgrimes${group}NAME_${header:T}?=	${header:T}
411556Srgrimes.endif
421556Srgrimesinstallincludes: _${group}INS_${header:T}
431556Srgrimes_${group}INS_${header:T}: ${header}
441556Srgrimes	${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \
451556Srgrimes	    -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
461556Srgrimes	    ${.ALLSRC} \
471556Srgrimes	    ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
481556Srgrimes.else
49117261Sdds_${group}INCS+= ${header}
50117261Sdds.endif
51117261Sdds.endfor
52117261Sdds.if !empty(_${group}INCS)
531556Srgrimesinstallincludes: _${group}INS
541556Srgrimes_${group}INS: ${_${group}INCS}
551556Srgrimes.if defined(${group}NAME)
561556Srgrimes	${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
5790111Simp	    ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
5890111Simp.else
5990111Simp	${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
6090111Simp	    ${.ALLSRC} ${DESTDIR}${${group}DIR}
6190111Simp.endif
621556Srgrimes.endif
631556Srgrimes
641556Srgrimes.endif # defined(${group}) && !empty(${group})
651556Srgrimes.endfor
661556Srgrimes
671556Srgrimes.if defined(INCSLINKS) && !empty(INCSLINKS)
681556Srgrimesinstallincludes:
69196483Sjilles	@set ${INCSLINKS}; \
7090111Simp	while test $$# -ge 2; do \
7117987Speter		l=$$1; \
72196483Sjilles		shift; \
73196483Sjilles		t=${DESTDIR}$$1; \
7417987Speter		shift; \
7517987Speter		${ECHO} $$t -\> $$l; \
76196483Sjilles		ln -fs $$l $$t; \
7717987Speter	done; true
7817987Speter.endif
79196483Sjilles.endif # !target(installincludes)
80196483Sjilles
81196483Sjillesrealinstall: installincludes
82196483Sjilles.ORDER: beforeinstall installincludes
83196483Sjilles
84196483Sjilles.endif # !defined(NO_INCS) && ${MK_TOOLCHAIN} != "no"
851556Srgrimes