now process myfulldir arg too
authorKen Raeburn <raeburn@mit.edu>
Thu, 6 Sep 2001 10:42:47 +0000 (10:42 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 6 Sep 2001 10:42:47 +0000 (10:42 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13732 dc483132-0cff-0310-8789-dd5450dbe970

src/util/depgen.sed

index fc40c442e9cf902ef1fb9a981890700ea629f730..ca920f3a96ddf1f0383002b9a98d8d2912119a43 100644 (file)
@@ -1,18 +1,60 @@
-# input srctop something like ../../../../asrc/lib/krb5/asn.1/../../../
+# input srctop myfulldir
+# something like ../../../../asrc/lib/krb5/asn.1/../../../ lib/krb5/asn.1
+# 
 # output a sequence of sed commands for recognizing and replacing srctop,
 # something like:
 # s; ../../../../asrc/lib/krb5/asn.1/../../../; $(SRCTOP)/;g
 # s; ../../../../asrc/lib/krb5/../../; $(SRCTOP)/;g
 # s; ../../../../asrc/lib/../; $(SRCTOP)/;g
 # s; ../../../../asrc/; $(SRCTOP)/;g
+# s; $(SRCTOP)/lib/krb5/asn.1/; $(srcdir)/;g
+# s; $(SRCTOP)/lib/krb5/; $(srcdir)/../;g
+# ...
 
+# just process first "word"
+h
+s/ .*$//
+
+# replace multiple slashes with one single one
+s,///*,/,g
+# replace /./ with /
+s,/\./,/,g
+# strip trailing slashes, but not if it'd leave the string empty
+s,\(..*\)///*,\1/,
+# quote dots
 s,\.,\\.,g
+# turn string into sed pattern
 s,^,s; ,
 s,$,/; $(SRCTOP)/;g,
+# emit potentially multiple patterns
 :loop
-/\/[a-z][a-z0-9_.\-]*\/\\\.\\\.\// {
+/\/[a-z][a-zA-Z0-9_.\-]*\/\\\.\\\.\// {
 p
-s;/[a-z][a-z0-9_.\-]*/\\\.\\\./;/;
+s;/[a-z][a-zA-Z0-9_.\-]*/\\\.\\\./;/;
 bloop
 }
-# implicit print at end
+p
+
+# now process second "word"
+x
+s/^.* //
+
+# treat "." specially
+/^\.$/{
+d
+q
+}
+# make sed pattern
+s,^,s; $(SRCTOP)/,
+s,$,/; $(srcdir)/;g,
+# emit potentially multiple patterns
+:loop2
+\,[^/)]/; , {
+p
+# strip trailing dirname off first part; append "../" to second part
+s,/[a-z][a-zA-Z0-9_.\-]*/; ,/; ,
+s,/;g,/../;g,
+bloop2
+}
+# kill implicit print at end; don't change $(SRCTOP) into .. sequence
+d