Bell 32V release
[unix-history] / usr / src / cmd / Admin / Mk
CommitLineData
56d95162
TL
1trap "" 1
2DESTDIR=${DESTDIR-/usr/vaxv7}
3CC=cc
4
5: make sure directory hierarchy exists
6( cd $DESTDIR
7 for i in bin etc lib sys usr
8 do if [ ! -d $i ]
9 then rm -f $i; mkdir $i
10 fi
11 done
12 cd $DESTDIR/usr
13 for i in bin dict games lib
14 do if [ ! -d $i ]
15 then rm -f $i; mkdir $i
16 fi
17 done
18 cd $DESTDIR/usr/lib
19 for i in lex refer struct term uucp
20 do if [ ! -d $i ]
21 then rm -f $i; mkdir $i
22 fi
23 done
24)
25cd ..
26
27for i in $*
28do echo " ======== $i"
29
30 CFLAGS='-O -d2'
31 case $i in
32 dump.c|dumpdir.c|egrep.y|fgrep.c|ncheck.c|restor.c|sa.c|sort.c) CFLAGS=-O ;;
33 as|awk|eqn|f77|lex|lint|llx|pcc|plot|refer|sed|struct|tbl|uucp|yacc) CFLAGS=-O ;;
34 esac
35
36 case $i in
37
38 clean) rm -f *.o core y.tab.c lex.yy.c ;: Clean unwanted files.
39 ;;
40
41 *.y) B=`basename $i .y`
42 eval D=`grep " $B\$" Admin/destinations`
43 yacc $B.y \
44 && $CC $CFLAGS -o $B y.tab.c -lln \
45 && install -s $B $DESTDIR$D/$B
46 rm -f y.tab.[co] $B
47 ;;
48
49 *.l) B=`basename $i .l`
50 eval D=`grep " $B\$" Admin/destinations`
51 lex $B.l \
52 && $CC $CFLAGS -o $B lex.yy.c -lln \
53 && install -s $B $DESTDIR$D/$B
54 rm -f lex.yy.[co] $B
55 ;;
56
57 *.c) B=`basename $i .c`
58 eval D=`grep " $B\$" Admin/destinations`
59 $CC $CFLAGS -o $B $B.c \
60 && install -s $B $DESTDIR$D/$B
61 rm -f $B.o $B
62 ;;
63
64 *.s) B=`basename $i .s`
65 eval D=`grep " $B\$" Admin/destinations`
66 as -o $B.o $B.s \
67 && $CC -o $B $B.o \
68 && install -s $B $DESTDIR$D/$B
69 rm -f $B.o $B
70 ;;
71
72 *.sh) B=`basename $i .sh`
73 eval D=`grep " $B\$" Admin/destinations`
74 install -c $B.sh $DESTDIR$D/$B
75 ;;
76
77 Admin) echo Do nothing.
78 ;;
79
80 ALIASES) echo Establish alias names.
81 test -f $DESTDIR/test && ln $DESTDIR/test $DESTDIR/[
82 test -f $DESTDIR/ed && ln $DESTDIR/ed $DESTDIR/e
83 ;;
84
85 *) if [ ! -d $i ]
86 then echo "Don't know what to do with $i."
87 else
88 cd $i
89 make CC=$CC CFLAGS="$CFLAGS" DESTDIR=$DESTDIR \
90 && make install DESTDIR=$DESTDIR \
91 && make clean
92 cd ..
93 fi
94
95 esac
96done