--- a/configure Mon Jan 14 14:28:49 2008 +0100
+++ b/configure Tue Jan 15 09:24:21 2008 +0100
@@ -64,8 +64,8 @@
# Leave empty for automatic detection
CC=
-CXX=g++
-LD=ld
+CXX=
+LD=
#default target
SUB_TARGET=
@@ -307,15 +307,6 @@
fi
fi
-if [ "$SUB_TARGET" = "win32" ]; then
- LD=g++
- SUB_PROG_CFLAGS="-mno-cygwin"
-fi
-
-if [ "$SUB_TARGET" = "unix" ]; then
- LD=gcc
-fi
-
#### CAN_DRIVER ####
if [ "$SUB_CAN_DRIVER" = "peak_linux" ]; then
@@ -380,7 +371,7 @@
fi
###########################################################################
-# GUESS COMPILER #
+# GUESS TOOLCHAIN #
###########################################################################
# If CC is empty, the user wanted automatic detection
if [ "$CC" = "" ]; then
@@ -416,14 +407,34 @@
exit -1
fi
-echo "Using ${CC}"
-
-###########################################################################
-# GUESS PREFIX's #
-###########################################################################
+echo "Using ${CC} as a C compiler"
SUB_BINUTILS_PREFIX=`echo "$CC" | sed 's/gcc$//'`
+if [ "$CXX" = "" ]; then
+ CXX=${SUB_BINUTILS_PREFIX}g++
+fi
+
+echo "Using ${CXX} as a C++ compiler"
+
+if [ "$SUB_TARGET" = "win32" ]; then
+ # on cygwin/mingw, choose g++ as a linker for native target
+ if [ "$LD" = "" ]; then
+ LD=$CXX
+ fi
+ if [ "$SUB_OS_NAME" = "CYGWIN" ]; then
+ SUB_PROG_CFLAGS="-mno-cygwin"
+ fi
+fi
+
+if [ "$SUB_TARGET" = "unix" ]; then
+ if [ "$LD" = "" ]; then
+ LD=$CC
+ fi
+fi
+
+echo "Using ${LD} as a linker"
+
# Guess prefix as regard cross compiling target machine
if [ "$SUB_PREFIX" = "" ]; then
$CC -dumpspecs |grep -A 1 'cross_compile'|grep -q 1
@@ -439,6 +450,32 @@
echo "Using prefix: ${SUB_PREFIX}"
###########################################################################
+# GUESS DEPENDENCIES #
+###########################################################################
+
+if which wx-config >/dev/null 2>&1; then
+ echo -n "Testing wxWidgets compiles ... "
+ cat > /tmp/wx_test.cpp <<EOF
+#include "wx/wx.h"
+class MyApp : public wxApp
+{
+};
+IMPLEMENT_APP(MyApp)
+EOF
+ if $CXX /tmp/wx_test.cpp `wx-config --cxxflags` `wx-config --libs` -o /tmp/wx_test >/dev/null 2>&1 ; then
+ SUB_WX=1
+ echo "Yes"
+ else
+ SUB_WX=0
+ echo "No"
+ fi
+ rm -f /tmp/wx_test*
+else
+ SUB_WX=0
+ echo "No wxWidgets available"
+fi
+
+###########################################################################
# CANFESTIVAL DEFINES --> config.h #
###########################################################################
# Some CONSTANTS preparation
@@ -562,7 +599,7 @@
SUB_ENABLE_DLL_DRIVERS=0
else
SUB_ENABLE_DLL_DRIVERS=1
- if [ "$SUB_OS_NAME" = "MINGW32" ]; then
+ if [ "$SUB_TARGET" = "win32" ]; then
SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS
else
SUB_EXE_CFLAGS=$SUB_EXE_CFLAGS\ -ldl
@@ -614,15 +651,17 @@
if [ "$SUB_TARGET" = "unix" ]; then
MAKEFILES=$MAKEFILES\
-\ examples/DS401_Master/Makefile.in\
-\ examples/DS401_Slave_Gui/Makefile.in\
\ examples/TestMasterMicroMod/Makefile.in
fi
if [ "$SUB_TARGET" = "win32" ]; then
MAKEFILES=$MAKEFILES\
\ examples/TestMasterSlave/Makefile.in\
-\ examples/TestMasterMicroMod/Makefile.in\
+\ examples/TestMasterMicroMod/Makefile.in
+fi
+
+if [ "$SUB_WX" = "1" ]; then
+ MAKEFILES=$MAKEFILES\
\ examples/DS401_Master/Makefile.in\
\ examples/DS401_Slave_Gui/Makefile.in
fi
@@ -652,6 +691,7 @@
s:SUB_CAN_DLL_CFLAGS:${SUB_CAN_DLL_CFLAGS}:
s:SUB_ENABLE_DLL_DRIVERS:${SUB_ENABLE_DLL_DRIVERS}:
s:SUB_ENABLE_LSS:${SUB_ENABLE_LSS}:
+ s:SUB_WX:${SUB_WX}:
" > $makefile
done
--- a/drivers/unix/Makefile.in Mon Jan 14 14:28:49 2008 +0100
+++ b/drivers/unix/Makefile.in Tue Jan 15 09:24:21 2008 +0100
@@ -32,6 +32,7 @@
CAN_DRIVER = SUB_CAN_DRIVER
TIMERS_DRIVER = SUB_TIMERS_DRIVER
ENABLE_DLL_DRIVERS = SUB_ENABLE_DLL_DRIVERS
+BINUTILS_PREFIX = SUB_BINUTILS_PREFIX
INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(TIMERS_DRIVER)
@@ -62,8 +63,8 @@
libcanfestival_$(TARGET).a: $(OBJS)
@echo Building [libcanfestival_$(TARGET).a]
- ar rc $@ $(OBJS)
- ranlib $@
+ $(BINUTILS_PREFIX)ar rc $@ $(OBJS)
+ $(BINUTILS_PREFIX)ranlib $@
install: libcanfestival_$(TARGET).a
mkdir -p $(PREFIX)/lib/
--- a/drivers/win32/Makefile.in Mon Jan 14 14:28:49 2008 +0100
+++ b/drivers/win32/Makefile.in Tue Jan 15 09:24:21 2008 +0100
@@ -34,6 +34,7 @@
CAN_DRIVER = SUB_CAN_DRIVER
TIMERS_DRIVER = SUB_TIMERS_DRIVER
ENABLE_DLL_DRIVERS = SUB_ENABLE_DLL_DRIVERS
+BINUTILS_PREFIX = SUB_BINUTILS_PREFIX
INCLUDES = -I../../include -I../../include/$(TARGET) -I../../include/$(TIMERS_DRIVER)
@@ -64,8 +65,8 @@
libcanfestival_$(TARGET).a: $(OBJS)
@echo Building [libcanfestival_$(TARGET).a]
- ar rc $@ $(OBJS)
- ranlib $@
+ $(BINUTILS_PREFIX)ar rc $@ $(OBJS)
+ $(BINUTILS_PREFIX)ranlib $@
install: libcanfestival_$(TARGET).a
mkdir -p $(PREFIX)/lib/
--- a/examples/Makefile.in Mon Jan 14 14:28:49 2008 +0100
+++ b/examples/Makefile.in Tue Jan 15 09:24:21 2008 +0100
@@ -22,63 +22,42 @@
#
TARGET = SUB_TARGET
+WX = SUB_WX
-all:
-ifeq ($(TARGET),hc12)
- $(MAKE) -C gene_SYNC_HCS12 $@
+ifeq ($(TARGET),win32)
+ BLD_TEST=1
+endif
+ifeq ($(TARGET),unix)
+ BLD_TEST=1
endif
-ifeq ($(TARGET),unix)
- $(MAKE) -C TestMasterSlave $@
+ifeq ($(WX),1)
+define build_command_seq_wx
$(MAKE) -C DS401_Master $@
$(MAKE) -C DS401_Slave_Gui $@
- $(MAKE) -C TestMasterMicroMod $@
+endef
endif
-ifeq ($(TARGET),win32)
+ifdef BLD_TEST
+define build_command_seq
$(MAKE) -C TestMasterSlave $@
- $(MAKE) -C DS401_Master $@
- $(MAKE) -C DS401_Slave_Gui $@
$(MAKE) -C TestMasterMicroMod $@
+ $(build_command_seq_wx)
+endef
endif
-clean:
ifeq ($(TARGET),hc12)
+define build_command_seq
$(MAKE) -C gene_SYNC_HCS12 $@
-endif
-
-ifeq ($(TARGET),unix)
- $(MAKE) -C TestMasterSlave $@
- $(MAKE) -C DS401_Master $@
- $(MAKE) -C DS401_Slave_Gui $@
- $(MAKE) -C TestMasterMicroMod $@
-endif
-
-ifeq ($(TARGET),win32)
- $(MAKE) -C TestMasterSlave $@
- $(MAKE) -C DS401_Master $@
- $(MAKE) -C DS401_Slave_Gui $@
- $(MAKE) -C TestMasterMicroMod $@
+endef
endif
+all:
+ $(build_command_seq)
+
+clean:
+ $(build_command_seq)
+
mrproper: clean
-ifeq ($(TARGET),hc12)
- $(MAKE) -C gene_SYNC_HCS12 $@
-endif
-
-install:
-ifeq ($(TARGET),unix)
- $(MAKE) -C TestMasterSlave $@
- $(MAKE) -C DS401_Master $@
- $(MAKE) -C DS401_Slave_Gui $@
- $(MAKE) -C TestMasterMicroMod $@
-endif
-
-uninstall:
-ifeq ($(TARGET),unix)
- $(MAKE) -C TestMasterSlave $@
- $(MAKE) -C DS401_Master $@
- $(MAKE) -C DS401_Slave_Gui $@
- $(MAKE) -C TestMasterMicroMod $@
-endif
+ $(build_command_seq)