From 4fc4ae25674473f65839323106d4039722e16d56 Mon Sep 17 00:00:00 2001 From: jmmv Date: Sat, 28 Dec 2013 16:08:10 +0000 Subject: Pull up fixes to allow building tests along scripts and data files. MFC of the following into stable/10: - r257095 Allow mixing bsd.files.mk with bsd.subdir.mk. - r258095 Allow this (bsd.progs.mk) to work with fmake. - r258330 Need to also test for defined(${v}_${PROG}) in bsd.progs.mk. - r259209 Make bsd.progs.mk work in directories with SCRIPTS but no PROGS. This is all 'make tinderbox' clean as run on ref10-amd64. --- share/mk/bsd.files.mk | 8 +++----- share/mk/bsd.progs.mk | 38 +++++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 12 deletions(-) (limited to 'share/mk') diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk index 240f958..2397005 100644 --- a/share/mk/bsd.files.mk +++ b/share/mk/bsd.files.mk @@ -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 diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk index 3262004..c5e8c3d 100644 --- a/share/mk/bsd.progs.mk +++ b/share/mk/bsd.progs.mk @@ -16,14 +16,20 @@ .MAIN: all -.if defined(PROGS) +.if defined(PROGS) || defined(PROGS_CXX) +# we really only use PROGS below... +PROGS += ${PROGS_CXX} # In meta mode, we can capture dependenices for _one_ of the progs. # if makefile doesn't nominate one, we use the first. +.if defined(.PARSEDIR) .ifndef UPDATE_DEPENDFILE_PROG UPDATE_DEPENDFILE_PROG = ${PROGS:[1]} .export UPDATE_DEPENDFILE_PROG .endif +.else +UPDATE_DEPENDFILE_PROG?= no +.endif .ifndef PROG # They may have asked us to build just one @@ -38,13 +44,15 @@ PROG ?= $t # just one of many PROG_VARS += BINDIR CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD MAN SRCS .for v in ${PROG_VARS:O:u} -.if defined(${v}.${PROG}) +.if defined(${v}.${PROG}) || defined(${v}_${PROG}) $v += ${${v}_${PROG}:U${${v}.${PROG}}} +.else +$v ?= .endif .endfor # for meta mode, there can be only one! -.if ${PROG} == ${UPDATE_DEPENDFILE_PROG:Uno} +.if ${PROG} == ${UPDATE_DEPENDFILE_PROG} UPDATE_DEPENDFILE ?= yes .endif UPDATE_DEPENDFILE ?= NO @@ -63,9 +71,9 @@ UPDATE_DEPENDFILE = NO .endif # handle being called [bsd.]progs.mk -.include <${.PARSEFILE:S,progs,prog,}> +.include -.ifndef PROG +.ifndef _RECURSING_PROGS # tell progs.mk we might want to install things PROGS_TARGETS+= cleandepend cleandir cleanobj depend install @@ -76,11 +84,13 @@ x.$p= PROG_CXX=$p .endif $p ${p}_p: .PHONY .MAKE - (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p}) + (cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \ + SUBDIR= PROG=$p ${x.$p}) .for t in ${PROGS_TARGETS:O:u} $p.$t: .PHONY .MAKE - (cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} PROG=$p ${x.$p} ${@:E}) + (cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \ + SUBDIR= PROG=$p ${x.$p} ${@:E}) .endfor .endfor @@ -88,4 +98,18 @@ $p.$t: .PHONY .MAKE $t: ${PROGS:%=%.$t} .endfor +SCRIPTS_TARGETS+= cleandepend cleandir cleanobj depend install + +.for p in ${SCRIPTS} +.for t in ${SCRIPTS_TARGETS:O:u} +$p.$t: .PHONY .MAKE + (cd ${.CURDIR} && ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS= \ + SUBDIR= SCRIPT=$p ${x.$p} ${@:E}) +.endfor +.endfor + +.for t in ${SCRIPTS_TARGETS:O:u} +$t: ${SCRIPTS:%=%.$t} +.endfor + .endif -- cgit v1.1