2002-06-03 14:49:34 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
.if !target(__<bsd.init.mk>__)
|
|
|
|
.error bsd.files.mk cannot be included directly.
|
|
|
|
.endif
|
|
|
|
|
2014-06-09 14:36:49 +00:00
|
|
|
.if !target(__<bsd.files.mk>__)
|
2018-07-26 17:05:33 +00:00
|
|
|
.if target(__<bsd.dirs.mk>__)
|
|
|
|
.error bsd.dirs.mk must be included after bsd.files.mk.
|
|
|
|
.endif
|
|
|
|
|
2014-06-09 14:36:49 +00:00
|
|
|
__<bsd.files.mk>__:
|
|
|
|
|
2002-06-03 14:49:34 +00:00
|
|
|
FILESGROUPS?= FILES
|
|
|
|
|
2016-12-03 05:29:31 +00:00
|
|
|
.for group in ${FILESGROUPS}
|
2015-08-27 01:52:45 +00:00
|
|
|
# Add in foo.yes and remove duplicates from all the groups
|
|
|
|
${${group}}:= ${${group}} ${${group}.yes}
|
|
|
|
${${group}}:= ${${group}:O:u}
|
2002-06-03 14:49:34 +00:00
|
|
|
buildfiles: ${${group}}
|
|
|
|
.endfor
|
|
|
|
|
2016-02-26 22:13:48 +00:00
|
|
|
.if !defined(_SKIP_BUILD)
|
2002-06-03 14:49:34 +00:00
|
|
|
all: buildfiles
|
2016-02-26 22:13:48 +00:00
|
|
|
.endif
|
2002-06-03 14:49:34 +00:00
|
|
|
|
2016-12-03 05:29:31 +00:00
|
|
|
.for group in ${FILESGROUPS}
|
2002-06-03 14:49:34 +00:00
|
|
|
.if defined(${group}) && !empty(${group})
|
2013-10-25 05:11:10 +00:00
|
|
|
installfiles: installfiles-${group}
|
2002-06-03 14:49:34 +00:00
|
|
|
|
|
|
|
${group}OWN?= ${SHAREOWN}
|
|
|
|
${group}GRP?= ${SHAREGRP}
|
2017-07-21 16:14:35 +00:00
|
|
|
.if ${MK_INSTALL_AS_USER} == "yes"
|
|
|
|
${group}OWN= ${SHAREOWN}
|
|
|
|
${group}GRP= ${SHAREGRP}
|
|
|
|
.endif
|
2002-06-03 14:49:34 +00:00
|
|
|
${group}MODE?= ${SHAREMODE}
|
2018-07-26 17:05:33 +00:00
|
|
|
${group}DIR?= BINDIR
|
2016-12-03 05:29:35 +00:00
|
|
|
STAGE_SETS+= ${group:C,[/*],_,g}
|
2002-06-03 14:49:34 +00:00
|
|
|
|
2019-09-05 14:18:13 +00:00
|
|
|
.if ${group} == "FILES"
|
2019-09-06 12:26:45 +00:00
|
|
|
FILESPACKAGE= ${PACKAGE:Uutilities}
|
2019-09-05 14:18:13 +00:00
|
|
|
.endif
|
|
|
|
|
2015-03-05 12:39:18 +00:00
|
|
|
.if defined(NO_ROOT)
|
|
|
|
.if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*}
|
2019-09-05 14:15:47 +00:00
|
|
|
${group}TAGS+= package=${${group}PACKAGE:Uutilities}
|
2015-03-05 12:39:18 +00:00
|
|
|
.endif
|
|
|
|
${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
|
2018-07-26 17:05:33 +00:00
|
|
|
.if ${${group}DIR:S/^\///} == ${${group}DIR}
|
|
|
|
# ${group}DIR specifies a variable that specifies a path
|
|
|
|
DIRS+= ${${group}DIR}
|
2020-12-21 22:20:28 +00:00
|
|
|
${group}DIRTAGS= ${group}TAGS
|
2018-07-26 17:05:33 +00:00
|
|
|
_${group}DIR= ${${group}DIR}
|
2002-06-03 14:49:34 +00:00
|
|
|
.else
|
2018-07-26 17:05:33 +00:00
|
|
|
# ${group}DIR specifies a path
|
|
|
|
DIRS+= ${group}DIR
|
2020-12-21 22:20:28 +00:00
|
|
|
${group}DIRTAGS= ${${group}TAGS}
|
2018-07-26 17:05:33 +00:00
|
|
|
_${group}DIR= ${group}DIR
|
2002-06-03 14:49:34 +00:00
|
|
|
.endif
|
2018-05-09 13:44:54 +00:00
|
|
|
|
2019-01-15 23:37:49 +00:00
|
|
|
STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}}
|
2018-05-09 13:44:54 +00:00
|
|
|
|
2018-07-26 17:05:33 +00:00
|
|
|
.for file in ${${group}}
|
|
|
|
${group}OWN_${file}?= ${${group}OWN}
|
|
|
|
${group}GRP_${file}?= ${${group}GRP}
|
|
|
|
.if ${MK_INSTALL_AS_USER} == "yes"
|
|
|
|
${group}OWN_${file}= ${SHAREOWN}
|
|
|
|
${group}GRP_${file}= ${SHAREGRP}
|
|
|
|
.endif # ${MK_INSTALL_AS_USER} == "yes"
|
|
|
|
${group}MODE_${file}?= ${${group}MODE}
|
|
|
|
|
|
|
|
# Determine the directory for the current file. Default to the parent group
|
|
|
|
# DIR, then check to see how to pass that variable on below.
|
|
|
|
${group}DIR_${file}?= ${${group}DIR}
|
|
|
|
.if ${${group}DIR_${file}:S/^\///} == ${${group}DIR_${file}}
|
|
|
|
# DIR specifies a variable that specifies a path
|
|
|
|
_${group}DIR_${file}= ${${group}DIR_${file}}
|
2018-05-09 13:44:54 +00:00
|
|
|
.else
|
2018-07-26 17:05:33 +00:00
|
|
|
# DIR directly specifies a path
|
|
|
|
_${group}DIR_${file}= ${group}DIR_${file}
|
2018-05-09 13:44:54 +00:00
|
|
|
.endif
|
2018-07-26 17:05:33 +00:00
|
|
|
${group}PREFIX_${file}= ${DESTDIR}${${_${group}DIR_${file}}}
|
2018-05-09 13:44:54 +00:00
|
|
|
|
2018-07-26 17:05:33 +00:00
|
|
|
# Append DIR to DIRS if not already in place -- DIRS is already filtered, so
|
|
|
|
# this is primarily to ease inspection.
|
|
|
|
.for d in ${DIRS}
|
|
|
|
_DIRS+= ${${d}}
|
|
|
|
.endfor
|
|
|
|
.if ${DIRS:M${_${group}DIR_${file}}} == ""
|
|
|
|
.if ${_DIRS:M${${_${group}DIR_${file}}}} == ""
|
|
|
|
DIRS+= ${_${group}DIR_${file}}
|
2002-06-03 14:49:34 +00:00
|
|
|
.else
|
2018-07-26 17:05:33 +00:00
|
|
|
_${group}DIR_${file}= ${group}DIR
|
2002-06-03 14:49:34 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2018-07-26 17:05:33 +00:00
|
|
|
.if defined(${group}NAME)
|
|
|
|
${group}NAME_${file}?= ${${group}NAME}
|
|
|
|
.else
|
|
|
|
${group}NAME_${file}?= ${file:T}
|
|
|
|
.endif # defined(${group}NAME)
|
|
|
|
STAGE_AS_${file}= ${${group}NAME_${file}}
|
2019-09-06 19:05:01 +00:00
|
|
|
# we cannot use file safely as a set name
|
|
|
|
# since we cannot? apply :T
|
|
|
|
# but we can use the ${group}DIR_${file}
|
|
|
|
# as a set - meta.stage.mk will :O:u for us
|
|
|
|
# we need to expand ${group}DIR_${file} and replace
|
|
|
|
# all '/' and '*' with '_' to make a safe target name.
|
|
|
|
STAGE_AS_SETS+= ${${_${group}DIR_${file}}:C,[/*],_,g}
|
2019-10-01 20:32:03 +00:00
|
|
|
STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}}
|
2019-09-06 19:05:01 +00:00
|
|
|
stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file}
|
2018-07-26 17:05:33 +00:00
|
|
|
|
2019-11-15 18:34:36 +00:00
|
|
|
installfiles-${group}: _${group}INS_${file}
|
|
|
|
_${group}INS_${file}: ${file} installdirs-${_${group}DIR_${file}}
|
2018-07-26 17:05:33 +00:00
|
|
|
${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \
|
|
|
|
-g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \
|
2019-12-10 12:12:48 +00:00
|
|
|
${.ALLSRC:Ninstalldirs-*} ${${group}PREFIX_${file}}/${${group}NAME_${file}}
|
2018-07-26 17:05:33 +00:00
|
|
|
.endfor # file in ${${group}}
|
|
|
|
|
2005-04-11 07:13:29 +00:00
|
|
|
.endif # defined(${group}) && !empty(${group})
|
2018-07-26 17:05:33 +00:00
|
|
|
.endfor # .for group in ${FILESGROUPS}
|
2002-06-03 14:49:34 +00:00
|
|
|
|
|
|
|
realinstall: installfiles
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall installfiles
|
2014-06-09 14:36:49 +00:00
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
.if ${MK_STAGING} != "no"
|
2019-09-06 19:05:01 +00:00
|
|
|
.if ${FILESGROUPS:@g@${$g}@} != ""
|
2012-08-22 19:25:57 +00:00
|
|
|
.if !empty(STAGE_SETS)
|
|
|
|
buildfiles: stage_files
|
2018-08-02 21:33:45 +00:00
|
|
|
STAGE_TARGETS+= stage_files
|
2019-09-06 19:05:01 +00:00
|
|
|
stage_files:
|
2012-08-22 19:25:57 +00:00
|
|
|
.if !empty(STAGE_AS_SETS)
|
|
|
|
buildfiles: stage_as
|
2018-08-02 21:33:45 +00:00
|
|
|
STAGE_TARGETS+= stage_as
|
2019-09-06 19:05:01 +00:00
|
|
|
stage_as:
|
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.endif
|
2014-08-19 06:50:54 +00:00
|
|
|
|
2018-07-24 16:34:58 +00:00
|
|
|
.include <bsd.dirs.mk>
|
|
|
|
|
2014-06-09 14:36:49 +00:00
|
|
|
.endif # !target(__<bsd.files.mk>__)
|