mars-nwe/examples/mk.li
2011-11-13 00:38:57 +01:00

90 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
# mk.li 10-Jul-96 ###
# please edit this file !
mk()
{
MYBASE=`pwd`;
ERRFILE=$TMP/`basename $MYBASE`.err;
rm -f $ERRFILE;
if [ $V_VPATH = '..' ] ; then
if [ ! -d $OBJDIR ] ; then mkdir $OBJDIR; fi
cd $OBJDIR;
fi
if $MAKE -f $V_VPATH/makefile.unx $@ 2>&1;then true;else kill -HUP $MK_PPID;fi | tee $ERRFILE
if [ $V_VPATH = '..' ] ; then
cd ..;
fi
chmod 666 $ERRFILE
}
TOLOWER='tr "[A-Z]" "[a-z]"'
UNX=`uname -s | $TOLOWER`
MASCHINE=`uname -m`
MK_PPID=$$
export MK_PPID
trap 'echo "Error: Try again :)" && exit 1' 1
case $UNX in
linux)
V_VPATH=".."
OBJDIR="obj"
CC=cc
CPP="cc -E"
# CFLAGS="-pipe -O2 -fomit-frame-pointer"
# problems gcc2.5.8 ^^^^^^^^^^^^^^^^^^^^^
CFLAGS="-pipe -Wall"
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
NDBMLIB="-ldbm"
fi
CRYPTLIB=""
NSLLIB=""
MAKE=make
TMP=/tmp
INSTALL=install
;;
########### USL UNIX ##############
unix_sv)
V_VPATH="."
OBJDIR="."
CC=cc
CPP="cc -E"
CFLAGS=
HOSTCFLAGS=""
NDBMLIB="/usr/ucblib/libucb.a"
CRYPTLIB="-lgen"
NSLLIB="-lnsl"
MAKE=make
TMP=/tmp
INSTALL=/usr/ucb/install
;;
*) echo "mk.li: Unknown or not supported OS, probably you must set \$UNX"
;;
esac
export CC
export CPP
export CFLAGS
export HOSTCFLAGS
export NDBMLIB
export CRYPTLIB
export NSLLIB
export TMP
export INSTALL
export V_VPATH
export OBJDIR
mk $@