1# $FreeBSD$ 2 3.if !target(__<bsd.init.mk>__) 4.error bsd.files.mk cannot be included directly. 5.endif 6 7.if !target(__<bsd.files.mk>__) 8__<bsd.files.mk>__: 9 10FILESGROUPS?= FILES 11 12.for group in ${FILESGROUPS} 13# Add in foo.yes and remove duplicates from all the groups 14${${group}}:= ${${group}} ${${group}.yes} 15${${group}}:= ${${group}:O:u} 16buildfiles: ${${group}} 17.endfor 18 19.if !defined(_SKIP_BUILD) 20all: buildfiles 21.endif 22 23.for group in ${FILESGROUPS} 24.if defined(${group}) && !empty(${group}) 25installfiles: installfiles-${group} 26 27${group}OWN?= ${SHAREOWN} 28${group}GRP?= ${SHAREGRP} 29.if ${MK_INSTALL_AS_USER} == "yes" 30${group}OWN= ${SHAREOWN} 31${group}GRP= ${SHAREGRP} 32.endif 33${group}MODE?= ${SHAREMODE} 34${group}DIR?= ${BINDIR} 35STAGE_SETS+= ${group:C,[/*],_,g} 36STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR} 37 38.if defined(NO_ROOT) 39.if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} 40${group}TAGS+= package=${${group}PACKAGE:Uruntime} 41.endif 42${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g} 43.endif 44 45 46_${group}FILES= 47.for file in ${${group}} 48.if defined(${group}OWN_${file:T}) || defined(${group}GRP_${file:T}) || \ 49 defined(${group}MODE_${file:T}) || defined(${group}DIR_${file:T}) || \ 50 defined(${group}NAME_${file:T}) || defined(${group}NAME) 51${group}OWN_${file:T}?= ${${group}OWN} 52${group}GRP_${file:T}?= ${${group}GRP} 53.if ${MK_INSTALL_AS_USER} == "yes" 54${group}OWN_${file:T}= ${SHAREOWN} 55${group}GRP_${file:T}= ${SHAREGRP} 56.endif 57${group}MODE_${file:T}?= ${${group}MODE} 58${group}DIR_${file:T}?= ${${group}DIR} 59.if defined(${group}NAME) 60${group}NAME_${file:T}?= ${${group}NAME} 61.else 62${group}NAME_${file:T}?= ${file:T} 63.endif 64STAGE_AS_SETS+= ${file:T} 65STAGE_AS_${file:T}= ${${group}NAME_${file:T}} 66# XXX {group}OWN,GRP,MODE 67STAGE_DIR.${file:T}= ${STAGE_OBJTOP}${${group}DIR_${file:T}} 68stage_as.${file:T}: ${file} 69 70installfiles-${group}: _${group}INS_${file:T} 71_${group}INS_${file:T}: ${file} 72 ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${.ALLSRC:T}} \ 73 -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ 74 ${.ALLSRC} \ 75 ${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}} 76.else 77_${group}FILES+= ${file} 78.endif 79.endfor 80.if !empty(_${group}FILES) 81stage_files.${group}: ${_${group}FILES} 82 83installfiles-${group}: _${group}INS 84_${group}INS: ${_${group}FILES} 85.if defined(${group}NAME) 86 ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN} -g ${${group}GRP} \ 87 -m ${${group}MODE} ${.ALLSRC} \ 88 ${DESTDIR}${${group}DIR}/${${group}NAME} 89.else 90 ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN} -g ${${group}GRP} \ 91 -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}/ 92.endif 93.endif 94 95.endif # defined(${group}) && !empty(${group}) 96.endfor 97 98realinstall: installfiles 99.ORDER: beforeinstall installfiles 100 101.if ${MK_STAGING} != "no" 102.if !empty(STAGE_SETS) 103buildfiles: stage_files 104.if !empty(STAGE_AS_SETS) 105buildfiles: stage_as 106.endif 107.endif 108.endif 109 110.endif # !target(__<bsd.files.mk>__) 111