mars-nwe/examples/mk.li

144 lines
2.6 KiB
Plaintext
Raw Normal View History

2011-11-13 00:38:55 +01:00
#!/bin/sh
2011-11-13 00:38:59 +01:00
# mk.li 15-Dec-99
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()
{
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:59 +01:00
# CFLAGS="-pipe -Wall -Dsignal=sysv_signal"
CFLAGS="$RPM_OPT_FLAGS -pipe -Wall -D_GNU_SOURCE"
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:59 +01:00
if [ -f /usr/lib/libcrypt.so ] ; then
CRYPTLIB="-lcrypt"
else
2011-11-13 00:38:56 +01:00
CRYPTLIB=""
2011-11-13 00:38:59 +01:00
fi
if [ -f /usr/include/sys/quota.h ] ; then
HOSTCFLAGS="$HOSTCFLAGS -DQTAINSYS"
fi
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
;;
2011-11-13 00:38:59 +01:00
########## FreeBSD ############
# created by Boris Popov
freebsd)
V_VPATH=".."
OBJDIR="obj"
CC=gcc
CPP="gcc -E"
if [ "x$CFLAGS" = "x" ]; then
CFLAGS="native"
fi
HOSTCFLAGS="-DFREEBSD -DLINUX"
CRYPTLIB="-lcrypt -lipx"
NSLLIB=""
MAKE=make
TMP="./"
INSTALL="install -c"
;;
2011-11-13 00:38:56 +01:00
*) echo "mk.li: Unknown or not supported OS, probably you must set \$UNX"
;;
esac
2011-11-13 00:38:58 +01:00
## BEGIN try to pass around what the dbm is to the compiler (acli 19970709)
case "$NDBMLIB" in
*gdbm*)
HOSTCFLAGS="$HOSTCFLAGS -DUSE_GDBM"
;;
esac
## END
2011-11-13 00:38:56 +01:00
export CC
2011-11-13 00:38:56 +01:00
export CPP
2011-11-13 00:38:59 +01:00
if [ "X$CFLAGS" != "Xnative" ]; then
export CFLAGS
fi
2011-11-13 00:38:56 +01:00
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 $@