cool colors :-)
[ozulis.git] / configure
blobd64b759156153fbacc70b438342e858fe2a98e8b
1 #! /bin/sh
3 ROOTDIR=$PWD
4 BUILDDIR=build
5 VERBOSE=OFF
6 COLOR=ON
7 DEBUG=1
8 MAKEOPT="--quiet"
9 CFLAGS="-W -Wall -Wstrict-prototypes -pipe"
10 CFLAGS="$CFLAGS -Wfloat-equal -Wundef -Wshadow -Wpointer-arith"
11 CFLAGS="$CFLAGS -Wmissing-declarations -Wnested-externs"
12 CFLAGS="$CFLAGS -Wmissing-prototypes"
13 CXXFLAGS="-W -Wall -pipe -Wundef -Wshadow -Wpointer-arith -Wabi -std=c++0x"
15 function usage()
17 echo -n "usage: $0
18 --verbose verbose Makefiles
19 --no-color no colors
20 --no-debug disable debug
21 --debug enables debug
23 exit
26 until [[ $# -eq 0 ]] ;
28 case "$1" in
29 --verbose)
30 VERBOSE=ON
31 MAKEOPT="$(echo $MAKEOPT | sed s,--quiet,,g)"
33 --no-color)
34 COLOR=OFF
36 --no-debug)
37 DEBUG=0
39 --debug)
40 DEBUG=1
42 --build-dir)
43 [[ $# -eq 1 ]] && { echo --build-dir requiers an argument; exit 2; }
44 BUILDDIR="$2"
45 shift
48 usage
50 esac
51 shift
52 done
54 if [[ $DEBUG -eq 0 ]]; then
55 CFLAGS="$CFLAGS -DNDEBUG"
56 CXXFLAGS="$CXXFLAGS -DNDEBUG"
57 else
58 CFLAGS="$CFLAGS -ggdb"
59 CXXFLAGS="$CXXFLAGS -ggdb"
62 export CFLAGS
63 export CXXFLAGS
64 rm -rf $BUILDDIR
65 mkdir $BUILDDIR &&
66 cd $BUILDDIR &&
67 cmake $ROOTDIR
68 cmake \
69 -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE \
70 -DCMAKE_COLOR_MAKEFILE=$COLOR \
73 cd $ROOTDIR &&
74 cat >config.mk <<EOF
75 BUILDDIR=$BUILDDIR
76 MAKEOPT=$MAKEOPT
77 EOF