From 46547f80242c629d20a68e45a69359990cfd627b Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 11 Sep 2002 02:58:24 +0000 Subject: [PATCH] Move all depfix2.sed generation into depgen.sed, so ".." in $(srcdir) and $(BUILDTOP) can be properly quoted, and won't match names like "ss". git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14837 dc483132-0cff-0310-8789-dd5450dbe970 --- src/config/post.in | 9 +----- src/util/ChangeLog | 5 ++++ src/util/depgen.sed | 68 ++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 70 insertions(+), 12 deletions(-) diff --git a/src/config/post.in b/src/config/post.in index 7a08e857b..337a003e1 100644 --- a/src/config/post.in +++ b/src/config/post.in @@ -23,14 +23,7 @@ ALL_DEP_SRCS= $(SRCS) $(EXTRADEPSRCS) # directory-specific parameters. General substitutions independent of local # make variables happen in depfix.sed. depfix2.sed: Makefile $(SRCTOP)/util/depgen.sed - echo '# automatically generated, do not edit' > depfix2.tmp - echo 's;///*;/;g' >> depfix2.tmp - echo 's; \./; ;g' >> depfix2.tmp - echo 's; $(SRCTOP)/; $$(SRCTOP)/;g' >> depfix2.tmp - echo 's; $(srcdir)/; $$(srcdir)/;g' >> depfix2.tmp - echo 's; $$(srcdir)/\.\./; $(srcdir)/../;g' >> depfix2.tmp - echo '$(SRCTOP)' '$(myfulldir)' | sed -f $(SRCTOP)/util/depgen.sed >> depfix2.tmp - echo 's; $(BUILDTOP)/; $$(BUILDTOP)/;g' >> depfix2.tmp + echo '$(SRCTOP)' '$(myfulldir)' '$(srcdir)' '$(BUILDTOP)' | sed -f $(SRCTOP)/util/depgen.sed > depfix2.tmp mv -f depfix2.tmp depfix2.sed DEPLIBOBJNAMEFIX = sed -e 's;^\$$(OUTPRE)\([a-zA-Z0-9_\-]*\)\.\$$(OBJEXT):;\1.so \1.po &;' diff --git a/src/util/ChangeLog b/src/util/ChangeLog index 3607d71cf..2c62f8f30 100644 --- a/src/util/ChangeLog +++ b/src/util/ChangeLog @@ -1,3 +1,8 @@ +2002-09-10 Ken Raeburn + + * depgen.sed: Now expects four values passed in; generates + complete sed script, with quoting for ".." in pathnames. + 2002-09-03 Ken Raeburn * reconf: Give up if autoreconf fails. diff --git a/src/util/depgen.sed b/src/util/depgen.sed index ca920f3a9..86ed7edc6 100644 --- a/src/util/depgen.sed +++ b/src/util/depgen.sed @@ -1,4 +1,4 @@ -# input srctop myfulldir +# input srctop myfulldir srcdir buildtop # something like ../../../../asrc/lib/krb5/asn.1/../../../ lib/krb5/asn.1 # # output a sequence of sed commands for recognizing and replacing srctop, @@ -11,6 +11,48 @@ # s; $(SRCTOP)/lib/krb5/; $(srcdir)/../;g # ... +# Output some mostly-fixed patterns first +h +s|^\([^ ]*\) \([^ ]*\) \([^ ]*\) \([^ ]*\)$|# This file is automatically generated by depgen.sed, do not edit it.\ +#\ +# Parameters used to generate this instance:\ +#\ +# SRCTOP = \1\ +# thisdir = \2\ +# srcdir = \3\ +# BUILDTOP = \4\ +#\ +\ +# First, remove redundant leading "//" and "./" ...\ +s;///*;/;g\ +s; \\./; ;g\ +\ +# Recognize $(SRCTOP) and make it a variable reference.\ +# (Is this step needed, given the substitutions below?)|p +x + +h +s/ .*$// +s,\.,\\.,g +s,^,s; , +s,$,/; $(SRCTOP)/;g, +p +x + +# now recognize $(srcdir) and make it a variable reference +# too, unless followed by "/../" +h +s/^[^ ]* [^ ]* // +s/[^ ]*$// +s/\./\\./g +s|^\(.*\)$|\ +# Now make $(srcdir) variable references, unless followed by "/../".\ +s; \1/; $(srcdir);g\ +s; $(srcdir)/\.\./; \1/../;\ +\ +# Recognize variants of $(SRCTOP).|p +x + # just process first "word" h s/ .*$// @@ -35,9 +77,17 @@ bloop } p +x +h +s|^.*$|\ +# Now try to produce pathnames relative to $(srcdir).| +p + # now process second "word" x -s/^.* // +h +s/^[^ ]* // +s/ [^ ]* [^ ]*$// # treat "." specially /^\.$/{ @@ -53,8 +103,18 @@ s,$,/; $(srcdir)/;g, p # strip trailing dirname off first part; append "../" to second part s,/[a-z][a-zA-Z0-9_.\-]*/; ,/; , -s,/;g,/../;g, +s,/;g,/\.\./;g, bloop2 } + +x +s/^[^ ]* [^ ]* [^ ]* // +s/\./\\./g +s|\(^.*$\)|\ +# Now substitute for BUILDTOP:\ +s; \1/; $(BUILDTOP)/;g| +p + # kill implicit print at end; don't change $(SRCTOP) into .. sequence -d +s/^.*$/\ +# end of sed code generated by depgen.sed/ -- 2.26.2