#!/usr/bin/cons
#
# Library build script. Requires cons, in case you haven't clued in yet.
# $Id: Construct,v 1.1 2003/03/13 01:15:59 hsteoh Exp hsteoh $
#
# Configurable parameters: (run with 'cons $VARNAME=$VALUE ...')
#
# CC=$binary		C compiler to use (default: gcc)
# CXX=$binary		C++ compiler to use (default: g++)
# ADIR=$dir		Where to install .a files
# INCDIR=$dir		Where to install header files
# SODIR=$dir		Where to install .so files (currently not implemented)
# DEBUG=1		Build with debugging symbols
#
# <obligatory Cons promotion>
# I *love* cons. Make is just an idiotic overly-bandaged contraption way past
# its lifetime. Everyone should use Cons for all new products! It will save
# you countless hours, days, weeks, of endless build frustrations. I swear
# I'll never, ever, use Make again. It's about time it died a long overdue
# death.
# </obligatory Cons promotion>
#

Export qw(
	ADIR INCDIR SODIR
	CONS
);


#
# Externally configurable settings
#

$CC     = $ARG{CC}     || 'gcc';
$CXX    = $ARG{CXX}    || 'g++';
$ADIR   = $ARG{ADIR}   || '#lib';
$INCDIR = $ARG{INCDIR} || '#include';
$SODIR  = $ARG{SODIR}  || '#lib';

#
# Internal setup
#

$DEBUGFLAG = $ARG{DEBUG} ? '-g3' : '';
$CFLAGS = "-pedantic -Wall $DEBUGFLAG";
$CXXFLAGS = "-pedantic -Wall $DEBUGFLAG";
$INCPATHS = "$INCDIR";

$CONS = new cons(
  CC       => $CC,
  CFLAGS   => $CFLAGS,
  CXX      => $CXX,
  CXXFLAGS => $CXXFLAGS,
  CPPPATH  => $INCPATHS
);

Build qw(
  c++/Conscript
  c/Conscript
);

