home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
MAWK113.ZIP
/
mawk113
/
build_mawk
< prev
next >
Wrap
Text File
|
1993-02-04
|
4KB
|
216 lines
#!/bin/sh
#
# build_mawk -- build mawk for a known configuration
#
# usage: build_mawk configuration [CC=your_cc]
# build_mawk MF
#
# example: build_mawk sun_os40 CC=gcc
#
# build_mawk MF -- to get a generic Makefile
#
#$Id: build_mawk,v 1.16 1993/02/05 01:56:33 mike Exp $
progname=`basename $0`
if [ $# = 0 ]
then
echo usage: $progname configuration [CC=your_cc] 1>&2
echo " $progname MF" 1>&2
echo 1>&2
echo tested configurations are listed in UCONFIG 1>&2
echo MF builds a fresh Makefile 1>&2
exit 1
fi
arg1=$1
shift
[ $# != 0 ] && eval "$@"
[ "$CC" = "" ] && CC=cc
case $arg1 in
sun_os40)
if sun3 && [ $CC = cc ]
then cflags='-O -f68881'
fi
config=sun_os40.h ;;
sun3_os40_no68881)
config=sun_os40.h ;;
sun_os41)
if sun3 && [ $CC = cc ]
then cflags='-O -f68881'
fi
config=sun_os41.h ;;
sun3_os41_no68881)
config=sun_os41.h ;;
bsd43_vax)
config=bsd43_vax.h ;;
386bsd)
config=386bsd.h ;;
ultrix41_mips)
config=generic.h ;;
ultrix42_mips)
config=ultrix42mips.h
cflags='-O -Olimit 700' ;;
ultrix41_vax)
config=ultrix_vax.h
cflags='-O -YSYSTEM_FIVE' ;;
ultrix31_vax)
config=ultrix_vax.h
cflags='-O -YSYSTEM_FIVE -DHAVE_VOID_PTR=0' ;;
stardentVr3)
config=generic.h ;;
xenix_r2)
config=xenix_r2.h ;;
sysV)
config=sysV.h ;;
sysV_ieeefp)
config=sysV_ieeefp.h ;;
sysVr4i386)
config=sysVr4i386.h ;;
# SCO UNIX has ranlib, but doesn't use it for native UNIX libraries
sysVsco)
config=sysV.h
ranlib=: ;;
#apolloSR10.3) #does not work anymore
# config=apollo.h ;;
dynix)
config=dynix.h ;;
atarist)
config=atarist.h
ranlib=:
ar=car
mathlib=-lpml
CC=cgcc ;;
mips)
config=mips.h
cflags='-O -Olimit 700 -systype bsd43' ;;
sgi)
config=sgi.h
cflags='-O -cckr -w' ;;
next)
config=next.h ;;
aix)
config=aix.h ;;
convex)
config=convex.h
cflags='-O2 -std' ;;
hpux)
config=generic.h ;;
coherent)
echo Coherent will not pass fpe_test
echo overflow cannot be detected
echo
config=coherent.h
cflags='-O -f' ;;
linux)
config=linux.h
CC=gcc ;;
MF) ;;
*) echo "$progname: $arg1: unrecognized configuration" 1>&2
exit 1 ;;
esac
[ "$cflags" = "" ] && cflags=-O
[ "$ranlib" = "" ] && ranlib=ranlib
[ "$ar" = "" ] && ar=ar
[ "$mathlib" = "" ] && mathlib=-lm
# set CFLAGS for gcc
if [ $CC = gcc ]
then #determine gcc version
if gcc -v 2>&1 | egrep 'version 2' >/dev/null
then cflags=-O2
else cflags='-O -traditional'
fi
fi
echo generating a Makefile
(
echo "# This Makefile was generated by"
echo '#'" $0 $arg1 $*"
sed -e 1,5d \
-e "s/%CC%/$CC/" \
-e "s/%CFLAGS%/$cflags/" \
-e "s/%RANLIB%/$ranlib/" \
-e "s/%AR%/$ar/" \
-e "s/%MATHLIB%/$mathlib/" Makefile.in
) > Makefile
# make sure distribution parse.c is newer than parse.y
if [ -f parse.c ] # should be true
then
echo touching parse.c ; touch parse.c
fi
[ $arg1 = MF ] && exit 0
if [ -f config.h ]
then
echo moving config.h to config.h.old
mv config.h config.h.old
fi
echo linking config/$config to config.h
ln config/$config config.h
echo 'ready to run: make -f Makefile'
# echo without newline differs from system to system
awk 'BEGIN{
printf "do you want to check or edit the Makefile first? [n] "
}' < /dev/null # some old awks need the /dev/null
read answer
case "$answer" in
[yY]*) echo
echo 'To restart run: make -f Makefile'
echo
exit 0 ;;
esac
echo make -f Makefile
make -f Makefile