1 |
1947
|
aaronmk
|
#!/bin/bash
|
2 |
|
|
# Runs a make target on all inputs at once.
|
3 |
|
|
# Creates a job in the calling shell for each process.
|
4 |
1956
|
aaronmk
|
# Must be run from the root svn directory.
|
5 |
1947
|
aaronmk
|
|
6 |
1952
|
aaronmk
|
with_all_main ()
|
7 |
|
|
{
|
8 |
|
|
local self="${BASH_SOURCE[0]}"
|
9 |
|
|
local selfDir="$(dirname -- "$self")"
|
10 |
|
|
|
11 |
|
|
# Was run without initial ".", or with insufficient parameters
|
12 |
1953
|
aaronmk
|
if test "${BASH_LINENO[1]}" = 0 -o "$#" -lt 1; then
|
13 |
1952
|
aaronmk
|
echo "Usage: . $self make_target (note initial \".\")"|fold -s >&2
|
14 |
|
|
return 2
|
15 |
|
|
fi
|
16 |
|
|
|
17 |
|
|
for input in inputs/*/; do
|
18 |
|
|
eval "make ${input}$1 &"
|
19 |
|
|
disown -h "$(jobs|tail -1|"$selfDir/jobspecs")" # ignore SIGHUP
|
20 |
|
|
sleep 2 # wait for initial output so that outputs don't become jumbled
|
21 |
|
|
done
|
22 |
|
|
}
|
23 |
|
|
with_all_main "$@"
|