Repository navigation
Expand file tree
/
Copy pathgenerate.sh
More file actions
262 lines (227 loc) · 5.38 KB
/
Copy pathgenerate.sh
File metadata and controls
262 lines (227 loc) · 5.38 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
#!/bin/sh
# called with parameters: 1:dir 2:ackbase 3:gnubase
set -e
. /etc/make.conf
exec >Makefile
exec 3>Makedepend-ack
exec 4>Makedepend-gnu
touch .depend-ack
touch .depend-gnu
echo "#Generated from $1/Makefile.in"
ACKBASE=$2
GNUBASE=$3
OBJDIR=$1
RECURSIVE_TARGETS="clean depend depend-ack depend-gnu"
if [ -z $ACKBASE ]; then echo ACKBASE is not set!; exit 1; fi
if [ -z $GNUBASE ]; then echo GNUBASE is not set!; exit 1; fi
. Makefile.in
#to enable library debugging, enable the next line
#CFLAGS=$CFLAGS" -g"
echo "all: all-ack"
echo
echo "all-ack:"
echo "all-gnu:"
echo
echo "makefiles: Makefile"
echo "Makedepend-ack Makedepend-gnu: "
echo " sh $0 $OBJDIR $ACKBASE $GNUBASE"
echo
echo "Makefile: Makefile.in Makedepend-ack Makedepend-gnu"
echo " sh $0 $OBJDIR $ACKBASE $GNUBASE"
echo " @echo"
echo " @echo *Attention*"
echo " @echo Makefile is regenerated... rerun command to see changes"
echo " @echo *Attention*"
echo " @echo"
echo
if [ ! -z "$SUBDIRS" ]; then
echo "all-ack: makefiles"
for dir in $SUBDIRS
{
if [ $TYPE = "both" -o $TYPE = "ack" ]; then
echo " mkdir -p $ACKBASE/$OBJDIR/$dir"
fi
echo " cd $dir && \$(MAKE) \$@"
}
echo
echo "all-gnu: makefiles"
for dir in $SUBDIRS
{
if [ $TYPE = "both" -o $TYPE = "gnu" ]; then
echo " mkdir -p $GNUBASE/$OBJDIR/$dir"
fi
echo " cd $dir && \$(MAKE) \$@"
}
echo
echo "$RECURSIVE_TARGETS:: makefiles"
for dir in $SUBDIRS
{
#if [ $TYPE = "both" -o $TYPE = "ack" ]; then
#echo " mkdir -p $ACKBASE/$OBJDIR/$dir"
#fi
#if [ $TYPE = "both" -o $TYPE = "gnu" ]; then
#echo " mkdir -p $GNUBASE/$OBJDIR/$dir"
#fi
echo " cd $dir && \$(MAKE) \$@"
}
echo
for dir in $SUBDIRS
{
echo "makefiles: $dir/Makefile"
}
echo
for dir in $SUBDIRS
{
echo "$dir/Makefile: $dir/Makefile.in"
echo " cd $dir && sh ../$0 $OBJDIR/$dir ../$ACKBASE ../$GNUBASE && \$(MAKE) makefiles"
}
else
echo "depend: depend-ack"
echo "depend-ack:" >&3
echo " rm .depend-ack" >&3
echo " touch .depend-ack" >&3
echo "depend-gnu:" >&4
echo " rm .depend-gnu" >&4
echo " touch .depend-gnu" >&4
ackCommands()
{
dstfile=$1
srcfile=$2
dstdir=`dirname $dstfile`
case $srcfile in
*.s | *.c | *.e )
echo " cc $CFLAGS -c -o $dstfile $srcfile"
echo " mkdep 'cc $CFLAGS -E' $srcfile | sed -e 's:^\(.\):$dstdir/\1:' >> .depend-ack" >&3
;;
*.mod )
echo " m2 $M2FLAGS -c -o $dstfile $srcfile"
echo " mkdep 'm2 $M2FLAGS -E' $srcfile | sed -e 's:^\(.\):$dstdir/\1:' >> .depend-ack" >&3
;;
*.fc )
echo " sh ./FP.compile $dstfile $srcfile"
echo " mkdep 'cc -E' $srcfile | sed -e 's:^\(.\):$dstdir/\1:' >> .depend-ack" >&3
;;
esac
}
gnuCommands()
{
dstfile=$1
srcfile=$2
dstdir=`dirname $dstfile`
sedcmd="sed -e '/<built-in>/d' -e '/<command line>/d' -e 's:^\(.\):$dstdir/\1:'"
case $srcfile in
*.s )
echo " gcc $CFLAGS -E -x assembler-with-cpp -I. $srcfile | asmconv -mi386 ack gnu > $GNUBASE/$OBJDIR/$srcfile.gnu || true"
echo " gas -o $dstfile $GNUBASE/$OBJDIR/$srcfile.gnu"
echo " mkdep 'gcc $CFLAGS -E -x assembler-with-cpp -I.' $srcfile | $sedcmd >> .depend-gnu" >&4
;;
*.gs )
echo " gas -o $dstfile $srcfile"
echo " mkdep 'gcc $CFLAGS -E -x assembler-with-cpp -I.' $srcfile | $sedcmd >> .depend-gnu" >&4
;;
*.c )
echo " gcc $CFLAGS -c -o $dstfile $srcfile"
echo " mkdep 'gcc $CFLAGS -E' $srcfile | $sedcmd >> .depend-gnu" >&4
;;
#*.mod )
# echo " \$(M2C) -o $dstfile $srcfile"
# ;;
#*.fc )
# echo " sh ./FP.COMPILE $srcfile"
# ;;
esac
echo
}
#libraries
for lib in $LIBRARIES
{
if [ $TYPE = "both" -o $TYPE = "ack" ]; then
echo "all-ack: $ACKBASE/$lib.a"
eval "FILES=\$${lib}_FILES"
echo
for f in $FILES
{
o=`echo $f | sed -e 's/\\..*\$/\.o/'`
echo "$ACKBASE/$lib.a: $ACKBASE/$lib.a($o)"
}
echo
echo "$ACKBASE/$lib.a:"
echo " ar cr $ACKBASE/$lib.a $ACKBASE/$OBJDIR/*.o"
echo " rm $ACKBASE/$OBJDIR/*.o"
echo
for f in $FILES
{
o=`echo $f | sed -e 's/\\..*\$/\.o/'`
echo "$ACKBASE/$lib.a($o): $f"
ackCommands $ACKBASE/$OBJDIR/$o $f
}
echo
fi
if [ $TYPE = "both" -o $TYPE = "gnu" ]; then
echo "all-gnu: $GNUBASE/$lib.a"
eval "FILES=\$${lib}_FILES"
echo
for f in $FILES
{
o=`echo $f | sed -e 's/\\..*\$/\.o/'`
echo "$GNUBASE/$lib.a: $GNUBASE/$OBJDIR/$o"
}
echo
echo "$GNUBASE/$lib.a:"
echo " gar cr $GNUBASE/$lib.a \$?"
echo
for f in $FILES
{
o=`echo $f | sed -e 's/\\..*\$/\.o/'`
echo "$GNUBASE/$OBJDIR/$o: $f"
gnuCommands $GNUBASE/$OBJDIR/$o $f
}
echo
fi
}
echo
#start files
for f in $STARTFILES
{
o=`echo $f | sed -e 's/\\..*\$/\.o/'`
if [ $TYPE = "both" -o $TYPE = "ack" ]; then
echo "all-ack: $ACKBASE/$o"
echo
echo "$ACKBASE/$o: $f"
ackCommands $ACKBASE/$o $f
echo
fi
if [ $TYPE = "both" -o $TYPE = "gnu" ]; then
echo "all-gnu: $GNUBASE/$o"
echo
echo "$GNUBASE/$o: $f"
gnuCommands $GNUBASE/$o $f
echo
fi
}
fi # elif of if [ -n "$SUBDIRS" ]
echo
echo "clean::"
if [ $TYPE = "both" -o $TYPE = "ack" ]; then
echo " rm -f $ACKBASE/$OBJDIR/*"
fi
if [ $TYPE = "both" -o $TYPE = "gnu" ]; then
echo " rm -f $GNUBASE/$OBJDIR/*"
fi
if [ $OBJDIR = "." ]; then
echo
echo "install: install-ack"
echo
echo "install-ack: all-ack"
# $ARCH is from /etc/make.conf
echo " cp $ACKBASE/*.[ao] /usr/lib/$ARCH"
echo
echo "install-gnu: all-gnu"
echo " cp $GNUBASE/*.[ao] /usr/gnu/lib"
fi
echo
echo "include Makedepend-ack"
echo "include .depend-ack"
echo
echo "include Makedepend-gnu"
echo "include .depend-gnu"