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.if target(__<bsd.dirs.mk>__) 9.error bsd.dirs.mk must be included after bsd.files.mk. 10.endif 11 12__<bsd.files.mk>__: 13 14FILESGROUPS?= FILES 15 16.for group in ${FILESGROUPS} 17# Add in foo.yes and remove duplicates from all the groups 18${${group}}:= ${${group}} ${${group}.yes} 19${${group}}:= ${${group}:O:u} 20buildfiles: ${${group}} 21.endfor 22 23.if !defined(_SKIP_BUILD) 24all: buildfiles 25.endif 26 27.for group in ${FILESGROUPS} 28.if defined(${group}) && !empty(${group}) 29installfiles: installfiles-${group} 30 31${group}OWN?= ${SHAREOWN} 32${group}GRP?= ${SHAREGRP} 33.if ${MK_INSTALL_AS_USER} == "yes" 34${group}OWN= ${SHAREOWN} 35${group}GRP= ${SHAREGRP} 36.endif 37${group}MODE?= ${SHAREMODE} 38${group}DIR?= BINDIR 39STAGE_SETS+= ${group:C,[/*],_,g} 40 41.if ${group} == "FILES" 42FILESPACKAGE= ${PACKAGE} 43.endif 44 45.if defined(NO_ROOT) 46.if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} 47${group}TAGS+= package=${${group}PACKAGE:Uutilities} 48.endif 49${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g} 50.endif 51 52 53.if ${${group}DIR:S/^\///} == ${${group}DIR} 54# ${group}DIR specifies a variable that specifies a path 55DIRS+= ${${group}DIR} 56_${group}DIR= ${${group}DIR} 57.else 58# ${group}DIR specifies a path 59DIRS+= ${group}DIR 60_${group}DIR= ${group}DIR 61.endif 62 63STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}} 64 65.for file in ${${group}} 66${group}OWN_${file}?= ${${group}OWN} 67${group}GRP_${file}?= ${${group}GRP} 68.if ${MK_INSTALL_AS_USER} == "yes" 69${group}OWN_${file}= ${SHAREOWN} 70${group}GRP_${file}= ${SHAREGRP} 71.endif # ${MK_INSTALL_AS_USER} == "yes" 72${group}MODE_${file}?= ${${group}MODE} 73 74# Determine the directory for the current file. Default to the parent group 75# DIR, then check to see how to pass that variable on below. 76${group}DIR_${file}?= ${${group}DIR} 77.if ${${group}DIR_${file}:S/^\///} == ${${group}DIR_${file}} 78# DIR specifies a variable that specifies a path 79_${group}DIR_${file}= ${${group}DIR_${file}} 80.else 81# DIR directly specifies a path 82_${group}DIR_${file}= ${group}DIR_${file} 83.endif 84${group}PREFIX_${file}= ${DESTDIR}${${_${group}DIR_${file}}} 85 86# Append DIR to DIRS if not already in place -- DIRS is already filtered, so 87# this is primarily to ease inspection. 88.for d in ${DIRS} 89_DIRS+= ${${d}} 90.endfor 91.if ${DIRS:M${_${group}DIR_${file}}} == "" 92.if ${_DIRS:M${${_${group}DIR_${file}}}} == "" 93DIRS+= ${_${group}DIR_${file}} 94.else 95_${group}DIR_${file}= ${group}DIR 96.endif 97.endif 98 99.if defined(${group}NAME) 100${group}NAME_${file}?= ${${group}NAME} 101.else 102${group}NAME_${file}?= ${file:T} 103.endif # defined(${group}NAME) 104STAGE_AS_SETS+= ${file} 105STAGE_AS_${file}= ${${group}NAME_${file}} 106# XXX {group}OWN,GRP,MODE 107STAGE_DIR.${file}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}} 108stage_as.${file}: ${file} 109 110installfiles-${group}: _${group}INS1_${file} 111_${group}INS1_${file}: installdirs-${_${group}DIR_${file}} _${group}INS_${file} 112_${group}INS_${file}: ${file} 113 ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \ 114 -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \ 115 ${.ALLSRC} ${${group}PREFIX_${file}}/${${group}NAME_${file}} 116.endfor # file in ${${group}} 117 118.endif # defined(${group}) && !empty(${group}) 119.endfor # .for group in ${FILESGROUPS} 120 121realinstall: installfiles 122.ORDER: beforeinstall installfiles 123 124.if ${MK_STAGING} != "no" 125.if !empty(STAGE_SETS) 126buildfiles: stage_files 127STAGE_TARGETS+= stage_files 128.if !empty(STAGE_AS_SETS) 129buildfiles: stage_as 130STAGE_TARGETS+= stage_as 131.endif 132.endif 133.endif 134 135.include <bsd.dirs.mk> 136 137.endif # !target(__<bsd.files.mk>__) 138