summaryrefslogtreecommitdiffstats
path: root/src/util/depgen.sed
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2002-09-11 02:58:24 +0000
committerKen Raeburn <raeburn@mit.edu>2002-09-11 02:58:24 +0000
commit46547f80242c629d20a68e45a69359990cfd627b (patch)
treeb46ebf1baa17c847df1b4a210239020526c2e92d /src/util/depgen.sed
parent1843b11ca3719b1c0d45ab98108c9dca56df5ea2 (diff)
downloadkrb5-46547f80242c629d20a68e45a69359990cfd627b.tar.gz
krb5-46547f80242c629d20a68e45a69359990cfd627b.tar.xz
krb5-46547f80242c629d20a68e45a69359990cfd627b.zip
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
Diffstat (limited to 'src/util/depgen.sed')
-rw-r--r--src/util/depgen.sed68
1 files changed, 64 insertions, 4 deletions
diff --git a/src/util/depgen.sed b/src/util/depgen.sed
index ca920f3a96..86ed7edc62 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/