1# $FreeBSD$ 2 3.if !target(__<bsd.init.mk>__) 4.error bsd.incs.mk cannot be included directly. 5.endif 6 7.if ${MK_INCLUDES} != "no" 8 9INCSGROUPS?= INCS 10 11.if !target(buildincludes) 12.for group in ${INCSGROUPS} 13buildincludes: ${${group}} 14.endfor 15.endif 16 17all: buildincludes 18 19.if !target(installincludes) 20.for group in ${INCSGROUPS} 21.if defined(${group}) && !empty(${group}) 22 23${group}OWN?= ${BINOWN} 24${group}GRP?= ${BINGRP} 25${group}MODE?= ${NOBINMODE} 26${group}DIR?= ${INCLUDEDIR}${PRIVATELIB:D/private/${LIB}} 27STAGE_SETS+= ${group} 28STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR} 29STAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP} 30 31_${group}INCS= 32.for header in ${${group}} 33.if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \ 34 defined(${group}MODE_${header:T}) || defined(${group}DIR_${header:T}) || \ 35 defined(${group}NAME_${header:T}) || defined(${group}NAME) 36${group}OWN_${header:T}?= ${${group}OWN} 37${group}GRP_${header:T}?= ${${group}GRP} 38${group}MODE_${header:T}?= ${${group}MODE} 39${group}DIR_${header:T}?= ${${group}DIR} 40.if defined(${group}NAME) 41${group}NAME_${header:T}?= ${${group}NAME} 42.else 43${group}NAME_${header:T}?= ${header:T} 44.endif 45STAGE_AS_SETS+= ${group} 46STAGE_AS_${header:T}= ${${group}NAME_${header:T}} 47stage_as.${group}: ${header} 48stage_includes: stage_as.${group} 49 50installincludes: _${group}INS_${header:T} 51_${group}INS_${header:T}: ${header} 52 ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ 53 -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ 54 ${.ALLSRC} \ 55 ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} 56.else 57_${group}INCS+= ${header} 58.endif 59.endfor 60.if !empty(_${group}INCS) 61stage_files.${group}: ${_${group}INCS} 62stage_includes: stage_files.${group} 63 64installincludes: _${group}INS 65_${group}INS: ${_${group}INCS} 66.if defined(${group}NAME) 67 ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ 68 ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} 69.else 70 ${INSTALL} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ 71 ${.ALLSRC} ${DESTDIR}${${group}DIR} 72.endif 73.endif 74 75.endif # defined(${group}) && !empty(${group}) 76.endfor 77 78.if defined(INCSLINKS) && !empty(INCSLINKS) 79installincludes: 80.for s t in ${INCSLINKS} 81 @${ECHO} "$t -> $s" ; \ 82 ${INSTALL_SYMLINK} $s ${DESTDIR}$t 83.endfor 84.endif 85.endif # !target(installincludes) 86 87realinstall: installincludes 88.ORDER: beforeinstall installincludes 89 90.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) 91.if !defined(NO_STAGE_INCLUDES) 92staging: stage_includes 93.if !empty(INCSLINKS) 94staging: stage_symlinks 95STAGE_SYMLINKS.INCS= ${INCSLINKS} 96.endif 97.endif 98.endif 99 100.endif # ${MK_TOOLCHAIN} != "no" 101