mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-27 11:55:06 +00:00
cb56d4a851
If a single Makefile wants to recurse into subdirectories and also wants to install files, bsd.files.mk's targets would get ignored in favor of those defined by bsd.subdir.mk because installfiles would not get defined in bsd.files.mk. Prevent this from happening by defining the targets in bsd.files.mk with auxiliary names and listing them as dependencies of installfiles instead. This is required by bsd.test.mk, which needs to install a Kyuafile in pretty much all cases but may also need to recurse into subdirectories for build purposes. Submitted by: Julio Merino jmmv google.com Reviewed by: sjg MFC after: 2 weeks
68 lines
1.7 KiB
Makefile
68 lines
1.7 KiB
Makefile
# $FreeBSD$
|
|
|
|
.if !target(__<bsd.init.mk>__)
|
|
.error bsd.files.mk cannot be included directly.
|
|
.endif
|
|
|
|
FILESGROUPS?= FILES
|
|
|
|
.if !target(buildfiles)
|
|
.for group in ${FILESGROUPS}
|
|
buildfiles: ${${group}}
|
|
.endfor
|
|
.endif
|
|
|
|
all: buildfiles
|
|
|
|
.for group in ${FILESGROUPS}
|
|
.if defined(${group}) && !empty(${group})
|
|
installfiles: installfiles-${group}
|
|
|
|
${group}OWN?= ${SHAREOWN}
|
|
${group}GRP?= ${SHAREGRP}
|
|
${group}MODE?= ${SHAREMODE}
|
|
${group}DIR?= ${BINDIR}
|
|
|
|
_${group}FILES=
|
|
.for file in ${${group}}
|
|
.if defined(${group}OWN_${file:T}) || defined(${group}GRP_${file:T}) || \
|
|
defined(${group}MODE_${file:T}) || defined(${group}DIR_${file:T}) || \
|
|
defined(${group}NAME_${file:T})
|
|
${group}OWN_${file:T}?= ${${group}OWN}
|
|
${group}GRP_${file:T}?= ${${group}GRP}
|
|
${group}MODE_${file:T}?= ${${group}MODE}
|
|
${group}DIR_${file:T}?= ${${group}DIR}
|
|
.if defined(${group}NAME)
|
|
${group}NAME_${file:T}?= ${${group}NAME}
|
|
.else
|
|
${group}NAME_${file:T}?= ${file:T}
|
|
.endif
|
|
installfiles-${group}: _${group}INS_${file:T}
|
|
_${group}INS_${file:T}: ${file}
|
|
${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \
|
|
-g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
|
|
${.ALLSRC} \
|
|
${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
|
|
.else
|
|
_${group}FILES+= ${file}
|
|
.endif
|
|
.endfor
|
|
.if !empty(_${group}FILES)
|
|
installfiles-${group}: _${group}INS
|
|
_${group}INS: ${_${group}FILES}
|
|
.if defined(${group}NAME)
|
|
${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
|
|
-m ${${group}MODE} ${.ALLSRC} \
|
|
${DESTDIR}${${group}DIR}/${${group}NAME}
|
|
.else
|
|
${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
|
|
-m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}
|
|
.endif
|
|
.endif
|
|
|
|
.endif # defined(${group}) && !empty(${group})
|
|
.endfor
|
|
|
|
realinstall: installfiles
|
|
.ORDER: beforeinstall installfiles
|