Hi,

Started a new thread as the others are getting bogged down.

This defaults to building the jimtcl inline - only one configure step required, eg.
./configure --enable-maintainer-mode --with-jim-ext=nvp ...

The only limitation is that we have to pass the jim options through openocd. autoconf currently does not allow project specific subconfigure options - this is being looked at. I have also added a temp hack so we do not get warnings due to the jim headers - this will need looking at.

For those that like the current behaviour just configure with --disable-internal-jimtcl and build lib manually.

tested on usual suspects linux, cygwin and mingw.
http://repo.or.cz/w/openocd/ntfreak.git/shortlog/refs/heads/jimtcl

Let the comments roll :)

Cheers
Spen
>From 2755989d4cef1aacaff62b6aa188ac2cc3cbbc15 Mon Sep 17 00:00:00 2001
From: Spencer Oliver <ntfr...@users.sourceforge.net>
Date: Fri, 12 Nov 2010 14:12:44 +0000
Subject: [PATCH 2/2] build: add autobuild jimtcl to configure scripts

Rather than having to configure/build jimtcl openocd
will do this as part of its own build.

To use an external jimtcl lib specify disable-internal-jimtcl
to the configure step.

Signed-off-by: Spencer Oliver <ntfr...@users.sourceforge.net>
---
 Makefile.am     |    8 +++++++-
 common.mk       |    7 +++++++
 configure.in    |   15 +++++++++++++++
 src/Makefile.am |    8 +++++++-
 4 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7d42fd3..b31bcea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,13 @@ nobase_dist_pkgdata_DATA = \
        contrib/libdcc/README \
        contrib/openocd.udev
 
-SUBDIRS = src doc
+if INTERNAL_JIMTCL
+SUBDIRS = jimtcl
+else
+SUBDIRS =
+endif
+
+SUBDIRS += src doc
 
 EXTRA_DIST = \
        Doxyfile.in \
diff --git a/common.mk b/common.mk
index d2273d7..644aa84 100644
--- a/common.mk
+++ b/common.mk
@@ -3,3 +3,10 @@
 AM_CPPFLAGS = -I$(top_srcdir)/src \
                          -I$(top_builddir)/src \
                          -DPKGDATADIR=\"$(pkgdatadir)\"
+
+# HAVE_NO_AUTOCONF is a temp hack to build jimtcl inline
+if INTERNAL_JIMTCL
+AM_CPPFLAGS += -I$(top_srcdir)/jimtcl \
+                          -I$(top_builddir)/jimtcl \
+                          -DHAVE_NO_AUTOCONF
+endif
diff --git a/configure.in b/configure.in
index a15b80a..23e0ff5 100644
--- a/configure.in
+++ b/configure.in
@@ -2,6 +2,8 @@ AC_PREREQ(2.60)
 AC_INIT([openocd], [0.5.0-dev],
   [OpenOCD Mailing List <openocd-development@lists.berlios.de>])
 AC_CONFIG_SRCDIR([src/openocd.c])
+#AC_CONFIG_AUX_DIR([.])
+#AC_CONFIG_SUBDIRS([jimtcl])
 
 AM_INIT_AUTOMAKE([-Wall -Wno-portability dist-bzip2 dist-zip])
 AM_MAINTAINER_MODE
@@ -486,6 +488,9 @@ AC_ARG_ENABLE(minidriver_dummy,
   AS_HELP_STRING([--enable-minidriver-dummy], [Enable the dummy minidriver.]),
   [build_minidriver_dummy=$enableval], [build_minidriver_dummy=no])
 
+AC_ARG_ENABLE(internal-jimtcl,
+  AS_HELP_STRING([--enable-internal-jimtcl], [Enable internal jimtcl]),
+  [use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes])
 
 build_minidriver=no
 AC_MSG_CHECKING([whether to enable ZY1000 minidriver])
@@ -761,6 +766,14 @@ else
   AC_DEFINE(BUILD_BUSPIRATE, 0, [0 if you don't want the Buspirate JTAG 
driver.])
 fi
 
+if test "$use_internal_jimtcl" = yes; then
+  if test -d "$srcdir/jimtcl"; then
+    AC_CONFIG_SUBDIRS([jimtcl])
+  else
+    AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule 
update.])
+  fi
+fi
+
 #-- Deal with MingW/Cygwin FTD2XX issues
 
 if test $is_win32 = yes; then
@@ -1067,6 +1080,8 @@ AM_CONDITIONAL(BITQ, test $build_bitq = yes)
 AM_CONDITIONAL(MINIDRIVER, test $build_minidriver = yes)
 AM_CONDITIONAL(MINIDRIVER_DUMMY, test $build_minidriver_dummy = yes)
 
+AM_CONDITIONAL(INTERNAL_JIMTCL, test $use_internal_jimtcl = yes)
+
 # Look for environ alternatives.  Possibility #1: is environ in unistd.h or 
stdlib.h?
 AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
 AC_COMPILE_IFELSE([
diff --git a/src/Makefile.am b/src/Makefile.am
index 1f29d71..ecd5425 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,13 @@ MAINFILE = main.c
 endif
 
 openocd_SOURCES = $(MAINFILE)
-openocd_LDADD = libopenocd.la -ljim
+openocd_LDADD = libopenocd.la
+
+if INTERNAL_JIMTCL
+openocd_LDADD += $(top_builddir)/jimtcl/libjim.a
+else
+openocd_LDADD += -ljim
+endif
 
 libopenocd_la_SOURCES = \
        hello.c \
-- 
1.7.1

>From 2b2378a351c1e4079ab7d012d8fe3b5cac83ccf7 Mon Sep 17 00:00:00 2001
From: Spencer Oliver <ntfr...@users.sourceforge.net>
Date: Fri, 12 Nov 2010 11:41:55 +0000
Subject: [PATCH 1/2] build: add common.mk

Rather than specifying common makefile variables move
them all to a common.mk.

Signed-off-by: Spencer Oliver <ntfr...@users.sourceforge.net>
---
 common.mk                    |    5 +++++
 src/Makefile.am              |    8 ++------
 src/flash/Makefile.am        |    6 ++----
 src/flash/nand/Makefile.am   |    4 +---
 src/flash/nor/Makefile.am    |    4 +---
 src/helper/Makefile.am       |    5 +----
 src/jtag/Makefile.am         |    4 +---
 src/jtag/drivers/Makefile.am |    4 +---
 src/pld/Makefile.am          |    4 +---
 src/server/Makefile.am       |    5 +----
 src/svf/Makefile.am          |    4 +---
 src/target/Makefile.am       |    5 +----
 src/xsvf/Makefile.am         |    4 +---
 13 files changed, 19 insertions(+), 43 deletions(-)
 create mode 100644 common.mk

diff --git a/common.mk b/common.mk
new file mode 100644
index 0000000..d2273d7
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,5 @@
+
+# common flags used in openocd build
+AM_CPPFLAGS = -I$(top_srcdir)/src \
+                         -I$(top_builddir)/src \
+                         -DPKGDATADIR=\"$(pkgdatadir)\"
diff --git a/src/Makefile.am b/src/Makefile.am
index b54161c..1f29d71 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/common.mk
+
 SUBDIRS = \
        jtag \
        helper \
@@ -29,12 +31,6 @@ noinst_HEADERS = \
        hello.h \
        openocd.h
 
-
-# set the include path found by configure
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
-
 libopenocd_la_CPPFLAGS = -DPKGBLDDATE=\"`date +%F-%R`\"
 
 # banner output includes RELSTR appended to $VERSION from the configure script
diff --git a/src/flash/Makefile.am b/src/flash/Makefile.am
index 9d983a8..ece4018 100644
--- a/src/flash/Makefile.am
+++ b/src/flash/Makefile.am
@@ -1,11 +1,9 @@
+include $(top_srcdir)/common.mk
+
 SUBDIRS = \
        nor \
        nand
 
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
-
 METASOURCES = AUTO
 noinst_LTLIBRARIES = libflash.la
 libflash_la_SOURCES = \
diff --git a/src/flash/nand/Makefile.am b/src/flash/nand/Makefile.am
index 8ea7b36..9aa0e69 100644
--- a/src/flash/nand/Makefile.am
+++ b/src/flash/nand/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
+include $(top_srcdir)/common.mk
 
 noinst_LTLIBRARIES = libocdflashnand.la
 
diff --git a/src/flash/nor/Makefile.am b/src/flash/nor/Makefile.am
index eec6f50..c144d05 100644
--- a/src/flash/nor/Makefile.am
+++ b/src/flash/nor/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
+include $(top_srcdir)/common.mk
 
 noinst_LTLIBRARIES = libocdflashnor.la
 libocdflashnor_la_SOURCES = \
diff --git a/src/helper/Makefile.am b/src/helper/Makefile.am
index c721881..25585a4 100644
--- a/src/helper/Makefile.am
+++ b/src/helper/Makefile.am
@@ -1,7 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src \
-       -DPKGDATADIR=\"$(pkgdatadir)\"
+include $(top_srcdir)/common.mk
 
 METASOURCES = AUTO
 noinst_LTLIBRARIES = libhelper.la
diff --git a/src/jtag/Makefile.am b/src/jtag/Makefile.am
index 59cd8ff..fa964a3 100644
--- a/src/jtag/Makefile.am
+++ b/src/jtag/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
+include $(top_srcdir)/common.mk
 
 METASOURCES = AUTO
 noinst_LTLIBRARIES = libjtag.la
diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am
index 0588126..f3d5ab0 100644
--- a/src/jtag/drivers/Makefile.am
+++ b/src/jtag/drivers/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
+include $(top_srcdir)/common.mk
 
 noinst_LTLIBRARIES = libocdjtagdrivers.la
 
diff --git a/src/pld/Makefile.am b/src/pld/Makefile.am
index 3993622..93b79f4 100644
--- a/src/pld/Makefile.am
+++ b/src/pld/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
+include $(top_srcdir)/common.mk
 
 METASOURCES = AUTO
 noinst_LTLIBRARIES = libpld.la
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
index c6c946f..fc91cec 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -1,7 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src \
-       -DPKGDATADIR=\"$(pkgdatadir)\"
+include $(top_srcdir)/common.mk
 
 METASOURCES = AUTO
 noinst_LTLIBRARIES = libserver.la
diff --git a/src/svf/Makefile.am b/src/svf/Makefile.am
index 398f967..3a14d20 100644
--- a/src/svf/Makefile.am
+++ b/src/svf/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
+include $(top_srcdir)/common.mk
 
 METASOURCES = AUTO
 noinst_LTLIBRARIES = libsvf.la
diff --git a/src/target/Makefile.am b/src/target/Makefile.am
index 1e29ae7..537c8c3 100644
--- a/src/target/Makefile.am
+++ b/src/target/Makefile.am
@@ -1,3 +1,4 @@
+include $(top_srcdir)/common.mk
 
 if OOCD_TRACE
 OOCD_TRACE_FILES = oocd_trace.c
@@ -5,10 +6,6 @@ else
 OOCD_TRACE_FILES =
 endif
 
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
-
 BIN2C          = $(top_builddir)/src/helper/bin2char$(EXEEXT_FOR_BUILD)
 
 DEBUG_HANDLER  = $(srcdir)/xscale/debug_handler.bin
diff --git a/src/xsvf/Makefile.am b/src/xsvf/Makefile.am
index f96331c..1b9cfab 100644
--- a/src/xsvf/Makefile.am
+++ b/src/xsvf/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = \
-       -I$(top_srcdir)/src \
-       -I$(top_builddir)/src
+include $(top_srcdir)/common.mk
 
 METASOURCES = AUTO
 noinst_LTLIBRARIES = libxsvf.la
-- 
1.7.1

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to