#!/bin/sh # Top level building script for SCOL (Linux-x11, Linux-nox, Solaris-nox) if [ "$#" -lt 2 ] ; then echo echo "Usage : $0 [user cflags]" echo exit fi # Defaults RELEASE="no" CFLAGS="-pipe" LFLAGS="" if [ `uname` = SunOS ] ; then CFLAGS="$CFLAGS -DBSD_COMP" LFLAGS="$LFLAGS -lm -lsocket -lnsl" fi # Select target, set compiler flags case "$1" in nox) CFLAGS="$CFLAGS -I ./kernel/" PLATFORM=nox ;; x11) CFLAGS="$CFLAGS `gtk-config --cflags`" LFLAGS="$LFLAGS `gtk-config --libs` -ldl -lz -ljpeg -lpng -lXxf86vm -lGL" PLATFORM=x11 ;; *) echo "Unknown target !" exit ;; esac TARGET="usm-$PLATFORM" case "$2" in release) RELEASE=yes CFLAGS="$CFLAGS -O2" if [ `uname` = Linux ] ; then CFLAGS="$CFLAGS -fomit-frame-pointer -m486" fi ;; debug) CFLAGS="$CFLAGS -g" ;; profile) CFLAGS="$CFLAGS -g -pg" ;; clean) export PLATFORM make clean-$PLATFORM exit ;; *) echo "Unknown action !" exit ;; esac # Add user cflags shift 2 CFLAGS="$CFLAGS $*" echo echo "Platform: $(uname) on a $(uname -m)" echo "Target : $TARGET" echo "CFLAGS : $CFLAGS" echo "LFLAGS : $LFLAGS" echo #exit # Sanity check :)) if [ ! -e kernel/include/vscol.h ] ; then echo "Hey, copy kernel/include/vscol.model into vscol.h and edit it accordingly !" echo "(By the way, the guest OS is presently $(uname). Hope that helps !)" exit fi # GCC preprocessor really doesn't like ending '\r' in multi-line macors if [ -f ./tools/undos ] ; then ./tools/undos kernel/3d/trace.c ./tools/undos kernel/zlib/zlib.h fi # Let's go export PLATFORM CFLAGS LFLAGS rm -f $TARGET make $TARGET # No target ? There has been a build error ... if [ ! -e $TARGET ] ; then exit fi # In release mode, strip symbols if [ $RELEASE = yes ]; then strip $TARGET fi # And display some infos echo ls -l $TARGET echo