1# $FreeBSD$ 2 3.if !target(__<bsd.init.mk>__) 4.error bsd.incs.mk cannot be included directly. 5.endif 6 7INCSGROUPS?= INCS 8 9.if !target(buildincludes) 10.for group in ${INCSGROUPS} 11buildincludes: ${${group}} 12.endfor 13.endif 14 15all: buildincludes 16 17.if !target(installincludes) 18.for group in ${INCSGROUPS} 19.if defined(${group}) && !empty(${group}) 20 21${group}OWN?= ${BINOWN} 22${group}GRP?= ${BINGRP} 23${group}MODE?= ${NOBINMODE} 24${group}DIR?= ${INCLUDEDIR} 25 26_${group}INCS= 27.for header in ${${group}} 28.if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \ 29 defined(${group}MODE_${header:T}) || defined(${group}DIR_${header:T}) || \ 30 defined(${group}NAME_${header:T}) 31${group}OWN_${header:T}?= ${${group}OWN} 32${group}GRP_${header:T}?= ${${group}GRP} 33${group}MODE_${header:T}?= ${${group}MODE} 34${group}DIR_${header:T}?= ${${group}DIR} 35.if defined(${group}NAME) 36${group}NAME_${header:T}?= ${${group}NAME} 37.else 38${group}NAME_${header:T}?= ${header:T} 39.endif 40installincludes: _${group}INS_${header:T} 41_${group}INS_${header:T}: ${header} 42 ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ 43 -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ 44 ${.ALLSRC} \ 45 ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} 46.else 47_${group}INCS+= ${header} 48.endif 49.endfor 50.if !empty(_${group}INCS) 51installincludes: _${group}INS 52_${group}INS: ${_${group}INCS} 53.if defined(${group}NAME) 54 ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ 55 ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} 56.else 57 ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ 58 ${.ALLSRC} ${DESTDIR}${${group}DIR} 59.endif 60.endif 61 62.endif defined(${group}) && !empty(${group}) 63.endfor 64 65.if defined(INCSLINKS) && !empty(INCSLINKS) 66installincludes: 67 @set ${INCSLINKS}; \ 68 while test $$# -ge 2; do \ 69 l=$$1; \ 70 shift; \ 71 t=${DESTDIR}$$1; \ 72 shift; \ 73 ${ECHO} $$t -\> $$l; \ 74 ln -fs $$l $$t; \ 75 done; true 76.endif 77.endif !target(installincludes) 78 79realinstall: installincludes 80.ORDER: beforeinstall installincludes 81