From owner-svn-src-all@freebsd.org Thu Jul 26 17:05:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDB8E1055051; Thu, 26 Jul 2018 17:05:34 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 83A7770564; Thu, 26 Jul 2018 17:05:34 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6623142A5; Thu, 26 Jul 2018 17:05:34 +0000 (UTC) (envelope-from brd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6QH5Yke034824; Thu, 26 Jul 2018 17:05:34 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6QH5Y1D034822; Thu, 26 Jul 2018 17:05:34 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201807261705.w6QH5Y1D034822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Thu, 26 Jul 2018 17:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336744 - in head: sbin/pfctl/tests/files share/mk X-SVN-Group: head X-SVN-Commit-Author: brd X-SVN-Commit-Paths: in head: sbin/pfctl/tests/files share/mk X-SVN-Commit-Revision: 336744 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jul 2018 17:05:35 -0000 Author: brd Date: Thu Jul 26 17:05:33 2018 New Revision: 336744 URL: https://svnweb.freebsd.org/changeset/base/336744 Log: Convert bsd.files.mk to support DIRS and simplify by only having one install target. Also update the pfctl tests Makefile to work with this change. Approved by: bapt (mentor) Differential Revision: https://reviews.freebsd.org/D16430 Modified: head/sbin/pfctl/tests/files/Makefile head/share/mk/bsd.files.mk Modified: head/sbin/pfctl/tests/files/Makefile ============================================================================== --- head/sbin/pfctl/tests/files/Makefile Thu Jul 26 16:51:23 2018 (r336743) +++ head/sbin/pfctl/tests/files/Makefile Thu Jul 26 17:05:33 2018 (r336744) @@ -4,9 +4,7 @@ TESTSDIR= ${TESTSBASE}/sbin/pfctl/files BINDIR= ${TESTSDIR} # We use ${.CURDIR} as workaround so that the glob patterns work. -FILES= ${.CURDIR}/pf????.in -FILES+= ${.CURDIR}/pf????.include -FILES+= ${.CURDIR}/pf????.ok +FILES!= echo ${.CURDIR}/pf????.in ${.CURDIR}/pf????.include ${.CURDIR}/pf????.ok FILES+= ${.CURDIR}/pfctl_test_descr.sh .include Modified: head/share/mk/bsd.files.mk ============================================================================== --- head/share/mk/bsd.files.mk Thu Jul 26 16:51:23 2018 (r336743) +++ head/share/mk/bsd.files.mk Thu Jul 26 17:05:33 2018 (r336744) @@ -5,6 +5,10 @@ .endif .if !target(____) +.if target(____) +.error bsd.dirs.mk must be included after bsd.files.mk. +.endif + ____: FILESGROUPS?= FILES @@ -31,7 +35,7 @@ ${group}OWN= ${SHAREOWN} ${group}GRP= ${SHAREGRP} .endif ${group}MODE?= ${SHAREMODE} -${group}DIR?= ${BINDIR} +${group}DIR?= BINDIR STAGE_SETS+= ${group:C,[/*],_,g} STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${group}DIR} @@ -43,71 +47,72 @@ ${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g} .endif -_${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}) || defined(${group}NAME) -${group}OWN_${file:T}?= ${${group}OWN} -${group}GRP_${file:T}?= ${${group}GRP} -.if ${MK_INSTALL_AS_USER} == "yes" -${group}OWN_${file:T}= ${SHAREOWN} -${group}GRP_${file:T}= ${SHAREGRP} -.endif -${group}MODE_${file:T}?= ${${group}MODE} -${group}DIR_${file:T}?= ${${group}DIR} -.if defined(${group}NAME) -${group}NAME_${file:T}?= ${${group}NAME} +.if ${${group}DIR:S/^\///} == ${${group}DIR} +# ${group}DIR specifies a variable that specifies a path +DIRS+= ${${group}DIR} +_${group}DIR= ${${group}DIR} .else -${group}NAME_${file:T}?= ${file:T} +# ${group}DIR specifies a path +DIRS+= ${group}DIR +_${group}DIR= ${group}DIR .endif -STAGE_AS_SETS+= ${file:T} -STAGE_AS_${file:T}= ${${group}NAME_${file:T}} -# XXX {group}OWN,GRP,MODE -STAGE_DIR.${file:T}= ${STAGE_OBJTOP}${${group}DIR_${file:T}} -stage_as.${file:T}: ${file} -installfiles-${group}: installdirs-${group} _${group}INS_${file:T} -_${group}INS_${file:T}: ${file} - ${INSTALL} ${${group}TAG_ARGS} -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 +.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} -installdirs-${group}: - @${ECHO} installing dirs ${group}DIR ${${group}DIR} -.for dir in ${${group}DIR} -.if defined(NO_ROOT) - ${INSTALL} ${${group}TAG_ARGS} -d ${DESTDIR}${dir} +# 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}} .else - ${INSTALL} ${${group}TAG_ARGS} -d -o ${DIROWN} -g ${DIRGRP} \ - -m ${DIRMODE} ${DESTDIR}${dir} +# DIR directly specifies a path +_${group}DIR_${file}= ${group}DIR_${file} .endif -.endfor +${group}PREFIX_${file}= ${DESTDIR}${${_${group}DIR_${file}}} - -.if !empty(_${group}FILES) -stage_files.${group}: ${_${group}FILES} - -installfiles-${group}: installdirs-${group} _${group}INS -_${group}INS: ${_${group}FILES} -.if defined(${group}NAME) - ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN} -g ${${group}GRP} \ - -m ${${group}MODE} ${.ALLSRC} \ - ${DESTDIR}${${group}DIR}/${${group}NAME} +# 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}} .else - ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN} -g ${${group}GRP} \ - -m ${${group}MODE} ${.ALLSRC} ${DESTDIR}${${group}DIR}/ +_${group}DIR_${file}= ${group}DIR .endif .endif +.if defined(${group}NAME) +${group}NAME_${file}?= ${${group}NAME} +.else +${group}NAME_${file}?= ${file:T} +.endif # defined(${group}NAME) +STAGE_AS_SETS+= ${file} +STAGE_AS_${file}= ${${group}NAME_${file}} +# XXX {group}OWN,GRP,MODE +STAGE_DIR.${file}= ${STAGE_OBJTOP}${${group}DIR_${file}} +stage_as.${file}: ${file} + +installfiles-${group}: _${group}INS1_${file} +_${group}INS1_${file}: installdirs-${_${group}DIR_${file}} _${group}INS_${file} +_${group}INS_${file}: ${file} + ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \ + -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \ + ${.ALLSRC} ${${group}PREFIX_${file}}/${${group}NAME_${file}} +.endfor # file in ${${group}} + .endif # defined(${group}) && !empty(${group}) -.endfor +.endfor # .for group in ${FILESGROUPS} realinstall: installfiles .ORDER: beforeinstall installfiles