freebsd-ports/Tools/portbuild/scripts/makeparallel
Kris Kennaway 90bdd0d643 Add makeparallel script, an improved version of the 'parallel' target
in ports/Makefile.  It uses the buildenv framework to obtain the correct
PKGSUFFIX and INDEXFILE variables.
2003-01-24 04:43:42 +00:00

30 lines
1 KiB
Bash
Executable file

#!/bin/sh
pb=/var/portbuild
if [ $# -ne 2 ]; then
echo "usage: makeparallel arch branch"
exit 1
fi
arch=$1
branch=$2
. ${pb}/${arch}/portbuild.conf
. ${pb}/scripts/buildenv
buildenv ${pb} ${arch} ${branch}
cd ${PORTSDIR}
subdir=$(make -V SUBDIR)
makefile=${pb}/${arch}/${branch}/Makefile
sufx=${PKGSUFFIX}
rm ${makefile}
for dir in ${subdir}; do
echo "all: ${dir}-all" >> ${makefile}
done
awk -F '|' "{me=\$1; here=\$2; bdep=\$8; rdep=\$9; split(here, tmp, \"/\"); if (bdep != \"\") { gsub(\"\$\", \"${sufx}\", bdep); gsub(\" \", \"${sufx} \", bdep); } if (rdep != \"\") { gsub(\"\$\", \"${sufx}\", rdep); gsub(\" \", \"${sufx} \", rdep); } print tmp[4] \"-all: \" me \"${sufx}\"; print me \": \" me \"${sufx}\"; print me \"${sufx}: \" bdep \" \" rdep; printf(\"\t@/var/portbuild/scripts/pdispatch ${arch} ${branch} /var/portbuild/scripts/portbuild %s${sufx} %s\",me, here); if (bdep != \"\") printf(\" %s\", bdep); if (rdep != \"\") printf(\" %s\", rdep);printf(\"\n\")}" < ${PORTSDIR}/${INDEXFILE} >> ${makefile}