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