summaryrefslogtreecommitdiff
path: root/mkdep
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-05-08 00:08:12 -0700
committerGuy Harris <guy@alum.mit.edu>2013-05-08 00:08:12 -0700
commit122e1529b7fc90677d87bd2af2391f69ab3d5ca4 (patch)
tree71ae7be45df28f4d23ba91a399e3ccf42adcaad5 /mkdep
parentb2fd5f862cbd03a47c1160b3acbc4413a1929e36 (diff)
downloadtcpdump-122e1529b7fc90677d87bd2af2391f69ab3d5ca4.tar.gz
Support dependency generation with some non-GCC compilers.
Also, if we don't support it with a given compiler, have "make depend" not run mkdep, as it won't do anything useful.
Diffstat (limited to 'mkdep')
-rwxr-xr-xmkdep10
1 files changed, 8 insertions, 2 deletions
diff --git a/mkdep b/mkdep
index 2a9c221b..3062e642 100755
--- a/mkdep
+++ b/mkdep
@@ -18,6 +18,7 @@ export PATH
MAKE=Makefile # default makefile name is "Makefile"
CC=cc # default C compiler is "cc"
+DEPENDENCY_CFLAG=-M # default dependency-generation flag is -M
while :
do case "$1" in
@@ -31,6 +32,11 @@ while :
MAKE=$2
shift; shift ;;
+ # -m allows you to specify the dependency-generation flag
+ -m)
+ DEPENDENCY_CFLAG=$2
+ shift; shift ;;
+
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
@@ -42,7 +48,7 @@ while :
done
if [ $# = 0 ] ; then
- echo 'usage: mkdep [-p] [-c cc] [-f makefile] [flags] file ...'
+ echo 'usage: mkdep [-p] [-c cc] [-f makefile] [-m dependency-cflag] [flags] file ...'
exit 1
fi
@@ -74,7 +80,7 @@ _EOF_
# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
# XXX this doesn't work with things like "-DDECLWAITSTATUS=union\ wait"
-$CC -M $* |
+$CC $DEPENDENCY_CFLAG $* |
sed "
s; \./; ;g
$SED" |