summaryrefslogtreecommitdiffstats
path: root/util/domd
blob: 76b13d2c7b51ec426306d893c730f955bac78ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# Wrapper to portably run makedepend or equivalent compiler built-in.
# Runs on Makefile.in, generates Makefile

TOP=$1
shift
if [ "$1" = "-MD" ]; then
    shift
    MAKEDEPEND=$1
    shift
    if [ "$MAKEDEPEND" = "ccache" ]; then
        MAKEDEPEND="$MAKEDEPEND $1"
        shift
    fi
fi
if [ -z "$MAKEDEPEND" ] ; then
    MAKEDEPEND=makedepend
fi

if ${MAKEDEPEND} --version 2>&1 | egrep "clang|gcc" >/dev/null
    args=""
    while [ $# -gt 0 ]; do
        if [ "$1" != '--' ] ; then
            args="$args $1"
        fi
	shift
    done
    ${MAKEDEPEND} -Werror -DOPENSSL_DOING_MAKEDEPEND -M $args >Makefile.tmp || exit 1
    cat Makefile.in Makefile.tmp >Makefile
    rm Makefile.tmp
else
    cp Makefile.in Makefile
    ${MAKEDEPEND} -DOPENSSL_DOING_MAKEDEPEND $@ || exit 1
fi