Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / tools / scripts / linux / buildmode
blob7ab021b1e78ffba8be8b523ac1d4ebc266d59729
1 #!/bin/sh
4 ###########################################################################
6 # Files associated to each mode
7 DEBUG_FILE=$RYZOM_PATH/.mode_debug
8 #RELEASE_FILE=$RYZOM_PATH/.mode_release
9 STATIC_FILE=$RYZOM_PATH/.mode_static
10 DYNAMIC_FILE=$RYZOM_PATH/.mode_dynamic
11 SILENT_FILE=$RYZOM_PATH/.mode_silent
14 ###########################################################################
15 # Print status
16 printMode()
18 echo ""
19 echo "Compilation modes :"
20 echo ""
21 echo " Debug mode : $DEBUG_MODE"
22 # echo " Release mode : $RELEASE_MODE"
23 echo ""
24 echo " Static linking : $STATIC_MODE"
25 echo " Dynamic linking : $DYNAMIC_MODE"
26 echo ""
27 echo " Silent compilation : $SILENT_MODE"
28 echo ""
32 ###########################################################################
33 # Get the specific mode value and set the corresponding variable
34 getMode()
36 local VAR=$1
37 local FILE=$2
39 if test -f $FILE
40 then
41 eval $VAR=ON
42 else
43 eval $VAR=OFF
48 ###########################################################################
49 # Set a specific mode to ON if it's OFF, and to OFF if its ON
50 setMode()
52 local VAR=$1
53 local FILE=$2
55 # Get the current mode value
56 OLD_VALUE=$(eval echo \$$VAR)
58 if test X"$OLD_VALUE" = "XOFF"
59 then
60 # Set the MODE to ON in case it's OFF
61 NEW_VALUE=ON
62 touch -f $FILE || (echo "Error : cannot create mode files" && exit 1)
63 else
64 # Set the MODE to OFF in case it's ON
65 NEW_VALUE=OFF
66 rm -f $FILE || (echo "Error : cannot delete mode files" && exit 1)
69 eval $VAR=$NEW_VALUE
73 ###########################################################################
74 # Print command usage
75 printUsage()
77 echo ""
78 echo "Usage: `basename $0` [debug] [static] [dynamic] [silent]"
79 echo " debug -> turn ON/OFF debug compilation"
80 echo " static -> turn ON/OFF static linking"
81 echo " dynamic -> turn ON/OFF dynamic linking"
82 echo " slient -> turn ON/OFF silent compilation"
83 echo ""
87 ###########################################################################
89 # Get the mode settings
90 getMode DEBUG_MODE $DEBUG_FILE
91 #getMode RELEASE_MODE $RELEASE_FILE
92 getMode STATIC_MODE $STATIC_FILE
93 getMode DYNAMIC_MODE $DYNAMIC_FILE
94 getMode SILENT_MODE $SILENT_FILE
96 # Print the mode values and exit if there is no argument
97 if test $# -eq 0
98 then
99 printMode
100 exit 0
103 while test $# -gt 0
105 case $1 in
107 debug)
108 setMode DEBUG_MODE $DEBUG_FILE
111 # release)
112 # setMode RELEASE_MODE $RELEASE_FILE
113 # ;;
115 static)
116 setMode STATIC_MODE $STATIC_FILE
119 dynamic)
120 setMode DYNAMIC_MODE $DYNAMIC_FILE
123 silent)
124 setMode SILENT_MODE $SILENT_FILE
127 *) echo "Error : $1 : Unknown argument"
128 printUsage
129 exit 1
131 esac
133 shift
135 done
137 printMode
139 exit 0