-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathconfigure
executable file
·79 lines (67 loc) · 1.5 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#! /bin/sh
#
# Print help
#
print_help()
{
cat <<EOF
SYNOPSIS:
configure [-DXUh]
OPTIONS
-D, --with-debug
Compile with flags debug:
-g -ggdb
-X, --with-extra-debug
Compile with extra debug,
Active the macro XDEBUG.
-W, --without-warning
Compile without warning errors,
-U, --with-duma
Compile with library duma
-P, --with-profile
Compile with library duma
-M, --for-xcode
Create a project for xcode
-h, --help
Print this help.
EOF
}
#
# CFLAGS defaults
#
CFLAGS='-Wall -W -Werror -pedantic -std=c99 -D_GNU_SOURCE'
CMAKEFLAGS='-GUnix Makefiles'
#
# getopt
#
DEBUG=0
TEMP=`getopt -o DWXUMPh --long without-warning,with-debug,with-extra-debug,for-xcode,with-duma,with-profile,help -- "$@"`
eval set -- "$TEMP"
while true ; do
case "$1" in
-D|--with-debug) DEBUG=1 ; shift ;;
-X|--with-extra-debug) CFLAGS="${CFLAGS} -DXDEBUG" ; shift ;;
-M|--for-xcode) CMAKEFLAGS='-GXcode'; shift ;;
-W|--without-warning) CFLAGS="-Wall -W -pedantic -std=c99 -g3 -D_GNU_SOURCE" ; shift ;;
-U|--with-duma) CFLAGS="${CFLAGS} -L/u/all/acu/public/lib -lduma" ;
shift ;;
-P|--with-profile) CFLAGS="${CFLAGS} -pg"; shift ;;
-h|--help) print_help ; exit 0 ; shift ;;
--) shift ; break ;;
*) print_help ; exit 1 ;;
esac
done
if [ $DEBUG -eq 1 ] ; then
CFLAGS="${CFLAGS} -g -ggdb"
else
CFLAGS="${CFLAGS} -DNDEBUG -O2"
fi
# --------------------------------------
#
# Creating the Makefile by CMake.
#
export CFLAGS="${CFLAGS}"
echo $CFLAGS
cd build
cmake "${CMAKEFLAGS}" .
cd ..