-
Notifications
You must be signed in to change notification settings - Fork 7
/
:mkoam
212 lines (192 loc) · 4.47 KB
/
:mkoam
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
#ident "@(#)mk::mkoam 1.1.4.1"
#
# Similar to :mk.addon but deals w/ OA&M style packages
#
echo ""
echo ""
echo " Copyright (c) 1987, 1988, 1989 AT&T"
echo " All Rights Reserved"
echo ""
echo " THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T"
echo " The copyright notice above does not evidence any actual or"
echo " intended publication of such source code."
echo ""
echo ""
echo ""
echo ${0}: started at `date`
SLBASE=${ROOT}
export SLBASE
# If we are in a cross compilation environment then use cross compiler
if [ "$ROOT" != "" ]
then
if u3b2 || u3b5
then
AS=m32as export AS
CC=m32cc export CC
LD=m32ld export LD
fi
if i386
then
AS=i386as export AS
CC=i386cc export CC
LD=i386ld export LD
fi
echo "You are in a cross compilation environment."
PATH=$ROOT/xenv:/usr/ccs/bin:/usr/bin:/usr/sbin:/etc:$PATH
echo ROOT="${ROOT}"
else
AS=as export AS
CC=cc export CC
LD=ld export LD
fi
#
# Perform object stamping if MCS variable is set in shell env
#
case "${MCS}" in
mcs)
MCS=mcs export MCS
if i386
then
TARGET=${TARGET:=i386} export TARGET
RELEASE=${RELEASE:=unk} export RELEASE
LOAD="${LOAD}" export LOAD
COMMENT="UNIX System V/386 Release 4.0 $LOAD"
export COMMENT
else
echo "The proper variables have not been set in ${0}."
echo "No mcs will be performed."
MCS=""
fi
echo "Comment sections will be modified using ${MCS}."
echo "The following string will replace the existing contents:"
echo "${COMMENT} <name of add-on>"
break
;;
pstamp)
if i386
then
PRODUCT=${PRODUCT:=386unix} export PRODUCT
TARGET=${TARGET:=i386} export TARGET
RELEASE=${RELEASE:=unk} export RELEASE
LOAD="${LOAD}" export LOAD
if [ -z "${LOAD}" ]
then
echo "The LOAD variable was not set."
echo "No pstamping will be performed."
MCS=""
else
LOAD=`echo ${LOAD} | tr "[a-z]" "[A-Z]"`
COMMENT="-p ${PRODUCT} -t ${TARGET} -r ${RELEASE} -l ${LOAD}"
export COMMENT
echo "PRODUCT=${PRODUCT}"
echo "RELEASE=${RELEASE}"
echo "TARGET=${TARGET}"
echo "LOAD=${LOAD}"
echo "Objects will be pstamped."
fi
else
echo "The proper variables have not been set in ${0}."
echo "No pstamping will be performed."
MCS=""
fi
break
;;
*)
echo "Null or unknown MCS variable passed to ${0}."
echo "Object comment sections will remain unchanged."
break
;;
esac
# Insure that only one machine type is valid
# Note: the redirection is needed to handle the possibility
# of a nonexistent file in the $MACH machine list
MACH="vax pdp11 u3b2 u3b u3b5 i286 i386"
(truecnt=0
for mach in $MACH
do
`$mach`
if [ $? -eq 0 ]
then
truecnt=`expr $truecnt + 1`
fi
done
if [ $truecnt -ne 1 ]
then
echo ":${0}: **** Only one of the following machine types can"
echo " be true: $MACH"
exit 1
fi ) 2>/dev/null
#
# check out the BUS type
while [ $# -ge 1 ]
do
case "$1" in
BUS*) shift;;
ARC*) shift;;
*) break;;
esac
done
BUS=${BUS:-AT386}; export BUS
ARCH=${ARCH:-AT386}; export ARCH
BTYPE="BUS=$BUS"; export BTYPE
ATYPE="ARCH=$ARCH"; export ATYPE
for dir in add-on pkg
do
cd $ROOT/usr/src/$dir
if [ $# = 0 ]
then
ADDONS="*"
else
ADDONS="$*"
fi
for addon in ${ADDONS}
do
if [ -f ${addon}/prototype ]
then
cd ${addon}
echo "======== ${addon}"
if [ ! -z "${MCS}" ]
then
grep "^![ ]include" prototype > /dev/null 2>&1
if [ "$?" = "0" ]
then cat prototype > t.prototype
grep "^![ ]include" prototype | awk '{print $3}' | while read i
do cat $i >> t.prototype
done
else cat prototype > t.prototype
fi
grep "^!" t.prototype | cut -c2- | grep '=' |
(
while read i; do eval $i; done
bfile=`grep "^[fv][ ]" t.prototype | awk '{print $3}' | cut -f2- -d=`
for file in $bfile `grep "^[i][ ]" t.prototype | awk '{print $2}' | cut -f2- -d=`
do
file=`eval echo $file`
if [ ! -f $ROOT/$file ]
then file=usr/src/$dir/$addon/$file
fi
if [ "${MCS}" = "mcs" ]
then
echo mcs -d -a "@(#)${COMMENT} ${addon}:${file}" ${ROOT}/${file}
mcs -d -a "@(#)${COMMENT} ${addon}:${file}" ${ROOT}/${file} > /dev/null 2>&1
if ` file ${ROOT}/${file} | grep "archive" >/dev/null 2>&1 `
then
AR=${AR:=ar} export AR
echo "${AR} ts ${ROOT}/${file} > /dev/null 2>&1"
${AR} ts ${ROOT}/${file} > /dev/null 2>&1
fi
fi
if [ "${MCS}" = "pstamp" ]
then
echo pstamp ${COMMENT} ${ROOT}/${file}
pstamp ${COMMENT} ${ROOT}/${file}
fi
done
)
rm -f t.prototype
fi
cd ..
fi
done
done
echo ${0}: done at `date`