Rev | Line | |
---|
[9] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
| 3 | # mkdep 1.1 - Generate Makefile dependencies. Author: Kees J. Bot
|
---|
| 4 | #
|
---|
| 5 | # Does what 'cc -M' should do, but no compiler gets it right, they all
|
---|
| 6 | # strip the leading path of the '.o' file.)
|
---|
| 7 | #
|
---|
| 8 | # Added option to generate .depend files in subdirectories of given dir.
|
---|
| 9 | # Jorrit N. Herder
|
---|
| 10 |
|
---|
| 11 | case $# in
|
---|
| 12 |
|
---|
| 13 | # Display help ...
|
---|
| 14 | 0)
|
---|
| 15 | echo "Usage: mkdep 'cpp command' file ..." >&2
|
---|
| 16 | echo " mkdep directory" >&2
|
---|
| 17 | ;;
|
---|
| 18 |
|
---|
| 19 | # Create .depend files ...
|
---|
| 20 | 1)
|
---|
| 21 | echo "Creating .depend files in $1"
|
---|
| 22 | for dir in `find $1 -type d ! -name CVS`
|
---|
| 23 | do
|
---|
| 24 | touch $dir/.depend
|
---|
| 25 | done
|
---|
| 26 |
|
---|
| 27 | ;;
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | # Get dependencies ...
|
---|
| 31 | *)
|
---|
| 32 | cpp="$1"; shift
|
---|
| 33 |
|
---|
| 34 | for f
|
---|
| 35 | do
|
---|
| 36 | : < "$f" || exit
|
---|
| 37 |
|
---|
| 38 | o=`expr "$f" : '\(.*\)\..*'`.o
|
---|
| 39 |
|
---|
| 40 | echo
|
---|
| 41 |
|
---|
| 42 | $cpp "$f" | \
|
---|
| 43 | sed -e '/^#/!d
|
---|
| 44 | s/.*"\(.*\)".*/\1/
|
---|
| 45 | s:^\./::' \
|
---|
| 46 | -e "s:^:$o\: :" | \
|
---|
| 47 | sort -u
|
---|
| 48 | done
|
---|
| 49 | esac
|
---|
| 50 |
|
---|
| 51 | exit 0
|
---|
| 52 |
|
---|
| 53 | #
|
---|
| 54 | # $PchId: mkdep.sh,v 1.3 1998/07/23 21:24:38 philip Exp $
|
---|
| 55 | #
|
---|
Note:
See
TracBrowser
for help on using the repository browser.