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 defined(NO_ROOT) 12.if !defined(TAGS) || ! ${TAGS:Mpackage=*} 13TAGS+= package=${PACKAGE:Uruntime} 14.endif 15TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} 16.endif 17 18.if !target(buildincludes) 19.for group in ${INCSGROUPS} 20buildincludes: ${${group}} 21.endfor 22.endif 23 24all: buildincludes 25 26.if !target(installincludes) 27.for group in ${INCSGROUPS} 28.if defined(${group}) && !empty(${group}) 29 30${group}OWN?= ${BINOWN} 31${group}GRP?= ${BINGRP} 32${group}MODE?= ${NOBINMODE} 33${group}DIR?= ${INCLUDEDIR}${PRIVATELIB:D/private/${LIB}} 34STAGE_SETS+= ${group} 35STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR} 36STAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP} 37 38_${group}INCS= 39.for header in ${${group}} 40.if defined(${group}OWN_${header:T}) || defined(${group}GRP_${header:T}) || \ 41 defined(${group}MODE_${header:T}) || defined(${group}DIR_${header:T}) || \ 42 defined(${group}NAME_${header:T}) || defined(${group}NAME) 43${group}OWN_${header:T}?= ${${group}OWN} 44${group}GRP_${header:T}?= ${${group}GRP} 45${group}MODE_${header:T}?= ${${group}MODE} 46${group}DIR_${header:T}?= ${${group}DIR} 47.if defined(${group}NAME) 48${group}NAME_${header:T}?= ${${group}NAME} 49.else 50${group}NAME_${header:T}?= ${header:T} 51.endif 52STAGE_AS_SETS+= ${header:T} 53STAGE_AS_${header:T}= ${${group}NAME_${header:T}} 54# XXX {group}OWN,GRP,MODE 55STAGE_DIR.${header:T}= ${STAGE_OBJTOP}${${group}DIR_${header:T}} 56stage_as.${header:T}: ${header} 57stage_includes: stage_as.${header:T} 58 59installincludes: _${group}INS_${header:T} 60_${group}INS_${header:T}: ${header} 61 ${INSTALL} -C -o ${${group}OWN_${.ALLSRC:T}} \ 62 -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ 63 ${.ALLSRC} \ 64 ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} 65.else 66_${group}INCS+= ${header} 67.endif 68.endfor 69.if !empty(_${group}INCS) 70stage_files.${group}: ${_${group}INCS} 71stage_includes: stage_files.${group} 72 73installincludes: _${group}INS 74_${group}INS: ${_${group}INCS} 75.if defined(${group}NAME) 76 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ 77 ${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME} 78.else 79 ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \ 80 ${.ALLSRC} ${DESTDIR}${${group}DIR}/ 81.endif 82.endif 83 84.endif # defined(${group}) && !empty(${group}) 85.endfor 86 87.if defined(INCSLINKS) && !empty(INCSLINKS) 88installincludes: 89.for s t in ${INCSLINKS} 90 @${ECHO} "$t -> $s" ; \ 91 ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} $s ${DESTDIR}$t 92.endfor 93.endif 94.endif # !target(installincludes) 95 96realinstall: installincludes 97.ORDER: beforeinstall installincludes 98 99.if ${MK_STAGING} != "no" && !defined(_SKIP_BUILD) 100.if !defined(NO_STAGE_INCLUDES) 101STAGE_TARGETS+= stage_includes 102.if !empty(INCSLINKS) 103STAGE_TARGETS+= stage_symlinks 104STAGE_SYMLINKS.INCS= ${INCSLINKS} 105.endif 106.endif 107.endif 108 109.endif # ${MK_INCLUDES} != "no" 110