Project

General

Profile

1
#!/bin/bash
2
# Runs a make target on all inputs at once.
3
# Creates a job in the calling shell for each process.
4

    
5
self="${BASH_SOURCE[0]}"
6
selfDir="$(dirname -- "$self")"
7

    
8
# Was run without initial ".", or with insufficient parameters
9
if test "${BASH_LINENO[0]}" = 0 -o "$#" -lt 1; then
10
    echo "Usage: . $self make_target (note initial \".\")"|fold -s >&2
11
    return 2
12
fi
13

    
14
for input in inputs/*/; do
15
    eval "make ${input}$1 &"
16
    disown -h "$(jobs|tail -1|"$selfDir/jobspecs")" # ignore SIGHUP
17
    sleep 2 # wait for initial output so that outputs don't become jumbled
18
done
(44-44/46)