From owner-svn-src-all@freebsd.org Mon Oct 19 23:34:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 494DDA19373; Mon, 19 Oct 2015 23:34:37 +0000 (UTC) (envelope-from bdrewery@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 mx1.freebsd.org (Postfix) with ESMTPS id 033FC69F; Mon, 19 Oct 2015 23:34:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9JNYZDP089766; Mon, 19 Oct 2015 23:34:35 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9JNYZaL089765; Mon, 19 Oct 2015 23:34:35 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510192334.t9JNYZaL089765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Mon, 19 Oct 2015 23:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289606 - head/share/mk X-SVN-Group: head 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.20 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: Mon, 19 Oct 2015 23:34:37 -0000 Author: bdrewery Date: Mon Oct 19 23:34:35 2015 New Revision: 289606 URL: https://svnweb.freebsd.org/changeset/base/289606 Log: Replace all of the duplicated logic for recursing into a subdir with one implementation. It is duplicated at run-time but is more easily maintainable now. Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.subdir.mk Modified: head/share/mk/bsd.subdir.mk ============================================================================== --- head/share/mk/bsd.subdir.mk Mon Oct 19 22:27:32 2015 (r289605) +++ head/share/mk/bsd.subdir.mk Mon Oct 19 23:34:35 2015 (r289606) @@ -63,30 +63,25 @@ distribute: .MAKE .endfor .endif +# Subdir code shared among 'make ', 'make ' and SUBDIR_PARALLEL. +_SUBDIR_SH= \ + if test -d ${.CURDIR}/$${dir}.${MACHINE_ARCH}; then \ + dir=$${dir}.${MACHINE_ARCH}; \ + fi; \ + ${ECHODIR} "===> ${DIRPRFX}$${dir} ($${target})"; \ + cd ${.CURDIR}/$${dir}; \ + ${MAKE} $${target} DIRPRFX=${DIRPRFX}$${dir}/ + _SUBDIR: .USE .MAKE .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR) - @${_+_}for entry in ${SUBDIR:N.WAIT}; do \ - if test -d ${.CURDIR}/$${entry}.${MACHINE_ARCH}; then \ - ${ECHODIR} "===> ${DIRPRFX}$${entry}.${MACHINE_ARCH} (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \ - edir=$${entry}.${MACHINE_ARCH}; \ - cd ${.CURDIR}/$${edir}; \ - else \ - ${ECHODIR} "===> ${DIRPRFX}$$entry (${.TARGET:S,realinstall,install,:S,^_sub.,,})"; \ - edir=$${entry}; \ - cd ${.CURDIR}/$${edir}; \ - fi; \ - ${MAKE} ${.TARGET:S,realinstall,install,:S,^_sub.,,} \ - DIRPRFX=${DIRPRFX}$$edir/; \ - done + @${_+_}target=${.TARGET:S,realinstall,install,:S,^_sub.,,}; \ + for dir in ${SUBDIR:N.WAIT}; do ${_SUBDIR_SH}; done .endif ${SUBDIR:N.WAIT}: .PHONY .MAKE - ${_+_}@if test -d ${.TARGET}.${MACHINE_ARCH}; then \ - cd ${.CURDIR}/${.TARGET}.${MACHINE_ARCH}; \ - else \ - cd ${.CURDIR}/${.TARGET}; \ - fi; \ - ${MAKE} all + ${_+_}@target=all; \ + dir=${.TARGET}; \ + ${_SUBDIR_SH}; # Work around parsing of .if nested in .for by putting .WAIT string into a var. __wait= .WAIT @@ -104,17 +99,9 @@ __deps+= ${__target}_subdir_${__dep} .endfor ${__target}_subdir_${__dir}: .PHONY .MAKE ${__deps} .if !defined(NO_SUBDIR) - @${_+_}if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \ - ${ECHODIR} "===> ${DIRPRFX}${__dir}.${MACHINE_ARCH} (${__target:realinstall=install})"; \ - edir=${__dir}.${MACHINE_ARCH}; \ - cd ${.CURDIR}/$${edir}; \ - else \ - ${ECHODIR} "===> ${DIRPRFX}${__dir} (${__target:realinstall=install})"; \ - edir=${__dir}; \ - cd ${.CURDIR}/$${edir}; \ - fi; \ - ${MAKE} ${__target:realinstall=install} \ - DIRPRFX=${DIRPRFX}$$edir/ + @${_+_}target=${__target:realinstall=install}; \ + dir=${__dir}; \ + ${_SUBDIR_SH}; .endif .endif .endfor