]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Roll all the "make depend" transformations into one perl script
authorKen Raeburn <raeburn@mit.edu>
Thu, 27 Oct 2005 06:59:22 +0000 (06:59 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 27 Oct 2005 06:59:22 +0000 (06:59 +0000)
* util/depfix2.pl: Incorporate all substitutions from depfix.sed.
* util/depfix.sed: Deleted.
* config/post.in (.depend): Don't run sed, just use perl.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17458 dc483132-0cff-0310-8789-dd5450dbe970

src/config/ChangeLog
src/config/post.in
src/util/ChangeLog
src/util/depfix.sed [deleted file]
src/util/depfix2.pl

index c30b6896d30b89c935690b05662788c17b1707eb..1faba7cdb5359d8dc6b636baefce2f997ce11888 100644 (file)
@@ -1,5 +1,7 @@
 2005-10-27  Ken Raeburn  <raeburn@mit.edu>
 
+       * post.in (.depend): Don't run sed, just use perl.
+
        * shlib.conf: Set DYNOBJ_EXPDEPS and DYNOBJ_EXPFLAGS.
        (*-*-darwin*): Change MAKE_DYNOBJ_COMMAND definition to use
        DYNOBJ_EXPFLAGS and DYNOBJ_LOADER_PROG instead of SHLIB_EXPFLAGS
index 457449b18e5c281a3d1375cc888dfc20330f55a2..76cf59910a9b40d6158dc49f8bffa14d6e3dbc21 100644 (file)
@@ -86,8 +86,7 @@ depend-dependencies:
        x=`$(CC) -print-libgcc-file-name` ; \
        perl $(SRCTOP)/util/depfix2.pl \
                '$(SRCTOP)' '$(myfulldir)' '$(srcdir)' '$(BUILDTOP)' "$$x" '$(STLIBOBJS)' \
-               < .d | sed -f $(SRCTOP)/util/depfix.sed | \
-       sed -e '/^$$/d' > .depend
+               < .d > .depend
 
 depend-update-makefile: .depend depend-recurse
        if test -n "$(SRCS)" ; then \
index 432fa5f988157b35836639034df0c0eb82174a90..3f1f287d35102de0892089d5dfe8a3f54d780525 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-27  Ken Raeburn  <raeburn@mit.edu>
+
+       * depfix2.pl: Incorporate all substitutions from depfix.sed.
+       * depfix.sed: Deleted.
+
 2005-10-25  Tom Yu  <tlyu@mit.edu>
 
        * ac_check_krb5.m4: Set LIBS rather than LDFLAGS.
diff --git a/src/util/depfix.sed b/src/util/depfix.sed
deleted file mode 100644 (file)
index 1db3b0c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#
-# Insert the header.....
-#
-1i\
-# +++ Dependency line eater +++\
-# \
-# Makefile dependencies follow.  This must be the last section in\
-# the Makefile.in file\
-#
-
-#
-# Remove line continuations....
-#
-:FIRST
-y/     / /
-s/^ *//
-/\\$/{
-N
-y/     / /
-s/\\\n */ /
-bFIRST
-}
-# for simplicity, always have a trailing space
-s/$/ /
-s/  */ /g
-
-# delete tcl-specific headers
-s;/[^ ]*/tcl\.h ;;g
-s;/[^ ]*/tclDecls\.h ;;g
-s;/[^ ]*/tclPlatDecls\.h ;;g
-
-# delete system-specific or compiler-specific files from list
-s;/os/usr/include/[^ ]* ;;g
-s;/usr/include/[^ ]* ;;g
-s;/usr/lib/[^ ]* ;;g
-
-# remove foo/../ sequences
-:dotdot
-/\/[a-z][a-z0-9_.\-]*\/\.\.\// {
-s;/[a-z][a-z0-9_.\-]*/\.\./;/;g
-bdotdot
-}
-
-# rely on VPATH for $(srcdir) files
-s;\$(srcdir)/\([^ /]* \);\1;g
-
-# allow override of some util dependencies in case local tools are used
-s;\$(BUILDTOP)/include/com_err.h ;$(COM_ERR_DEPS) ;g
-s;\$(BUILDTOP)/include/ss/ss.h \$(BUILDTOP)/include/ss/ss_err.h ;$(SS_DEPS) ;g
-s;\$(BUILDTOP)/include/db.h \$(BUILDTOP)/include/db-config.h ;$(DB_DEPS) ;g
-
-# Some krb4 dependencies should only be present if building with krb4 enabled
-s;\$(BUILDTOP)/include/kerberosIV/krb_err.h ;$(KRB_ERR_H_DEP) ;g
-
-# now delete trailing whitespace
-s; *$;;g
-
-# Split lines if they're too long.
-s/\(.\{50\}[^ ]*\) /\1 \\\
-  /g
-
-
-#
-# Now insert a trailing newline...
-#
-$a\
-
index 0e11b0fde08f8d4162cd432519548657b616b103..b17bf9fc2041da22fe720ecdf7b8b99d01ce029e 100644 (file)
@@ -101,8 +101,68 @@ sub do_subs {
     return $_;
 }
 
+sub do_subs_2 {
+    local($_) = @_;
+    # Add a trailing space.
+    s/$/ /;
+    # Remove excess spaces.
+    s/  */ /g;
+    # Delete Tcl-specific headers.
+    s;/[^ ]*/tcl\.h ;;g;
+    s;/[^ ]*/tclDecls\.h ;;g;
+    s;/[^ ]*/tclPlatDecls\.h ;;g;
+    # Delete system-specific or compiler-specific files.
+    s;/os/usr/include/[^ ]* ;;g;
+    s;/usr/include/[^ ]* ;;g;
+    s;/usr/lib/[^ ]* ;;g;
+    # Remove foo/../ sequences.
+    while (m/\/[a-z][a-z0-9_.\-]*\/\.\.\//) {
+       s//\//g;
+    }
+    # Use VPATH.
+    s;\$\(srcdir\)/([^ /]* );$1;g;
+
+    # Allow override of some util dependencies in case local tools are used.
+    s;\$\(BUILDTOP\)/include/com_err.h ;\$(COM_ERR_DEPS) ;g;
+    s;\$\(BUILDTOP\)/include/ss/ss.h \$\(BUILDTOP\)/include/ss/ss_err.h ;\$(SS_DEPS) ;g;
+    s;\$\(BUILDTOP\)/include/db.h \$\(BUILDTOP\)/include/db-config.h ;\$(DB_DEPS) ;g;
+
+    # Some krb4 dependencies should only be present if building with krb4
+    # enabled.
+    s;\$\(BUILDTOP\)/include/kerberosIV/krb_err.h ;\$(KRB_ERR_H_DEP) ;g;
+
+    # Delete trailing whitespace.
+    s; *$;;g;
+
+    return $_;
+}
+
+sub split_lines {
+    local($_) = @_;
+    s/(.{50}[^ ]*) /$1 \\\n  /g;
+    return $_ . "\n";
+}
+
+print <<EOH ;
+# +++ Dependency line eater +++
+# 
+# Makefile dependencies follow.  This must be the last section in
+# the Makefile.in file
+#
+EOH
+my $buf = '';
 while (<STDIN>) {
+    # Strip newline.
     chop;
-    print &do_subs($_), "\n";
+    # Do directory-specific path substitutions on each filename read.
+    $_ = &do_subs($_);
+    if (m/\\$/) {
+       chop;
+       $buf .= $_;
+    } else {
+       $buf = &do_subs_2($buf . $_);
+       print &split_lines($buf);
+       $buf = '';
+    }
 }
 exit 0;