Allow mixing bsd.files.mk with bsd.subdir.mk.

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
This commit is contained in:
rpaulo 2013-10-25 05:11:10 +00:00
parent d6a7850e82
commit c71fd6a108

View File

@ -14,9 +14,9 @@ buildfiles: ${${group}}
all: buildfiles
.if !target(installfiles)
.for group in ${FILESGROUPS}
.if defined(${group}) && !empty(${group})
installfiles: installfiles-${group}
${group}OWN?= ${SHAREOWN}
${group}GRP?= ${SHAREGRP}
@ -37,7 +37,7 @@ ${group}NAME_${file:T}?= ${${group}NAME}
.else
${group}NAME_${file:T}?= ${file:T}
.endif
installfiles: _${group}INS_${file:T}
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}} \
@ -48,7 +48,7 @@ _${group}FILES+= ${file}
.endif
.endfor
.if !empty(_${group}FILES)
installfiles: _${group}INS
installfiles-${group}: _${group}INS
_${group}INS: ${_${group}FILES}
.if defined(${group}NAME)
${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \
@ -63,7 +63,5 @@ _${group}INS: ${_${group}FILES}
.endif # defined(${group}) && !empty(${group})
.endfor
.endif # !target(installfiles)
realinstall: installfiles
.ORDER: beforeinstall installfiles