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.if !defined(NO_TOOLCHAIN) 43 ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ 44 -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ 45 ${.ALLSRC} \ 46 ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} 47.endif 48.else 49_${group}INCS+= ${header} 50.endif 51.endfor 52.if !empty(_${group}INCS) 53installincludes: _${group}INS 54_${group}INS: ${_${group}INCS} 55.if !defined(NO_TOOLCHAIN) 56.if defined(${group}NAME) 57 ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ 58 ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} 59.else 60 ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ 61 ${.ALLSRC} ${DESTDIR}${${group}DIR} 62.endif 63.endif # !defined(NO_TOOLCHAIN) 64.endif 65 66.endif # defined(${group}) && !empty(${group}) 67.endfor 68 69.if defined(INCSLINKS) && !empty(INCSLINKS) 70installincludes: 71.if !defined(NO_TOOLCHAIN) 72 @set ${INCSLINKS}; \ 73 while test $$# -ge 2; do \ 74 l=$$1; \ 75 shift; \ 76 t=${DESTDIR}$$1; \ 77 shift; \ 78 ${ECHO} $$t -\> $$l; \ 79 ln -fs $$l $$t; \ 80 done; true 81.endif # !defined(NO_TOOLCHAIN) 82.endif 83.endif # !target(installincludes) 84 85realinstall: installincludes 86.ORDER: beforeinstall installincludes 87