From a6396841cbec00ff1d9bfb03402afd20549ad840 Mon Sep 17 00:00:00 2001 From: espie Date: Wed, 28 Mar 2001 11:19:33 +0000 Subject: [PATCH] Handle parsing the flavor/multi-package part internally. Use eval to simplify passing those to submakes. Note that the preferred separator is ',', not ':'. (Because ':' can't be used unambiguously in *_DEPENDS, whereas ',' can) --- infrastructure/mk/bsd.port.subdir.mk | 68 +++++++++++++++++----------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/infrastructure/mk/bsd.port.subdir.mk b/infrastructure/mk/bsd.port.subdir.mk index 37f804d184f..dfe3fa3fb72 100644 --- a/infrastructure/mk/bsd.port.subdir.mk +++ b/infrastructure/mk/bsd.port.subdir.mk @@ -1,5 +1,5 @@ # from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 -# $OpenBSD: bsd.port.subdir.mk,v 1.32 2001/03/28 10:55:52 espie Exp $ +# $OpenBSD: bsd.port.subdir.mk,v 1.33 2001/03/28 11:19:33 espie Exp $ # FreeBSD Id: bsd.port.subdir.mk,v 1.20 1997/08/22 11:16:15 asami Exp # # The include file contains the default targets @@ -84,31 +84,47 @@ _SUBDIRUSE: .USE . for i in ${SKIPPED} @echo "===> ${PKGPATH}${_SEP}$i skipped" . endfor - @for entry in ${SUBDIR}; do \ - if expr "$$entry" : '.*[,:]' >/dev/null; then \ - flavor=`echo $$entry | sed -e 's/[^,:]*[,:]//' -e 's/,/ /g'`; \ - entry=`echo $$entry | sed -e 's/[:,].*//'`; \ - display=" ($$flavor)"; \ - varname=FLAVOR; \ - else \ - flavor=''; \ - display=''; \ - varname=DUMMY; \ - fi; \ - if cd ${.CURDIR}/$${entry}.${MACHINE} 2>/dev/null; then \ - edir=$${entry}.${MACHINE}; \ - elif cd ${.CURDIR}/$${entry} 2>/dev/null; then \ - edir=$${entry}; \ - else \ - ${ECHO_MSG} "===> ${PKGPATH}${_SEP}$${entry} non-existent"; \ - continue; \ - fi; \ - ${ECHO_MSG} "===> ${PKGPATH}${_SEP}$${edir}$$display"; \ - if env $$varname="$$flavor" \ - PKGPATH=${PKGPATH}${_SEP}$$edir \ - RECURSIVE_FETCH_LIST=${RECURSIVE_FETCH_LIST} \ - ${MAKE} ${.TARGET:realinstall=install}; \ - then :; else ${REPORT_PROBLEM}; fi; \ + @for dir in ${SUBDIR}; do \ + multi=''; flavor=''; toset=''; \ + case "$$dir" in \ + *[,:]*) \ + IFS=',:'; first=true; insert=''; for i in $$dir; do \ + if $$first; then \ + dir=$$i; first=false; \ + else \ + case X"$$i" in \ + X-*) \ + multi="$$i";; \ + *) \ + flavor="$$flavor$$insert$$i"; \ + insert=' ';; \ + esac \ + fi; \ + done; \ + case X$$multi in "X");; *) \ + toset="$$toset SUBPACKAGE=\"$$multi\"";; \ + esac; \ + case X"$$flavor" in "X");; *) \ + toset="$$toset FLAVOR=\"$$flavor\"";; \ + esac; \ + display=" ($$flavor)";; \ + *) \ + display='';; \ + esac; \ + if cd ${.CURDIR}/$${dir}.${MACHINE} 2>/dev/null; then \ + edir=$${dir}.${MACHINE}; \ + elif cd ${.CURDIR}/$${dir} 2>/dev/null; then \ + edir=$${dir}; \ + else \ + ${ECHO_MSG} "===> ${PKGPATH}${_SEP}$${entry} non-existent"; \ + continue; \ + fi; \ + ${ECHO_MSG} "===> ${PKGPATH}${_SEP}$${edir}$$display"; \ + if eval $$toset \ + PKGPATH=${PKGPATH}${_SEP}$$edir \ + RECURSIVE_FETCH_LIST=${RECURSIVE_FETCH_LIST} \ + ${MAKE} ${.TARGET:realinstall=install}; \ + then :; else ${REPORT_PROBLEM}; fi; \ done ${SUBDIR}::