domd revision 295009
155714Skris#!/bin/sh
255714Skris# Do a makedepend, only leave out the standard headers
355714Skris# Written by Ben Laurie <ben@algroup.co.uk> 19 Jan 1999
455714Skris
555714SkrisTOP=$1
655714Skrisshift
7109998Smarkmif [ "$1" = "-MD" ]; then
8109998Smarkm    shift
9109998Smarkm    MAKEDEPEND=$1
10109998Smarkm    shift
11109998Smarkmfi
12109998Smarkmif [ "$MAKEDEPEND" = "" ]; then MAKEDEPEND=makedepend; fi
1355714Skris
14142425Snectarcp Makefile Makefile.save
15109998Smarkm# fake the presence of Kerberos
16109998Smarkmtouch $TOP/krb5.h
17295009Sjkimif ${MAKEDEPEND} --version 2>&1 | grep "clang" > /dev/null ||
18295009Sjkim   echo $MAKEDEPEND | grep "gcc" > /dev/null; then
19109998Smarkm    args=""
20109998Smarkm    while [ $# -gt 0 ]; do
21109998Smarkm	if [ "$1" != "--" ]; then args="$args $1"; fi
22109998Smarkm	shift
23109998Smarkm    done
24142425Snectar    sed -e '/^# DO NOT DELETE.*/,$d' < Makefile > Makefile.tmp
25109998Smarkm    echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' >> Makefile.tmp
26238405Sjkim    ${MAKEDEPEND} -Werror -D OPENSSL_DOING_MAKEDEPEND -M $args >> Makefile.tmp || exit 1
27109998Smarkm    ${PERL} $TOP/util/clean-depend.pl < Makefile.tmp > Makefile.new
28238405Sjkim    RC=$?
29109998Smarkm    rm -f Makefile.tmp
30109998Smarkmelse
31238405Sjkim    ${MAKEDEPEND} -D OPENSSL_DOING_MAKEDEPEND $@ && \
32142425Snectar    ${PERL} $TOP/util/clean-depend.pl < Makefile > Makefile.new
33238405Sjkim    RC=$?
34109998Smarkmfi
35142425Snectarmv Makefile.new Makefile
36109998Smarkm# unfake the presence of Kerberos
37109998Smarkmrm $TOP/krb5.h
38238405Sjkim
39238405Sjkimexit $RC
40