From aa3f28a712c56ea619f977f497a61ede2e5ba411 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 27 Oct 2005 06:59:22 +0000 Subject: [PATCH] Roll all the "make depend" transformations into one perl script * 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 | 2 ++ src/config/post.in | 3 +- src/util/ChangeLog | 5 ++++ src/util/depfix.sed | 67 -------------------------------------------- src/util/depfix2.pl | 62 +++++++++++++++++++++++++++++++++++++++- 5 files changed, 69 insertions(+), 70 deletions(-) delete mode 100644 src/util/depfix.sed diff --git a/src/config/ChangeLog b/src/config/ChangeLog index c30b6896d..1faba7cdb 100644 --- a/src/config/ChangeLog +++ b/src/config/ChangeLog @@ -1,5 +1,7 @@ 2005-10-27 Ken Raeburn + * 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 diff --git a/src/config/post.in b/src/config/post.in index 457449b18..76cf59910 100644 --- a/src/config/post.in +++ b/src/config/post.in @@ -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 \ diff --git a/src/util/ChangeLog b/src/util/ChangeLog index 432fa5f98..3f1f287d3 100644 --- a/src/util/ChangeLog +++ b/src/util/ChangeLog @@ -1,3 +1,8 @@ +2005-10-27 Ken Raeburn + + * depfix2.pl: Incorporate all substitutions from depfix.sed. + * depfix.sed: Deleted. + 2005-10-25 Tom Yu * 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 index 1db3b0c86..000000000 --- a/src/util/depfix.sed +++ /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\ - diff --git a/src/util/depfix2.pl b/src/util/depfix2.pl index 0e11b0fde..b17bf9fc2 100644 --- a/src/util/depfix2.pl +++ b/src/util/depfix2.pl @@ -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 <) { + # 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; -- 2.26.2