1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
# input srctop myfulldir srcdir buildtop libgccfilename
# 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
# ...
# Notes:
# Keep "s..." and "p" commands on separate lines. The "s///p" form is
# supposed to print the result if a substitution is done. When we
# then alter the pattern space and print other stuff, the IRIX sed
# seems to omit some of the earlier intended output. I think we're
# always doing the substitutions anyways, so always printing should be
# fine.
# 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\
# libgcc file name = \5\
#\
\
# First, remove redundant leading "//" and "./" ...\
s;///*;/;g\
s; \\./; ;g|
p
x
h
s|^[^ ]* [^ ]* [^ ]* [^ ]* ||
s|libgcc\.[^ ]*$|include|
s|\.|\\.|g
s|\([^ ][^ ]*\)|\
# Remove gcc's include files resulting from "fixincludes";\
# they're essentially system include files.\
s;\1/[^ ]* ;;g\
s;\1/[^ ]*$;;g\
\
# Recognize $(SRCTOP) and make it a variable reference.\
# (Is this step needed, given the substitutions below?)|
p
x
# Drop the last (possibly empty?) word, gcc's prefix. Then save four words.
s, [^ ]*$,,
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/ .*$//
# 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-zA-Z0-9_.\-]*\/\\\.\\\.\// {
p
s;/[a-z][a-zA-Z0-9_.\-]*/\\\.\\\./;/;
bloop
}
p
x
h
s|^.*$|\
# Now try to produce pathnames relative to $(srcdir).|
p
# now process second "word"
x
h
s/^[^ ]* //
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
}
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
s/^.*$/\
# end of sed code generated by depgen.sed/
|