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