1 # $NetBSD: pbulk-index.mk,v 1.9 2008/06/19 18:36:51 joerg Exp $
3 # This Makefile fragment is included by bsd.pkg.mk and provides all
4 # variables and targets related to the parallel bulk build
7 # The following are the "public" targets provided by this module:
13 # _PBULK_MULTI lists the multi-package variable.
14 # For each class the following variables are provided:
15 # _PBULK_MULTI_LIST.foo enumerates the supported settings
16 # _PBULK_MULTI_VAR.foo forces a specific version
17 # _PBULK_MULTI_DEFAULT.foo contains the default value
19 _PBULK_MULTI?= apache php python
21 _PBULK_MULTI_LIST.apache= PKG_APACHE_ACCEPTED
22 _PBULK_MULTI_VAR.apache= PKG_APACHE
23 _PBULK_MULTI_DEFAULT.apache= PKG_APACHE_DEFAULT
25 _PBULK_MULTI_LIST.php= PHP_VERSIONS_ACCEPTED
26 _PBULK_MULTI_VAR.php= PHP_VERSION_REQD
27 _PBULK_MULTI_DEFAULT.php= PHP_VERSION_DEFAULT
29 _PBULK_MULTI_LIST.python= _PYTHON_VERSIONS_ACCEPTED
30 _PBULK_MULTI_VAR.python= PYTHON_VERSION_REQD
31 _PBULK_MULTI_DEFAULT.python= PYTHON_VERSION_DEFAULT
33 .PHONY: pbulk-index pbulk-index-item
35 # Find all classes with more than one supported setting.
36 # Undefined list variables are handled like a single default value,
37 # empty list variables are checked afterwards.
39 # For each such class, reorder the supported values to list
40 # the default value first. This is important for packages that
41 # don't follow the module naming conventions.
43 .for _t in ${_PBULK_MULTI}
44 . if ${${_PBULK_MULTI_LIST.${_t}}:Unone:[\#]} != 1 && !empty(${_PBULK_MULTI_LIST.${_t}})
45 _PBULK_MULTI_NEEDED:= ${_t} ${_PBULK_MULTI_NEEDED}
46 _PBULK_SORTED_LIST.${_t}:= \
47 ${${_PBULK_MULTI_LIST.${_t}}:M${${_PBULK_MULTI_DEFAULT.${_t}}}} \
48 ${${_PBULK_MULTI_LIST.${_t}}:N${${_PBULK_MULTI_DEFAULT.${_t}}}}
52 .if !defined(_PBULK_MULTI_NEEDED)
53 # No multi-package handling needed, directly print the item.
54 pbulk-index: pbulk-index-item
57 # Use an ODE for loop to compute the carthesian product of
58 # the support settings. This expands to something like
60 # for apache in apache13 apache2; do \
61 # _PBULK_MULTI_VALUE.apache=$apache; \
62 # export _PBULK_MULTI_VALUE.apache; \
63 # PKG_APACHE=$apache; \
64 # export PKG_APACHE; \
65 # for php in 4 5; do \
66 # _PBULK_MULTI_VALUE.php=$php; \
67 # export _PBULK_MULTI_VALUE.php; \
68 # PHP_VERSION_REQD=$php; \
69 # export PHP_VERSION_REQD;
71 # Because the ODE expansion happens in the same shell instance,
72 # make gets the environment variables in the inner-most loop.
73 # A second ODE for loop is used to close the shell for loops.
76 @set -e; ${_PBULK_MULTI_NEEDED:@._t.@\
77 for ${._t.} in ${_PBULK_SORTED_LIST.${._t.}}; do \
78 _PBULK_MULTI_VALUE_${._t.}=$$${._t.}; \
79 export _PBULK_MULTI_VALUE_${._t.}; \
80 ${_PBULK_MULTI_VAR.${._t.}}=$$${._t.}; \
81 export ${_PBULK_MULTI_VAR.${._t.}};@} \
82 ${MAKE} pbulk-index-item \
83 ${_PBULK_MULTI_NEEDED:@._t.@;done@}
87 @echo "PKGNAME="${PKGNAME:Q}
88 @echo "ALL_DEPENDS="${_ALL_DEPENDS:Q}
89 @echo "PKG_SKIP_REASON="${PKG_SKIP_REASON:Q}
90 @echo "PKG_FAIL_REASON="${PKG_FAIL_REASON:Q}
91 @echo "NO_BIN_ON_FTP="${NO_BIN_ON_FTP:Q}
92 @echo "RESTRICTED="${RESTRICTED:Q}
93 @echo "CATEGORIES="${CATEGORIES:Q}
94 @echo "MAINTAINER="${MAINTAINER:Q}
95 @echo "USE_DESTDIR="${_USE_DESTDIR:Q}
96 @echo "BOOTSTRAP_PKG="${BOOTSTRAP_PKG}
97 .if defined(_PBULK_MULTI_NEEDED)
98 @printf "MULTI_VERSION="
99 .for _t in ${_PBULK_MULTI_NEEDED}
100 @printf " %s=%s" ${_PBULK_MULTI_VAR.${_t}:Q} ${_PBULK_MULTI_VALUE_${_t}:Q}
106 ${RUN} cd ${WRKDIR} && ${TAR} cfz ${INTO:Q} .