diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-06-01 22:24:55 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-06-01 22:24:55 +0000 |
commit | 8a4dff14ad7560aae83e9155d0c62ba7f8c101fd (patch) | |
tree | f9803ea83fa7cb6020e84b78f3fc45b4086e4a13 /bs/mkdep.sh | |
parent | 97698bd4aaf168620205fea26f089e7b1acc869d (diff) | |
download | mpd-8a4dff14ad7560aae83e9155d0c62ba7f8c101fd.tar.gz mpd-8a4dff14ad7560aae83e9155d0c62ba7f8c101fd.tar.xz mpd-8a4dff14ad7560aae83e9155d0c62ba7f8c101fd.zip |
Add the bs build system from mpd-ke
Dealing with autotools is too painful when having
to deal with multiple build environments and
configurations.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7368 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rwxr-xr-x | bs/mkdep.sh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/bs/mkdep.sh b/bs/mkdep.sh new file mode 100755 index 000000000..019b4bc4c --- /dev/null +++ b/bs/mkdep.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# $d must have a trailing slash $(dir file) in GNU Make +f="$1" +d="$2" +x="$3" +if test -z "$O"; then + echo '$O= not defined or not a directory' >&2 + exit 1 +fi +test -d "$O/$d" || "$SHELL" ./bs/mkdir_p.sh "$O/$d" +t="$O/t.$$.d" +depmode= +out= +if test -e "$O/depmode"; then + . "$O/depmode" +fi + +case "$depmode" in +mm) + $CC -MM $CPPFLAGS $CFLAGS "$f" > "$t" 2>/dev/null + ;; +m) + $CC -M $CPPFLAGS $CFLAGS "$f" > "$t" 2>/dev/null + ;; +none) + echo "$O/$f: $f $HDR_DEP_HACK" | sed -e 's#c:#o:#' > "$x"+ + ;; +*) + # detect our depmode + # -MM is gcc-specific... + $CC -MM $CPPFLAGS $CFLAGS "$f" > "$t" 2>/dev/null + if test $? -eq 0; then + depmode=mm + else + # ok, maybe -M is supported... + $CC -M $CPPFLAGS $CFLAGS "$f" \ + > "$t" 2>/dev/null + if test $? -eq 0; then + depmode=m + else + depmode=none + # don't guess, fudge the dependencies by using + # all headers + echo "$O/$f: $f $HDR_DEP_HACK" \ + | sed -e 's#c:#o:#' > "$x"+ + fi + fi + echo "depmode=$depmode" > "$O/depmode" + ;; +esac + +case "$depmode" in +m|mm) + sed -e 's#.c$#.o#' -e "1s#^#$O/$d&#" < "$t" > "$x"+ + ;; +esac +rm -f "$t" +exec mv "$x"+ "$x" |