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
# Must be run from the root svn directory.
5

    
6
main()
7
{
8
    local self="${BASH_SOURCE[0]}"
9
    local selfDir="$(dirname -- "$self")"
10
    
11
    # Was run without initial ".", or with insufficient parameters
12
    if test "${BASH_LINENO[1]}" = 0 -o "$#" -lt 1; then
13
        echo "Usage: [hidden_srcs=1] [inputs=(inputs/src/ ...)]; . $self \
14
make_target [vars...] (note initial \".\")"|fold -s >&2
15
        return 2
16
    fi
17
    if test ! "${inputs+isset}"; then local inputs=(inputs/*/); fi
18
    if test "$hidden_srcs"; then local inputs=(inputs/.[^as.]*/ "${inputs[@]}")
19
    fi # not . .. .svn .archive
20
    
21
    for input in "${inputs[@]}"; do
22
        eval "yes|make ${input}$* &"
23
        disown -h "$(jobs|tail -1|"$selfDir/jobspecs")" # ignore SIGHUP
24
        sleep 2 # wait for initial output so that outputs don't become jumbled
25
    done
26
}
27
main "$@"
(84-84/86)