From b352d87a13c838821fcde68167ee53f2ce93bd09 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Thu, 6 Sep 2001 10:42:47 +0000 Subject: [PATCH] now process myfulldir arg too git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13732 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/depgen.sed | 50 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/src/util/depgen.sed b/src/util/depgen.sed index fc40c442e..ca920f3a9 100644 --- a/src/util/depgen.sed +++ b/src/util/depgen.sed @@ -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 -- 2.26.2