3 .if !target(__<bsd.init.mk>__)
4 .error bsd.files.mk cannot be included directly.
7 .if !target(__<bsd.files.mk>__)
8 .if target(__<bsd.dirs.mk>__)
9 .error bsd.dirs.mk must be included after bsd.files.mk.
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}
20 buildfiles: ${${group}}
23 .if !defined(_SKIP_BUILD)
27 .for group in ${FILESGROUPS}
28 .if defined(${group}) && !empty(${group})
29 installfiles: installfiles-${group}
31 ${group}OWN?= ${SHAREOWN}
32 ${group}GRP?= ${SHAREGRP}
33 .if ${MK_INSTALL_AS_USER} == "yes"
34 ${group}OWN= ${SHAREOWN}
35 ${group}GRP= ${SHAREGRP}
37 ${group}MODE?= ${SHAREMODE}
39 STAGE_SETS+= ${group:C,[/*],_,g}
41 .if ${group} == "FILES"
42 FILESPACKAGE= ${PACKAGE:Uutilities}
46 .if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*}
47 ${group}TAGS+= package=${${group}PACKAGE:Uutilities}
49 ${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g}
53 .if ${${group}DIR:S/^\///} == ${${group}DIR}
54 # ${group}DIR specifies a variable that specifies a path
56 ${group}DIRTAGS= ${group}TAGS
57 _${group}DIR= ${${group}DIR}
59 # ${group}DIR specifies a path
61 ${group}DIRTAGS= ${${group}TAGS}
62 _${group}DIR= ${group}DIR
65 STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}}
67 .for file in ${${group}}
68 ${group}OWN_${file}?= ${${group}OWN}
69 ${group}GRP_${file}?= ${${group}GRP}
70 .if ${MK_INSTALL_AS_USER} == "yes"
71 ${group}OWN_${file}= ${SHAREOWN}
72 ${group}GRP_${file}= ${SHAREGRP}
73 .endif # ${MK_INSTALL_AS_USER} == "yes"
74 ${group}MODE_${file}?= ${${group}MODE}
76 # Determine the directory for the current file. Default to the parent group
77 # DIR, then check to see how to pass that variable on below.
78 ${group}DIR_${file}?= ${${group}DIR}
79 .if ${${group}DIR_${file}:S/^\///} == ${${group}DIR_${file}}
80 # DIR specifies a variable that specifies a path
81 _${group}DIR_${file}= ${${group}DIR_${file}}
83 # DIR directly specifies a path
84 _${group}DIR_${file}= ${group}DIR_${file}
86 ${group}PREFIX_${file}= ${DESTDIR}${${_${group}DIR_${file}}}
88 # Append DIR to DIRS if not already in place -- DIRS is already filtered, so
89 # this is primarily to ease inspection.
93 .if ${DIRS:M${_${group}DIR_${file}}} == ""
94 .if ${_DIRS:M${${_${group}DIR_${file}}}} == ""
95 DIRS+= ${_${group}DIR_${file}}
97 _${group}DIR_${file}= ${group}DIR
101 .if defined(${group}NAME)
102 ${group}NAME_${file}?= ${${group}NAME}
104 ${group}NAME_${file}?= ${file:T}
105 .endif # defined(${group}NAME)
106 STAGE_AS_${file}= ${${group}NAME_${file}}
107 # we cannot use file safely as a set name
108 # since we cannot? apply :T
109 # but we can use the ${group}DIR_${file}
110 # as a set - meta.stage.mk will :O:u for us
111 # we need to expand ${group}DIR_${file} and replace
112 # all '/' and '*' with '_' to make a safe target name.
113 STAGE_AS_SETS+= ${${_${group}DIR_${file}}:C,[/*],_,g}
114 STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}}
115 stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file}
117 installfiles-${group}: _${group}INS_${file}
118 _${group}INS_${file}: ${file} installdirs-${_${group}DIR_${file}}
119 ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \
120 -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \
121 ${.ALLSRC:Ninstalldirs-*} ${${group}PREFIX_${file}}/${${group}NAME_${file}}
122 .endfor # file in ${${group}}
124 .endif # defined(${group}) && !empty(${group})
125 .endfor # .for group in ${FILESGROUPS}
127 realinstall: installfiles
128 .ORDER: beforeinstall installfiles
130 .if ${MK_STAGING} != "no"
131 .if ${FILESGROUPS:@g@${$g}@} != ""
132 .if !empty(STAGE_SETS)
133 buildfiles: stage_files
134 STAGE_TARGETS+= stage_files
136 .if !empty(STAGE_AS_SETS)
138 STAGE_TARGETS+= stage_as
145 .include <bsd.dirs.mk>
147 .endif # !target(__<bsd.files.mk>__)