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}DIR= ${${group}DIR}
58 # ${group}DIR specifies a path
60 _${group}DIR= ${group}DIR
63 STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}}
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}
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}}
81 # DIR directly specifies a path
82 _${group}DIR_${file}= ${group}DIR_${file}
84 ${group}PREFIX_${file}= ${DESTDIR}${${_${group}DIR_${file}}}
86 # Append DIR to DIRS if not already in place -- DIRS is already filtered, so
87 # this is primarily to ease inspection.
91 .if ${DIRS:M${_${group}DIR_${file}}} == ""
92 .if ${_DIRS:M${${_${group}DIR_${file}}}} == ""
93 DIRS+= ${_${group}DIR_${file}}
95 _${group}DIR_${file}= ${group}DIR
99 .if defined(${group}NAME)
100 ${group}NAME_${file}?= ${${group}NAME}
102 ${group}NAME_${file}?= ${file:T}
103 .endif # defined(${group}NAME)
104 STAGE_AS_${file}= ${${group}NAME_${file}}
105 # we cannot use file safely as a set name
106 # since we cannot? apply :T
107 # but we can use the ${group}DIR_${file}
108 # as a set - meta.stage.mk will :O:u for us
109 # we need to expand ${group}DIR_${file} and replace
110 # all '/' and '*' with '_' to make a safe target name.
111 STAGE_AS_SETS+= ${${_${group}DIR_${file}}:C,[/*],_,g}
112 STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}}
113 stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file}
115 installfiles-${group}: _${group}INS_${file}
116 _${group}INS_${file}: ${file} installdirs-${_${group}DIR_${file}}
117 ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \
118 -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \
119 ${.ALLSRC:Ninstalldirs-*} ${${group}PREFIX_${file}}/${${group}NAME_${file}}
120 .endfor # file in ${${group}}
122 .endif # defined(${group}) && !empty(${group})
123 .endfor # .for group in ${FILESGROUPS}
125 realinstall: installfiles
126 .ORDER: beforeinstall installfiles
128 .if ${MK_STAGING} != "no"
129 .if ${FILESGROUPS:@g@${$g}@} != ""
130 .if !empty(STAGE_SETS)
131 buildfiles: stage_files
132 STAGE_TARGETS+= stage_files
134 .if !empty(STAGE_AS_SETS)
136 STAGE_TARGETS+= stage_as
143 .include <bsd.dirs.mk>
145 .endif # !target(__<bsd.files.mk>__)