mars-nwe/examples/mk.li

109 lines
2.2 KiB
Plaintext
Raw Normal View History

2011-11-13 00:38:55 +01:00
#!/bin/sh
2011-11-13 00:38:57 +01:00
# mk.li 19-Oct-96
2011-11-13 00:38:56 +01:00
# please edit this file !
2011-11-13 00:38:55 +01:00
mk()
{
MYBASE=`pwd`;
ERRFILE=$TMP/`basename $MYBASE`.err;
rm -f $ERRFILE;
2011-11-13 00:38:56 +01:00
if [ $V_VPATH = '..' ] ; then
if [ ! -d $OBJDIR ] ; then mkdir $OBJDIR; fi
cd $OBJDIR;
fi
2011-11-13 00:38:56 +01:00
if $MAKE -f $V_VPATH/makefile.unx $@ 2>&1;then true;else kill -HUP $MK_PPID;fi | tee $ERRFILE
2011-11-13 00:38:56 +01:00
if [ $V_VPATH = '..' ] ; then
cd ..;
fi
2011-11-13 00:38:57 +01:00
if [ -f $ERRFILE ] ; then
chmod 666 $ERRFILE
fi
}
print_error()
{
if [ "$UNX" = 'linux' ]; then
if [ ! -f /usr/include/ndbm.h ] ; then
echo "-------------------------------------------------------------"
echo "probably you have a broken Linux installation because"
echo "'/usr/include/ndbm.h' the include file for the Linux database"
echo "is missing."
echo "-------------------------------------------------------------"
fi
fi
echo ""
echo "The errors are also reported in '$ERRFILE'"
echo "============================================================="
2011-11-13 00:38:55 +01:00
}
2011-11-13 00:38:56 +01:00
TOLOWER='tr "[A-Z]" "[a-z]"'
UNX=`uname -s | $TOLOWER`
2011-11-13 00:38:57 +01:00
MASCHINE=`uname -m`
2011-11-13 00:38:56 +01:00
MK_PPID=$$
export MK_PPID
2011-11-13 00:38:57 +01:00
trap 'print_error; exit 1' 1
2011-11-13 00:38:56 +01:00
case $UNX in
linux)
2011-11-13 00:38:56 +01:00
V_VPATH=".."
OBJDIR="obj"
CC=cc
CPP="cc -E"
2011-11-13 00:38:56 +01:00
# CFLAGS="-pipe -O2 -fomit-frame-pointer"
# problems gcc2.5.8 ^^^^^^^^^^^^^^^^^^^^^
2011-11-13 00:38:56 +01:00
CFLAGS="-pipe -Wall"
2011-11-13 00:38:57 +01:00
case $MASCHINE in
sparc)
HOSTCFLAGS="-DLINUX -DSPARC"
;;
*)
HOSTCFLAGS="-DLINUX"
;;
esac
if [ -f /usr/lib/libgdbm.a ] || [ -f /usr/lib/libgdbm.so ] ; then
NDBMLIB="-lgdbm"
else
2011-11-13 00:38:56 +01:00
NDBMLIB="-ldbm"
2011-11-13 00:38:57 +01:00
fi
2011-11-13 00:38:56 +01:00
CRYPTLIB=""
2011-11-13 00:38:56 +01:00
NSLLIB=""
MAKE=make
TMP=/tmp
INSTALL=install
;;
2011-11-13 00:38:57 +01:00
########### SYSV (UnixWare) ##############
2011-11-13 00:38:56 +01:00
unix_sv)
2011-11-13 00:38:56 +01:00
V_VPATH="."
OBJDIR="."
2011-11-13 00:38:56 +01:00
CC=cc
2011-11-13 00:38:56 +01:00
CPP="cc -E"
CFLAGS=
2011-11-13 00:38:56 +01:00
HOSTCFLAGS=""
NDBMLIB="/usr/ucblib/libucb.a"
2011-11-13 00:38:56 +01:00
CRYPTLIB="-lgen"
2011-11-13 00:38:56 +01:00
NSLLIB="-lnsl"
2011-11-13 00:38:56 +01:00
MAKE=make
2011-11-13 00:38:56 +01:00
TMP=/tmp
INSTALL=/usr/ucb/install
;;
*) echo "mk.li: Unknown or not supported OS, probably you must set \$UNX"
;;
esac
export CC
2011-11-13 00:38:56 +01:00
export CPP
2011-11-13 00:38:56 +01:00
export CFLAGS
export HOSTCFLAGS
export NDBMLIB
2011-11-13 00:38:56 +01:00
export CRYPTLIB
2011-11-13 00:38:56 +01:00
export NSLLIB
export TMP
export INSTALL
2011-11-13 00:38:56 +01:00
export V_VPATH
export OBJDIR
2011-11-13 00:38:56 +01:00
2011-11-13 00:38:55 +01:00
mk $@