]> git.sur5r.net Git - openldap/blobdiff - build/mkdep
update project settings
[openldap] / build / mkdep
index 102b932ebc2c45773f1e2c30fa7c2e1a9b35ad34..07fd779a907d453848a865283d95e37395c758d8 100755 (executable)
@@ -1,5 +1,9 @@
 #!/bin/sh -
+# Copyright 1998,1999 The OpenLDAP Foundation
+# COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
+# of this package for details.
 #
+# Portions
 # Copyright (c) 1987 Regents of the University of California.
 # All rights reserved.
 #
@@ -26,6 +30,7 @@ set -e                                # exit immediately if any errors occur
 MAKE=Makefile                  # default makefile name is "Makefile"
 NOSLASH="no"                   # by default, / dependencies are included
 CC=${CC-cc}                            # default compiler is cc
+: ${CC_MKDEP_FLAGS="-M"}       # cc -M usually produces dependencies
 SRCDIR=""
 SED=cat
 
@@ -122,27 +127,31 @@ cat << _EOF_ >> $TMP
 
 #
 # files: $*
-# command: $CC -M $files
+# command: $CC $CC_MKDEP_FLAGS $files
 #
 
 _EOF_
 
-$CC -M $files | \
+$CC $CC_MKDEP_FLAGS $files | \
        sed -e 's; \./; ;g' | \
        $SED | \
 awk '
 $1 ~ /:/ {
-       filenm=$1
-       dep=$2
+       filenm=$1;
+       dep=substr($0, length(filenm)+1);
 }
 $1 !~ /:/ {
-       dep=$1
+       dep=$0;
 }
 /.*/ {
-       if (( noslash == "yes") && (dep ~ /^\// )) next
-       if ( length(dep) < 2 ) next
-       rec = filenm " " dep;
-       print rec;
+       split(dep, depends, " ");
+       for(d in depends) {
+               dfile = depends[d];
+               if (( noslash == "yes") && (dfile ~ /^\// )) next
+               if ( length(dfile) < 2 ) continue
+               rec = filenm " " dfile;
+               print rec;
+       }
     }
 ' noslash="$NOSLASH" >> $TMP