-
Notifications
You must be signed in to change notification settings - Fork 7
/
:mk.addon
245 lines (228 loc) · 5.49 KB
/
:mk.addon
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
#ident "@(#)mk::mk.addon 1.1.3.1"
echo ""
echo ""
echo " Copyright (c) 1987, 1988 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`
MAKE=${MAKE:-make}
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 i286
then
AS=i286as export AS
CC=i286cc export CC
LD=i286ld 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:$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
CCSTYPE=${CCSTYPE:-ELF}; export CCSTYPE
if i286
then
ldlibs=
elif [ x$CCSTYPE = xELF ]
then
shlibs=${SHLIBS:-""}
noshlibs=${NOSHLIBS:-"-dn"}
perflibs=${PERFLIBS:-$noshlibs}
rootlibs=${ROOTLIBS:-$noshlibs}
else
shlibs=${SHLIBS:-"-lc_s"}
noshlibs=${NOSHLIBS:-""}
perflibs=${PERFLIBS:-$shlibs}
rootlibs=${ROOTLIBS:-$shlibs}
fi
if [ "$SYMLINK" = "" ]
then
RELEASE=`uname -r | cut -c1-3`
if [ $RELEASE -lt 4.0 ]
then
SYMLINK=":"
fi
fi
symlink=${SYMLINK:-"ln -s"}
cd ${ROOT}/usr/src/add-on
#
# check out the BUS type
VPIX=VPIX
MERGE386=MERGE386
while [ $# -ge 1 ]
do
case "$1" in
BUS*) shift;;
ARC*) shift;;
VPIX|vpix) VPIX=VPIX; shift;;
NOVPIX|novpix) VPIX="" ; shift;;
MERGE386|merge386) MERGE386=MERGE386; shift;;
NOMERGE386|nomerge386) MERGE386="" ; shift ;;
*) break;;
esac
done
BUS=${BUS:-AT386}; export BUS
ARCH=${ARCH:-AT386}; export ARCH
BTYPE="BUS=$BUS"; export BTYPE
ATYPE="ARCH=$ARCH"; export ATYPE
DFLGS="$VPIX $MERGE386"; export DFLGS
if [ $# = 0 ]
then
ADDONS="*"
else
ADDONS="$*"
fi
echo "Press <DEL> if not correct. You have 30 seconds to kill this build."
echo "I am PID $$."
sleep 30 ; echo ""
for addon in ${ADDONS}
do
if [ ! -f ${addon}/prototype ]
then
cd ${addon}
echo "======== ${addon}"
${MAKE} -b -f ${addon}.mk ${BTYPE} ${ATYPE} ROOTLIBS='$rootlibs' PERFLIBS='$perflibs' NOSHLIBS='$noshlibs' SHLIBS='$shlibs' SYMLINK='$symlink' FRC=FRC DFLGS='$DFLGS' install
if [ $? -ne 0 ]
then
echo "******** Build of ${addon} add-on FAILED"
else
if [ ! -z "${MCS}" ]
then
echo "-------- Modifying comment section for ${addon}"
if [ ! -d pkg ]
then
echo "WARNING: No object stamping done for ${addon}."
else
cd pkg
for file in `find . -type f -print | grep -v Makefile`
do
if ` file ${file} | egrep "executable|archive|relocatable" >/dev/null 2>&1 `
then
if [ "${MCS}" = "mcs" ]
then
echo mcs -d -a "@(#)${COMMENT} ${addon}:${file}" ${file}
mcs -d -a "@(#)${COMMENT} ${addon}:${file}" ${file} > /dev/null 2>&1
if ` file ${file} | grep "archive" >/dev/null 2>&1 `
then
echo "ar ts ${file} > /dev/null 2>&1"
ar ts ${file} > /dev/null 2>&1
fi
fi
if [ "${MCS}" = "pstamp" ]
then
echo pstamp ${COMMENT} ${file}
pstamp ${COMMENT} ${file}
fi
fi
done
cd ..
fi
fi
fi
${MAKE} -b -f ${addon}.mk ${BTYPE} ${ATYPE} ROOTLIBS='$rootlibs' PERFLIBS='$perflibs' NOSHLIBS='$noshlibs' SHLIBS='$shlibs' SYMLINK='$symlink' DFLGS='$DFLGS' package
${MAKE} -b -f ${addon}.mk ${BTYPE} ${ATYPE} ROOTLIBS='$rootlibs' PERFLIBS='$perflibs' NOSHLIBS='$noshlibs' SHLIBS='$shlibs' SYMLINK='$symlink' DFLGS='$DFLGS' clobber
cd ..
fi
done
echo ${0}: done at `date`