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}: installdirs-${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 81 82installdirs-${group}: 83 @echo installing dirs ${group}DIR ${${group}DIR} 84.for dir in ${${group}DIR} 85.if defined(NO_ROOT) 86 ${INSTALL} ${${group}TAG_ARGS} -d ${DESTDIR}${dir} 87.else 88 ${INSTALL} ${${group}TAG_ARGS} -d -o ${DIROWN} -g ${DIRGRP} \ 89 -m ${DIRMODE} ${DESTDIR}${dir} 90.endif 91.endfor 92 93 94.if !empty(_${group}FILES) 95stage_files.${group}: ${_${group}FILES} 96 97installfiles-${group}: installdirs-${group} _${group}INS 98_${group}INS: ${_${group}FILES} 99.if defined(${group}NAME) 100 ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN} -g ${${group}GRP} \ 101 -m ${${group}MODE} ${.ALLSRC} \ 102 ${DESTDIR}${${group}DIR}/${${group}NAME} 103.else 104 ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN} -g ${${group}GRP} \ 105 -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}/ 106.endif 107.endif 108 109.endif # defined(${group}) && !empty(${group}) 110.endfor 111 112realinstall: installfiles 113.ORDER: beforeinstall installfiles 114 115.if ${MK_STAGING} != "no" 116.if !empty(STAGE_SETS) 117buildfiles: stage_files 118.if !empty(STAGE_AS_SETS) 119buildfiles: stage_as 120.endif 121.endif 122.endif 123 124.endif # !target(__<bsd.files.mk>__) 125