-
Notifications
You must be signed in to change notification settings - Fork 7
/
:mklib
94 lines (83 loc) · 2.02 KB
/
:mklib
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
cat << END_COPYRIGHT
Copyright (c) 1984, 1986, 1987, 1988 AT&T
All Rights Reserved
THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
The copyright notice above does not evidence any actual or
intended publication of such source code.
END_COPYRIGHT
#ident "@(#)mk::mklib 1.8.3.1"
#
# Build UNIX System libraries
# For each directory build the library by invoking its
# makefile (<dir>.mk).
#
trap "exit 1" 1 2 3 15
# Need these directories for creation of libcurses
if [ "$ROOT" ] && echo $* | grep libcurses >/dev/null
then
for dir in usr/tmp usr/bin etc
do
if [ ! -d $ROOT/$dir ] ; then
rm -f $ROOT/$dir
mkdir $ROOT/$dir
fi
done
fi
# Check that target directories exist in case build libraries don't.
# Paths should be independent of the cross-environment.
for dir in /lib /usr/lib /usr/lib/libp usr/include shlib
do
if [ ! -d $ROOT/$dir ]
then rm -f $ROOT/$dir
mkdir $ROOT/$dir
fi
done
# check out the BUS type.
BTYPE="BUS=AT386"
ATYPE="ARCH=AT386"
VPIX=-DVPIX;
MERGE386=-DMERGE386;
while [ $# -ge 1 ]
do
case "$1" in
BUS*) BTYPE="$1"; shift;;
ARC*) ATYPE="$1"; shift;;
vpix|VPIX) VPIX=-DVPIX; shift;;
novpix|NOVPIX) VPIX=""; shift;;
merge386|MERGE386) MERGE386=-DMERGE386; shift;;
nomerge386|NOMERGE386) MERGE386=""; shift;;
*) break;;
esac
done
DFLGS="$VPIX $MERGE386"; export DFLGS
export BTYPE ATYPE
MAKE=${MAKE:-make}
SRCDIR=${SRC:-$ROOT/usr/src}/lib
cd $SRCDIR
#
for ARG in $*
do
LIB=`basename $ARG`
if [ -d $LIB ]
then (
echo "======== $LIB"
cd $LIB
if [ -f $LIB.mk ]
then
$MAKE -b -f $LIB.mk ${BTYPE} ${ATYPE} DFLGS="${DFLGS}" install \
I="install -i -n $ROOT/lib $ROOT/usr/lib"
if [ $? -ne 0 ] ; then
echo ":mklib: *** $MAKE failed using $LIB.mk"
fi
$MAKE -b -f $LIB.mk ${BTYPE} ${ATYPE} DFLGS="${DFLGS}" clobber
else
echo ":mklib: *** no $LIB.mk file in $SRCDIR/$LIB"
fi
) else
if [ $LIB != lib.mk -a $LIB != libmk.template -a $LIB != libmk.templa ]
then
echo ":mklib: *** no directory found for $LIB under $SRCDIR"
fi
fi
done
exit 0