Adds server_stubs.c to hold these routines, using automake logic to
ensure it gets included under the right conditions.

Signed-off-by: Zachary T Welch <z...@superlucidity.net>
---
 src/openocd.c             |   14 --------------
 src/openocd.h             |    5 -----
 src/server/Makefile.am    |    4 ++++
 src/server/server.h       |    9 +++++++++
 src/server/server_stubs.c |   32 ++++++++++++++++++++++++++++++++
 5 files changed, 45 insertions(+), 19 deletions(-)
 create mode 100644 src/server/server_stubs.c

diff --git a/src/openocd.c b/src/openocd.c
index 12bcf44..2043a92 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -215,20 +215,6 @@ struct command_context *setup_command_handler(Jim_Interp 
*interp)
        return cmd_ctx;
 }
 
-#if !BUILD_HTTPD && !BUILD_ECOSBOARD
-/* implementations of OpenOCD that uses multithreading needs to know when
- * OpenOCD is sleeping. No-op in vanilla OpenOCD
- */
-void openocd_sleep_prelude(void)
-{
-}
-
-void openocd_sleep_postlude(void)
-{
-}
-#endif
-
-
 /* normally this is the main() function entry, but if OpenOCD is linked
  * into application, then this fn will not be invoked, but rather that
  * application will have it's own implementation of main(). */
diff --git a/src/openocd.h b/src/openocd.h
index a91d46f..e43f156 100644
--- a/src/openocd.h
+++ b/src/openocd.h
@@ -31,11 +31,6 @@
  */
 int openocd_main(int argc, char *argv[]);
 
-/// used by the server_loop() function in src/server/server.c
-void openocd_sleep_prelude(void);
-/// used by the server_loop() function in src/server/server.c
-void openocd_sleep_postlude(void);
-
 /// provides a hard-coded command environment setup
 extern const char openocd_startup_tcl[];
 
diff --git a/src/server/Makefile.am b/src/server/Makefile.am
index 95fb519..b47b8d0 100644
--- a/src/server/Makefile.am
+++ b/src/server/Makefile.am
@@ -13,6 +13,10 @@ libserver_la_SOURCES = server.c telnet_server.c gdb_server.c
 
 if HTTPD
 libserver_la_SOURCES += httpd.c
+else
+if !ECOSBOARD
+libserver_la_SOURCES += server_stubs.c
+endif
 endif
 noinst_HEADERS += httpd.h
 
diff --git a/src/server/server.h b/src/server/server.h
index 173de95..e632bf1 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -82,6 +82,15 @@ int server_loop(struct command_context *command_context);
 int server_register_commands(struct command_context *context);
 
 /**
+ * Used by server_loop(), defined in server_stubs.c, httpd.c, or ecosboard.c
+ */
+void openocd_sleep_prelude(void);
+/**
+ * Used by server_loop(), defined in server_stubs.c, httpd.c, or ecosboard.c
+ */
+void openocd_sleep_postlude(void);
+
+/**
  * Defines an extended command handler function declaration to enable
  * access to (and manipulation of) the server port number.
  * Call server_port like a normal COMMAND_HANDLER with an extra @a out 
parameter
diff --git a/src/server/server_stubs.c b/src/server/server_stubs.c
new file mode 100644
index 0000000..dcddec0
--- /dev/null
+++ b/src/server/server_stubs.c
@@ -0,0 +1,32 @@
+/***************************************************************************
+ *   Copyright (C) 2009 Zachary T Welch <z...@superlucidity.net>             *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "server.h"
+
+void openocd_sleep_prelude(void)
+{
+       // no-op
+}
+void openocd_sleep_postlude(void)
+{
+       // no-op
+}
-- 
1.6.4.4

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

Reply via email to