author | groke6 |
Tue, 08 Jan 2008 10:47:10 +0100 | |
changeset 349 | 1e6dd4ef46b9 |
parent 343 | 118c1cabd0b0 |
child 351 | fb106ad03770 |
permissions | -rwxr-xr-x |
275
7d5130f2f8ab
fix problem sh. Replace with bash in configure script. For msys, there is a bash version to download.
greg
parents:
267
diff
changeset
|
1 |
#!/bin/bash |
0 | 2 |
|
3 |
# |
|
4 |
# Copyright (C) 2004 Edouard TISSERRANT, Laurent BESSARD |
|
5 |
# Based on Gabriel Gerhardsson's cacheprobe configure script. |
|
6 |
# |
|
7 |
# This file is part of CanFestival, a library implementing CanOpen Stack. |
|
8 |
# |
|
9 |
# This library is free software; you can redistribute it and/or |
|
10 |
# modify it under the terms of the GNU Lesser General Public |
|
11 |
# License as published by the Free Software Foundation; either |
|
12 |
# version 2.1 of the License, or (at your option) any later version. |
|
13 |
# |
|
14 |
# This library is distributed in the hope that it will be useful, |
|
15 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17 |
# Lesser General Public License for more details. |
|
18 |
# |
|
19 |
# You should have received a copy of the GNU Lesser General Public |
|
20 |
# License along with this library; if not, write to the Free Software |
|
21 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
22 |
# |
|
23 |
||
24 |
########################################################################### |
|
25 |
# DEFAULT CANFESTIVAL DEFINES # |
|
26 |
########################################################################### |
|
27 |
||
28 |
# Number of can bus to use |
|
267
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
29 |
MAX_CAN_BUS_ID=1 |
0 | 30 |
|
31 |
# max bytes to transmit by SDO Put 4 if you only support expedited transfert. |
|
32 |
# For a normal transfert, (usually for a string), put the maximum string size to transfer. |
|
267
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
33 |
SDO_MAX_LENGTH_TRANSFERT=32 |
0 | 34 |
|
35 |
# Number of SDO from differents nodes that the node can manage concurrently. |
|
36 |
# for a slave node, usually put 1. |
|
37 |
SDO_MAX_SIMULTANEOUS_TRANSFERTS=4 |
|
38 |
||
39 |
# Used for NMTable[bus][nodeId] |
|
40 |
# You can put less of 128 if on the netwo |
|
41 |
# are connected only smaller nodeId node. |
|
267
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
42 |
NMT_MAX_NODE_ID=128 |
0 | 43 |
|
44 |
#Timeout in milliseconds for SDO. |
|
45 |
# Comment the #define if not used (infinite wait for SDO response message) |
|
46 |
SDO_TIMEOUT_MS=3000 |
|
47 |
||
48 |
MAX_NB_TIMER=32 |
|
49 |
||
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
50 |
# Generic timers declaration defaults |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
51 |
US_TO_TIMEVAL_FACTOR= |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
52 |
TIMEVAL= |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
53 |
TIMEVAL_MAX= |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
54 |
|
0 | 55 |
# Default to little-endian |
56 |
CANOPEN_BIG_ENDIAN= |
|
57 |
||
284 | 58 |
# Max number of active errors managed in error_data structure. |
59 |
EMCY_MAX_ERRORS=8 |
|
60 |
||
0 | 61 |
########################################################################### |
62 |
# DEFAULT BUILD OPTIONS # |
|
63 |
########################################################################### |
|
64 |
||
65 |
# Leave empty for automatic detection |
|
66 |
CC= |
|
329 | 67 |
CXX=g++ |
68 |
LD=ld |
|
0 | 69 |
|
70 |
#default target |
|
71 |
SUB_TARGET= |
|
72 |
||
73 |
# First compiler option - we will check if it exists |
|
74 |
CC1=gcc |
|
75 |
# Second compiler option - we will check if it exists |
|
76 |
CC2=cc |
|
77 |
||
78 |
# Install prefix |
|
79 |
SUB_PREFIX= |
|
80 |
||
81 |
# Used for C compiler test/detection |
|
82 |
CFLAGS= |
|
83 |
test=conftest |
|
84 |
rm -f $test $test.c |
|
85 |
||
278 | 86 |
if [ "$XENO_CONFIG" = "" ]; then |
190 | 87 |
XENO_CONFIG=/usr/xenomai/bin/xeno-config |
88 |
fi |
|
0 | 89 |
|
90 |
########################################################################### |
|
91 |
# ARGUMENTS PARSING # |
|
92 |
########################################################################### |
|
93 |
while [ $# -ge 1 ]; do |
|
94 |
optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` |
|
95 |
||
96 |
case $1 in |
|
97 |
--cc=*) CC=$optarg;; |
|
341 | 98 |
--cxx=*) CXX=$optarg;; |
99 |
--ld=*) LD=$optarg;; |
|
0 | 100 |
--arch=*) SUB_ARCH_NAME=$optarg;; |
101 |
--os=*) SUB_OS_NAME=$optarg;; |
|
102 |
--prefix=*) SUB_PREFIX=$optarg;; |
|
103 |
--target=*) SUB_TARGET=$optarg;; |
|
104 |
--can=*) SUB_CAN_DRIVER=$optarg;; |
|
105 |
--timers=*) SUB_TIMERS_DRIVER=$optarg;; |
|
106 |
--disable-Ox) DISABLE_OPT=1; |
|
107 |
echo "On user request: Won't optimize with \"-Ox\"";; |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
108 |
--disable-dll) DISABLE_DLL=1; |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
109 |
echo "On user request: Won't create and link to dll";; |
343 | 110 |
--enable-lss) ENABLE_LSS=1; |
111 |
echo "On user request: LSS services enabled";; |
|
195
1510dd61ead0
Added debug level opt in configure and re-enabled debug macros.
etisserant
parents:
190
diff
changeset
|
112 |
--debug=*) DEBUG=$optarg;; |
0 | 113 |
--MAX_CAN_BUS_ID=*) MAX_CAN_BUS_ID=$1;; |
114 |
--SDO_MAX_LENGTH_TRANSFERT=*) SDO_MAX_LENGTH_TRANSFERT=$1;; |
|
115 |
--SDO_MAX_SIMULTANEOUS_TRANSFERTS=*) SDO_MAX_SIMULTANEOUS_TRANSFERTS=$1;; |
|
116 |
--NMT_MAX_NODE_ID=*) NMT_MAX_NODE_ID=$1;; |
|
117 |
--SDO_TIMEOUT_MS=*) SDO_TIMEOUT_MS=$1;; |
|
118 |
--CANOPEN_BIG_ENDIAN=*) CANOPEN_BIG_ENDIAN=$1;; |
|
119 |
--MAX_NB_TIMER=*) MAX_NB_TIMER=$1;; |
|
284 | 120 |
--EMCY_MAX_ERRORS=*) EMCY_MAX_ERRORS=$1;; |
341 | 121 |
--help) |
122 |
echo "Usage: ./configure [options]" |
|
123 |
echo "Options:" |
|
124 |
echo " --cc=foo Use C compiler 'foo' instead of defaults ${CC1} or ${CC2}." |
|
125 |
echo " --cxx=foo Use C++ compiler 'foo' instead of defaults g++." |
|
126 |
echo " --ld=foo Use linker 'foo' instead of ld." |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
127 |
echo " --arch=foo Use architecture 'foo' instead of trying to autodetect." |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
128 |
echo " --os=foo Use operative system 'foo' instead of trying to autodetect." |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
129 |
echo " --prefix=foo Use prefix 'foo' instead of default ${SUB_PREFIX}." |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
130 |
echo " --target=foo Use 'foo' as build target." |
341 | 131 |
echo " \"unix\" for unix-like systems (Linux, Cygwin)" |
132 |
echo " \"win32\" for win32 systems (native, mingw or VC++)" |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
133 |
echo " \"hcs12\" for HCS12 micro-controller" |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
134 |
echo " --can=foo Use 'foo' as CAN driver" |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
135 |
echo " \"peak_linux\" use Linux build host installed Peak driver and library" |
341 | 136 |
echo " see http://www.peak-system.com/linux/" |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
137 |
echo " \"peak_win32\" use win32 PcanLight Peak driver and library with Cygwin" |
341 | 138 |
echo " see http://www.peak-system.com/themen/download_gb.html" |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
139 |
echo " \"virtual\" use unix pipe based virtual can driver" |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
140 |
echo " \"socket\" use socket-can " |
341 | 141 |
echo " see http://developer.berlios.de/projects/socketcan/" |
142 |
echo " \"lincan\" lincan driver" |
|
143 |
echo " see http://www.ocera.org/download/components/WP7/lincan-0.3.3.html" |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
144 |
echo " --timers=foo Use 'foo' as TIMERS driver (can be either 'unix' or 'xeno')" |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
145 |
echo " --disable-dll Disable run-time dynamic linking of can, led and nvram drivers" |
343 | 146 |
echo " --enable-lss Enable the LSS services" |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
147 |
echo " --disable-Ox Disable gcc \"-Ox\" optimizations." |
329 | 148 |
echo " --debug=foo,foo,.. Enable debug messages, ERR -> only errors, WAR)." |
341 | 149 |
echo " \"PDO\" send errors and warnings through PDO messages" |
150 |
echo " \"ERR\" print errors only, to stdout" |
|
151 |
echo " \"WAR\" print errors and warnings, to stdout" |
|
152 |
echo " \"MSG\" print messages content, to stdout" |
|
0 | 153 |
echo |
154 |
echo "Stack compilation constants" |
|
155 |
echo " --MAX_CAN_BUS_ID [=1] Number of can bus to use" |
|
156 |
echo " --SDO_MAX_LENGTH_TRANSFERT [=32] max bytes to transmit by SDO" |
|
157 |
echo " --SDO_MAX_SIMULTANEOUS_TRANSFERTS [=4] Number of SDO that the node can manage concurrently" |
|
158 |
echo " --NMT_MAX_NODE_ID [=128] can be reduced to gain memory on small network" |
|
159 |
echo " --SDO_TIMEOUT_MS [=3000] Timeout in milliseconds for SDO (None to disable the feature)" |
|
284 | 160 |
echo " --EMCY_MAX_ERRORS [=8] Max number of active errors managed in error_data structure" |
0 | 161 |
exit 0;; |
162 |
*) echo "Unknown argument ${1}"; exit -1;; |
|
163 |
esac |
|
164 |
||
165 |
shift |
|
166 |
done |
|
167 |
||
168 |
########################################################################### |
|
169 |
# GUESS OS/ARCH # |
|
170 |
########################################################################### |
|
171 |
||
172 |
if [ "$SUB_OS_NAME" = "" ]; then |
|
173 |
SUB_OS_NAME="`(uname -s | sed \"s/\//-/\" | sed \"s/_/-/\" \ |
|
174 |
| sed \"s/-.*//g\") 2>&1`" |
|
175 |
fi |
|
176 |
||
177 |
if [ "$SUB_ARCH_NAME" = "" ]; then |
|
178 |
if [ "$CC" = "" ]; then |
|
179 |
A_NAME="`(uname -m) 2>&1`" |
|
180 |
else |
|
181 |
A_NAME="`$CC -dumpmachine | sed 's:-.*::'`" |
|
182 |
fi |
|
183 |
fi |
|
184 |
||
185 |
# x86 |
|
341 | 186 |
if [ "$A_NAME" = "i386" -o "$A_NAME" = "i486" -o "$A_NAME" = "i586" -o "$A_NAME" = "i686" -o "$A_NAME" = "x86" ]; then |
0 | 187 |
SUB_ARCH_NAME=x86 |
188 |
fi |
|
189 |
||
190 |
# x86_64 |
|
191 |
if [ "$A_NAME" = "x86_64" ]; then |
|
192 |
SUB_ARCH_NAME=x86_64 |
|
193 |
fi |
|
194 |
||
195 |
# ppc |
|
196 |
if [ "$A_NAME" = "powerpc" ]; then |
|
197 |
SUB_ARCH_NAME=ppc |
|
198 |
fi |
|
199 |
||
200 |
# ppc64 |
|
201 |
if [ "$A_NAME" = "powerpc64" ]; then |
|
202 |
SUB_ARCH_NAME=ppc64 |
|
203 |
fi |
|
204 |
||
205 |
# arm |
|
206 |
if [ "$A_NAME" = "arm" ]; then |
|
207 |
SUB_ARCH_NAME=arm |
|
208 |
fi |
|
209 |
||
210 |
if [ "$SUB_ARCH_NAME" = "" ]; then |
|
211 |
echo "Error: could not detect what architecture this system is running!" |
|
212 |
echo "Please supply manually instead with \"--arch=foo\"" |
|
213 |
exit -1 |
|
214 |
fi |
|
215 |
||
341 | 216 |
echo "Using OS: ${SUB_OS_NAME}" |
217 |
echo "Using architecture: ${SUB_ARCH_NAME}" |
|
0 | 218 |
|
219 |
if [ "$SUB_ARCH_NAME" = "x86_64" -a "$CC" = "gcc" ]; then |
|
220 |
# Only if we are on x86_64 and using gcc |
|
221 |
# For shared library generation, it needs this |
|
222 |
SUB_PROG_CFLAGS=-fPIC |
|
223 |
fi |
|
224 |
||
200 | 225 |
if [ "$SUB_ARCH_NAME" = "ppc" -o "$SUB_ARCH_NAME" = "powerpc" ]; then |
226 |
# PowerPC uses big endian format |
|
227 |
CANOPEN_BIG_ENDIAN=1 |
|
228 |
fi |
|
229 |
||
0 | 230 |
########################################################################### |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
231 |
# DEFAULT TARGET/DRIVERS GUESSING # |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
232 |
########################################################################### |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
233 |
# If target not specified, try to gess one |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
234 |
if [ "$SUB_TARGET" = "" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
235 |
if [ "$SUB_OS_NAME" = "CYGWIN" ]; then |
38 | 236 |
echo "Choosing unix (cygwin) target" |
237 |
SUB_TARGET=unix |
|
267
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
238 |
fi |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
239 |
if [ "$SUB_OS_NAME" = "Linux" ]; then |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
240 |
echo "Choosing unix target" |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
241 |
SUB_TARGET=unix |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
242 |
fi |
267
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
243 |
if [ "$SUB_OS_NAME" = "MINGW32" ]; then |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
244 |
echo "Choosing windows target" |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
245 |
SUB_TARGET=win32 |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
246 |
fi |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
247 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
248 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
249 |
# Try to gess can |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
250 |
if [ "$SUB_CAN_DRIVER" = "" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
251 |
if [ "$SUB_TARGET" = "unix" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
252 |
if [ -e /usr/lib/libpcan.so ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
253 |
echo "Choosing installed Peak driver as CAN driver." |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
254 |
SUB_CAN_DRIVER=peak_linux |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
255 |
elif [ "$SUB_OS_NAME" = "CYGWIN" -a "PCAN_LIB" != "" ]; then |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
256 |
echo "Choosing installed Peak driver as CAN driver." |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
257 |
SUB_CAN_DRIVER=peak_win32 |
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
258 |
else |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
259 |
echo "Choosing virtual CAN driver." |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
260 |
SUB_CAN_DRIVER=virtual |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
261 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
262 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
263 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
264 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
265 |
# If target is unix, default timers also |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
266 |
if [ "$SUB_TARGET" = "unix" -a "$SUB_TIMERS_DRIVER" = "" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
267 |
echo "Choosing unix timers driver." |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
268 |
SUB_TIMERS_DRIVER=unix |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
269 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
270 |
|
267
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
271 |
# If target is windows, default timers also |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
272 |
if [ "$SUB_TARGET" = "win32" -a "$SUB_TIMERS_DRIVER" = "" ]; then |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
273 |
echo "Choosing windows timers driver." |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
274 |
SUB_TIMERS_DRIVER=win32 |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
275 |
fi |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
276 |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
277 |
# Warn for unstalled peak driver if choosen |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
278 |
if [ "$SUB_CAN_DRIVER" = "peak" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
279 |
if [ ! -e /usr/lib/libpcan.so ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
280 |
echo "Peak driver hasn't been installed !" |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
281 |
exit -1 |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
282 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
283 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
284 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
285 |
########################################################################### |
0 | 286 |
# TARGET/DRIVER SPECIFIC CFLAGS and OPTIONS # |
287 |
########################################################################### |
|
288 |
if [ "$SUB_TARGET" = "hcs12" ]; then |
|
289 |
# Only if we want to compile for a µC HCS12 |
|
81 | 290 |
# it is a big endian architecture. |
291 |
CANOPEN_BIG_ENDIAN=1 |
|
0 | 292 |
# search for gcc hcs12 compiler m6811-elf-gcc or m68hc12-gcc ? |
293 |
if [ "$CC" = "" ]; then |
|
294 |
which m6811-elf-gcc >/dev/null 2>&1 |
|
295 |
if (( $? )); then |
|
296 |
which m68hc12-gcc >/dev/null 2>&1 |
|
297 |
if (( $? )); then |
|
298 |
echo "Please use --cc flag to specify compiler" |
|
299 |
exit 0 |
|
300 |
else |
|
301 |
CC=m68hc12-gcc |
|
302 |
fi |
|
303 |
else |
|
304 |
CC=m6811-elf-gcc |
|
305 |
SUB_PROG_CFLAGS=-m68hc12 |
|
306 |
fi |
|
307 |
fi |
|
308 |
fi |
|
309 |
||
329 | 310 |
if [ "$SUB_TARGET" = "win32" ]; then |
311 |
LD=g++ |
|
312 |
SUB_PROG_CFLAGS="-mno-cygwin" |
|
313 |
fi |
|
314 |
||
342 | 315 |
if [ "$SUB_TARGET" = "unix" ]; then |
316 |
LD=gcc |
|
317 |
fi |
|
318 |
||
0 | 319 |
#### CAN_DRIVER #### |
320 |
||
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
321 |
if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
322 |
SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -lpcan |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
323 |
fi |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
324 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
325 |
PW32DIR=drivers/can_peak_win32 |
38 | 326 |
if [ "$SUB_CAN_DRIVER" = "peak_win32" ]; then |
41
e70439f50539
First working cygwin/pcan_light commit. can_peak_win32.c is obfuscated.
etisserant
parents:
40
diff
changeset
|
327 |
if [ "$PCAN_HEADER" = "" -o "PCAN_LIB" = "" ]; then |
38 | 328 |
echo "!!! ERROR !!! Please set PCAN_LIB PCAN_HEADER [PCAN_INCLUDE] to appropriate paths ! " |
329 |
fi |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
330 |
SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ -liberty\ \'$PCAN_LIB\' |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
331 |
echo "Converting PcanLib header files for gcc -> $PW32DIR/cancfg.h" |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
332 |
cat $PW32DIR/cancfg.h.head $PCAN_INCLUDE/$PCAN_HEADER > $PW32DIR/cancfg.h |
331 | 333 |
echo >> $PW32DIR/cancfg.h |
41
e70439f50539
First working cygwin/pcan_light commit. can_peak_win32.c is obfuscated.
etisserant
parents:
40
diff
changeset
|
334 |
# second port handling |
e70439f50539
First working cygwin/pcan_light commit. can_peak_win32.c is obfuscated.
etisserant
parents:
40
diff
changeset
|
335 |
if [ "$PCAN2_HEADER" != "" ]; then |
e70439f50539
First working cygwin/pcan_light commit. can_peak_win32.c is obfuscated.
etisserant
parents:
40
diff
changeset
|
336 |
echo "Stripping down second Pcan Light header " |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
337 |
echo >> $PW32DIR/cancfg.h |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
338 |
echo "// Stripped PcanLight header to prevent typedef conflicts ">> $PW32DIR/cancfg.h |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
339 |
echo >> $PW32DIR/cancfg.h |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
340 |
grep __stdcall $PCAN_INCLUDE/$PCAN2_HEADER >> $PW32DIR/cancfg.h |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
341 |
echo '#define PCAN2_HEADER_' >> $PW32DIR/cancfg.h |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
342 |
SUB_CAN_DLL_CFLAGS=$SUB_CAN_DLL_CFLAGS\ \'$PCAN2_LIB\' |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
343 |
fi |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
344 |
if grep -q CANHwType $PW32DIR/cancfg.h ; then |
42
17f0ea205942
cygwin/pcan_light commit. Changes in configure for dual port handling.
etisserant
parents:
41
diff
changeset
|
345 |
echo "Peak Init HwType, IO_Port and IRQ will be passed in environment :" |
17f0ea205942
cygwin/pcan_light commit. Changes in configure for dual port handling.
etisserant
parents:
41
diff
changeset
|
346 |
echo " PCANHwType PCANIO_Port PCANInterupt" |
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
347 |
echo '#define extra_PCAN_init_params' >> $PW32DIR/cancfg.h |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
348 |
fi |
331 | 349 |
if ! grep -q CAN_Init $PW32DIR/cancfg.h ; then |
350 |
echo "Pcan Light header/lib is for second port of device only" |
|
351 |
echo "CAN_* calls redefined to CAN2_* " |
|
352 |
echo '#define CAN_Init CAN2_Init' >> $PW32DIR/cancfg.h |
|
353 |
echo '#define CAN_Read CAN2_Read' >> $PW32DIR/cancfg.h |
|
354 |
echo '#define CAN_Write CAN2_Write' >> $PW32DIR/cancfg.h |
|
355 |
echo '#define CAN_Close CAN2_Close' >> $PW32DIR/cancfg.h |
|
356 |
fi |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
357 |
cat $PW32DIR/cancfg.h.tail >> $PW32DIR/cancfg.h |
38 | 358 |
fi |
359 |
||
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
360 |
if [ "$SUB_CAN_DRIVER" = "none" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
361 |
SUB_CAN_DRIVER= |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
362 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
363 |
|
0 | 364 |
#### TIMERS_DRIVER #### |
365 |
||
366 |
if [ "$SUB_TIMERS_DRIVER" = "unix" ]; then |
|
38 | 367 |
if [ "$SUB_OS_NAME" != "CYGWIN" ]; then |
368 |
SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lpthread\ -lrt |
|
369 |
fi |
|
0 | 370 |
fi |
371 |
||
372 |
if [ "$SUB_TIMERS_DRIVER" = "xeno" ]; then |
|
341 | 373 |
SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -lnative\ -lrtdm\ -L`$XENO_CONFIG --library-dir` |
0 | 374 |
SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ `$XENO_CONFIG --xeno-cflags` |
47
8a1047ab51f4
SOCKET-CAN support added. Many thanks to Jan Kiszka !
etisserant
parents:
42
diff
changeset
|
375 |
RTCAN_SOCKET=1 |
0 | 376 |
fi |
377 |
||
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
378 |
if [ "$SUB_TIMERS_DRIVER" = "none" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
379 |
SUB_TIMERS_DRIVER= |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
380 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
381 |
|
0 | 382 |
########################################################################### |
383 |
# GUESS COMPILER # |
|
384 |
########################################################################### |
|
385 |
# If CC is empty, the user wanted automatic detection |
|
386 |
if [ "$CC" = "" ]; then |
|
387 |
# Check for second compiler, CC2 |
|
388 |
cat > $test.c <<EOF |
|
389 |
int main() { return 0; } |
|
390 |
EOF |
|
391 |
if test "`($CC2 -c $CFLAGS $test.c) 2>&1`" = ""; then |
|
392 |
DETECTCC=$CC2 |
|
393 |
echo "Checking for ${CC2}... Yes." |
|
394 |
else |
|
395 |
echo "Checking for ${CC2}... No." |
|
396 |
fi |
|
397 |
rm -f $test.c $test.o |
|
398 |
||
399 |
# Check for first compiler, CC1 |
|
400 |
cat > $test.c <<EOF |
|
401 |
int main() { return 0; } |
|
402 |
EOF |
|
403 |
if test "`($CC1 -c $CFLAGS $test.c) 2>&1`" = ""; then |
|
404 |
DETECTCC=$CC1 |
|
405 |
echo "Checking for ${CC1}... Yes." |
|
406 |
else |
|
407 |
echo "Checking for ${CC1}... No." |
|
408 |
fi |
|
409 |
rm -f $test.c $test.o |
|
410 |
CC=$DETECTCC |
|
411 |
fi |
|
412 |
# Check if we decided on a compiler after all |
|
413 |
if [ "$CC" = "" ]; then |
|
414 |
echo "Error: Could not find a C compiler" |
|
415 |
echo "Please supply the wanted compiler" |
|
416 |
exit -1 |
|
417 |
fi |
|
418 |
||
419 |
echo "Using ${CC}" |
|
420 |
||
421 |
########################################################################### |
|
422 |
# GUESS PREFIX's # |
|
423 |
########################################################################### |
|
424 |
||
425 |
SUB_BINUTILS_PREFIX=`echo "$CC" | sed 's/gcc$//'` |
|
426 |
||
427 |
# Guess prefix as regard cross compiling target machine |
|
428 |
if [ "$SUB_PREFIX" = "" ]; then |
|
429 |
$CC -dumpspecs |grep -A 1 'cross_compile'|grep -q 1 |
|
430 |
if (( $? )); then |
|
431 |
SUB_PREFIX=/usr/local |
|
432 |
echo "Not cross-compiling. Will install in $SUB_PREFIX"; |
|
433 |
else |
|
434 |
SUB_PREFIX=/usr/`$CC -dumpmachine` |
|
435 |
echo "This is a cross-compiler. Will install in $SUB_PREFIX"; |
|
436 |
fi |
|
437 |
fi |
|
438 |
||
439 |
echo "Using prefix: ${SUB_PREFIX}" |
|
440 |
||
441 |
########################################################################### |
|
442 |
# CANFESTIVAL DEFINES --> config.h # |
|
443 |
########################################################################### |
|
444 |
# Some CONSTANTS preparation |
|
445 |
||
446 |
# Create include/config.h with the relevant contents |
|
447 |
rm -f include/config.h |
|
77 | 448 |
echo "/* !!!!!!!!!! FILE GENERATED by configure. DO NOT EDIT !!!!!!!!!!*/" >> include/config.h |
449 |
echo "" >> include/config.h |
|
450 |
echo "/*"\ >> include/config.h |
|
0 | 451 |
echo "This file is part of CanFestival, a library implementing CanOpen Stack." >> include/config.h |
452 |
echo "" >> include/config.h |
|
453 |
echo "Copyright (C): Edouard TISSERANT and Francis DUPIN" >> include/config.h |
|
454 |
echo "See COPYING file for copyrights details." >> include/config.h |
|
455 |
echo "" >> include/config.h |
|
456 |
echo "This library is free software; you can redistribute it and/or" >> include/config.h |
|
457 |
echo "modify it under the terms of the GNU Lesser General Public" >> include/config.h |
|
458 |
echo "License as published by the Free Software Foundation; either" >> include/config.h |
|
459 |
echo "version 2.1 of the License, or (at your option) any later version." >> include/config.h |
|
460 |
echo "" >> include/config.h |
|
461 |
echo "This library is distributed in the hope that it will be useful," >> include/config.h |
|
462 |
echo "but WITHOUT ANY WARRANTY; without even the implied warranty of" >> include/config.h |
|
463 |
echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU" >> include/config.h |
|
464 |
echo "Lesser General Public License for more details." >> include/config.h |
|
465 |
echo "" >> include/config.h |
|
466 |
echo "You should have received a copy of the GNU Lesser General Public" >> include/config.h |
|
467 |
echo "License along with this library; if not, write to the Free Software" >> include/config.h |
|
468 |
echo "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" >> include/config.h |
|
469 |
echo "*/" >> include/config.h |
|
470 |
echo "" >> include/config.h |
|
471 |
echo "#ifndef _CONFIG_H_" >> include/config.h |
|
472 |
echo "#define _CONFIG_H_" >> include/config.h |
|
473 |
echo "" >> include/config.h |
|
474 |
for i in \ |
|
475 |
MAX_CAN_BUS_ID\ |
|
476 |
SDO_MAX_LENGTH_TRANSFERT\ |
|
477 |
SDO_MAX_SIMULTANEOUS_TRANSFERTS\ |
|
478 |
NMT_MAX_NODE_ID\ |
|
479 |
SDO_TIMEOUT_MS\ |
|
480 |
MAX_NB_TIMER\ |
|
481 |
CANOPEN_BIG_ENDIAN\ |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
482 |
US_TO_TIMEVAL_FACTOR\ |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
483 |
TIMEVAL\ |
47
8a1047ab51f4
SOCKET-CAN support added. Many thanks to Jan Kiszka !
etisserant
parents:
42
diff
changeset
|
484 |
TIMEVAL_MAX\ |
284 | 485 |
RTCAN_SOCKET\ |
486 |
EMCY_MAX_ERRORS; do |
|
0 | 487 |
if [ "${!i}" = "" ]; then |
77 | 488 |
echo "/* $i is not defined */" >> include/config.h |
0 | 489 |
else |
490 |
echo "#define $i ${!i}" >> include/config.h |
|
491 |
fi |
|
492 |
done |
|
493 |
echo "" >> include/config.h |
|
91
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
494 |
|
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
495 |
for i in \ |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
496 |
SDO_MAX_SIMULTANEOUS_TRANSFERTS\ |
284 | 497 |
NMT_MAX_NODE_ID\ |
498 |
EMCY_MAX_ERRORS; do |
|
91
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
499 |
echo "#define REPEAT_"$i"_TIMES(repeat)\\">> include/config.h |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
500 |
times=${!i} |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
501 |
result="" |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
502 |
for (( j=0; j<times; j++ ));do |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
503 |
result="$result repeat" |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
504 |
done |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
505 |
echo $result >> include/config.h |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
506 |
done |
ed2612282988
- Better array initialization in data.h CANOPEN_NODE_DATA_INITIALIZER macro. Use a little hack with configure and config.h to create the "pure Ansi C" initializer.
etisserant
parents:
81
diff
changeset
|
507 |
|
0 | 508 |
echo "#endif /* _CONFIG_H_ */" >> include/config.h |
509 |
||
510 |
########################################################################### |
|
511 |
# DEBUG DEFINES/CFLAGS # |
|
512 |
########################################################################### |
|
329 | 513 |
|
514 |
save_ifs="$IFS"; IFS=',' |
|
515 |
||
516 |
for DEBUG_METHOD in $DEBUG; |
|
517 |
do |
|
518 |
IFS="$save_ifs" |
|
519 |
case $DEBUG_METHOD in |
|
520 |
ERR)ERR=1;; |
|
521 |
WAR)WAR=1;ERR=1;; |
|
522 |
MSG)MSG=1;; |
|
523 |
PDO)PDO=1;WAR=1;ERR=1;; |
|
524 |
*)echo "" |
|
525 |
echo "$DEBUG_METHOD is not a valid debug's method" |
|
526 |
echo "Possible Debug's methods are : \"ERR\", \"WAR\", \"MSG\", \"PDO\"" |
|
527 |
exit -1 |
|
528 |
;; |
|
529 |
esac |
|
530 |
done |
|
531 |
||
532 |
if [ $WAR ]; then |
|
533 |
SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_WAR_CONSOLE_ON; |
|
534 |
fi |
|
535 |
||
536 |
if [ $ERR ]; then |
|
537 |
SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_ERR_CONSOLE_ON; |
|
538 |
fi |
|
539 |
||
540 |
if [ $MSG ]; then |
|
541 |
SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_MSG_CONSOLE_ON; |
|
542 |
fi |
|
543 |
||
544 |
if [ $PDO ]; then |
|
545 |
SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DDEBUG_PDO_CONSOLE_ON; |
|
546 |
fi |
|
547 |
||
548 |
if [ $DEBUG ]; then |
|
549 |
SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -g |
|
550 |
fi |
|
551 |
||
552 |
IFS="$save_ifs" |
|
0 | 553 |
|
554 |
if [ "$DISABLE_OPT" = "1" ]; then |
|
555 |
SUB_OPT_CFLAGS= |
|
556 |
else |
|
557 |
SUB_OPT_CFLAGS=\$\(OPT_CFLAGS\) |
|
558 |
fi |
|
559 |
||
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
560 |
if [ "$DISABLE_DLL" = "1" ]; then |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
561 |
SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DNOT_USE_DYNAMIC_LOADING |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
562 |
SUB_ENABLE_DLL_DRIVERS=0 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
563 |
else |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
564 |
SUB_ENABLE_DLL_DRIVERS=1 |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
565 |
SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -ldl |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
566 |
fi |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
567 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
568 |
|
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
569 |
if [ "$DISABLE_DLL" = "1" ]; then |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
570 |
SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ $SUB_CAN_DLL_CFLAGS |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
571 |
fi |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
572 |
|
343 | 573 |
if [ $ENABLE_LSS ]; then |
574 |
SUB_PROG_CFLAGS=$SUB_PROG_CFLAGS\ -DCO_ENABLE_LSS; |
|
575 |
SUB_ENABLE_LSS=1 |
|
576 |
else |
|
577 |
SUB_ENABLE_LSS=0 |
|
578 |
fi |
|
579 |
||
0 | 580 |
########################################################################### |
581 |
# CREATE MAKEFILES # |
|
582 |
########################################################################### |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
583 |
# General Makefiles |
0 | 584 |
MAKEFILES=Makefile.in\ |
585 |
\ src/Makefile.in\ |
|
586 |
\ drivers/Makefile.in\ |
|
587 |
\ objdictgen/Makefile.in\ |
|
279
9b69f2fabafe
added config.py.in, filled by configure, so that python program using objdictedit can gat compilation params. Reomved old dead files.
etisserant
parents:
278
diff
changeset
|
588 |
\ examples/Makefile.in\ |
9b69f2fabafe
added config.py.in, filled by configure, so that python program using objdictedit can gat compilation params. Reomved old dead files.
etisserant
parents:
278
diff
changeset
|
589 |
\ objdictgen/canfestival_config.py.in |
0 | 590 |
|
24
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
591 |
# Drivers dependent Makefiles |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
592 |
if [ "$SUB_TIMERS_DRIVER" != "" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
593 |
MAKEFILES=$MAKEFILES\ |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
594 |
\ drivers/timers_$SUB_TIMERS_DRIVER/Makefile.in |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
595 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
596 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
597 |
if [ "$SUB_CAN_DRIVER" != "" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
598 |
MAKEFILES=$MAKEFILES\ |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
599 |
\ drivers/can_$SUB_CAN_DRIVER/Makefile.in |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
600 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
601 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
602 |
# Target dependent Makefiles |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
603 |
MAKEFILES=$MAKEFILES\ drivers/$SUB_TARGET/Makefile.in |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
604 |
|
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
605 |
if [ "$SUB_TARGET" = "unix" ]; then |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
606 |
MAKEFILES=$MAKEFILES\ |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
607 |
\ examples/TestMasterSlave/Makefile.in |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
608 |
fi |
a9543d2ccd56
Linux and BSD now use "unix" target. Generic is for driverless compilation.
etisserant
parents:
15
diff
changeset
|
609 |
|
166
b6fbc1c59a44
Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
145
diff
changeset
|
610 |
if [ "$SUB_TARGET" = "unix" ]; then |
b6fbc1c59a44
Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
145
diff
changeset
|
611 |
MAKEFILES=$MAKEFILES\ |
329 | 612 |
\ examples/DS401_Master/Makefile.in\ |
613 |
\ examples/DS401_Slave_Gui/Makefile.in\ |
|
166
b6fbc1c59a44
Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
145
diff
changeset
|
614 |
\ examples/TestMasterMicroMod/Makefile.in |
b6fbc1c59a44
Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
145
diff
changeset
|
615 |
fi |
b6fbc1c59a44
Added a MicroMod Master sample in examples/TestMasterMicroMod. Fixed some SDO abort code and callback problem in sdo.c.
etisserant
parents:
145
diff
changeset
|
616 |
|
267
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
617 |
if [ "$SUB_TARGET" = "win32" ]; then |
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
618 |
MAKEFILES=$MAKEFILES\ |
329 | 619 |
\ examples/TestMasterSlave/Makefile.in\ |
620 |
\ examples/TestMasterMicroMod/Makefile.in\ |
|
621 |
\ examples/DS401_Master/Makefile.in\ |
|
622 |
\ examples/DS401_Slave_Gui/Makefile.in |
|
623 |
fi |
|
267
96c688ebcde7
Add win32 target (--can=win32) to compile with msys and mingw32
greg
parents:
246
diff
changeset
|
624 |
|
0 | 625 |
if [ "$SUB_TARGET" = "hcs12" ]; then |
626 |
MAKEFILES=$MAKEFILES\ |
|
627 |
\ examples/gene_SYNC_HCS12/Makefile.in |
|
628 |
fi |
|
629 |
||
630 |
for makefile_in in $MAKEFILES; do |
|
631 |
makefile=`echo $makefile_in | sed 's:.in$::'` |
|
632 |
echo "Creating $makefile" |
|
633 |
sed < $makefile_in " |
|
634 |
s:SUB_CC:${CC}: |
|
329 | 635 |
s:SUB_CXX:${CXX}: |
636 |
s:SUB_LD:${LD}: |
|
0 | 637 |
s:SUB_PROG_CFLAGS:${SUB_PROG_CFLAGS}: |
638 |
s:SUB_EXE_CFLAGS:${SUB_EXE_CFLAGS}: |
|
639 |
s:SUB_PREFIX:${SUB_PREFIX}: |
|
640 |
s:SUB_OS_NAME:${SUB_OS_NAME}: |
|
641 |
s:SUB_ARCH_NAME:${SUB_ARCH_NAME}: |
|
642 |
s:SUB_OPT_CFLAGS:${SUB_OPT_CFLAGS}: |
|
643 |
s:SUB_TARGET:${SUB_TARGET}: |
|
644 |
s:SUB_BINUTILS_PREFIX:${SUB_BINUTILS_PREFIX}: |
|
645 |
s:SUB_TIMERS_DRIVER:timers_${SUB_TIMERS_DRIVER}: |
|
646 |
s:SUB_CAN_DRIVER:can_${SUB_CAN_DRIVER}: |
|
145
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
647 |
s:SUB_CAN_DLL_CFLAGS:${SUB_CAN_DLL_CFLAGS}: |
e747d2e26af0
Win32 Native support and dynamicaly loaded CAN drivers for Linux, Cygwin and Win32.
etisserant
parents:
93
diff
changeset
|
648 |
s:SUB_ENABLE_DLL_DRIVERS:${SUB_ENABLE_DLL_DRIVERS}: |
343 | 649 |
s:SUB_ENABLE_LSS:${SUB_ENABLE_LSS}: |
0 | 650 |
" > $makefile |
651 |
done |
|
652 |
||
653 |
echo "All done." |