]> rtime.felk.cvut.cz Git - orte/eurobot.git/commitdiff
Allow optional build of ortemanager and examples as libraries.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Fri, 13 Sep 2013 16:35:14 +0000 (18:35 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Fri, 13 Sep 2013 16:35:14 +0000 (18:35 +0200)
This allows to link multiple commands into single executable
or system image. That is useful for RTEMS build and testing.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
17 files changed:
orte/examples/hello/Makefile.omk
orte/examples/hello/h_publisher.c
orte/examples/hello/h_subscriber.c
orte/examples/multicast/Makefile.omk
orte/examples/multicast/m_subscriber.c
orte/examples/ping/Makefile.omk
orte/examples/ping/orteping.c
orte/examples/reliable/Makefile.omk
orte/examples/reliable/r_publisher.c
orte/examples/reliable/r_subscriber_besteffort.c
orte/examples/reliable/r_subscriber_reliable.c
orte/examples/schneider/Makefile.omk
orte/examples/schneider/schneider_subscriber.c
orte/examples/spy/Makefile.omk
orte/examples/spy/ortespy.c
orte/manager/Makefile.omk
orte/manager/ortemanager.c

index cb1b863be2814e0b7502b14fbb25a2824120e8a5..eaf9ae7ffae8255b244f7711d10e34660e921282 100644 (file)
@@ -1,6 +1,11 @@
 ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES),y)
 
+ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES_AS_LIBRARY),y)
+INCLUDES += -D MAIN_RENAMED
+lib_LIBRARIES = h_publisher h_subscriber
+else
 utils_PROGRAMS = h_publisher h_subscriber
+endif
 
 h_publisher_SOURCES = h_publisher.c
 
@@ -21,7 +26,7 @@ ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES_RTL),y)
 rtlinux_MODULES = h_publisher_rt h_subscriber_rt
 
 rtlinux_INCLUDES = -I $(srcdir)/../../include
-               
+
 h_publisher_rt_SOURCES = h_publisher.c
 
 h_subscriber_rt_SOURCES = h_subscriber.c
index a8dafc01a93b7431aa2be1588d7e0c4085ad28fd..ab7e45994426d1332be16cdcec93c349ac05ede4 100644 (file)
   #include <stdio.h>
 #endif
 
-ORTEDomain        *d=NULL;
-char              instance2Send[64];
-int               counter=0;
+#ifdef MAIN_RENAMED
+#define main orte_h_publisher_main
+#define exit return
+#endif
 
-void
+static ORTEDomain        *d=NULL;
+static char              instance2Send[64];
+static int               counter=0;
+
+static void
 sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
   char *instance=(char*)vinstance;
 
index ce8f18b462e68950cddd2ebef76482ffdc42b921..6cfe38e38370f870b5f9eb7433e00c1505151579 100644 (file)
   #include <stdio.h>
 #endif
 
+#ifdef MAIN_RENAMED
+#define main orte_h_subscriber_main
+#define exit return
+#endif
 
-ORTEDomain        *d = NULL;
-char              instance2Recv[64];
+static ORTEDomain        *d = NULL;
+static char              instance2Recv[64];
 
-void
+static void
 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
   char *instance=(char*)vinstance;
 
@@ -60,7 +64,7 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 }
 
 
-void *
+static void *
 subscriberCreate(void *arg) {
   ORTESubscription    *s;
   NtpTime             deadline,minimumSeparation;
index 4e5411ec69c2d979476953a8d81f019b3218849e..a7d19ff25020b4b7a853346974ffb4fb0f4805c9 100644 (file)
@@ -1,6 +1,11 @@
 ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES),y)
 
+ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES_AS_LIBRARY),y)
+INCLUDES += -D MAIN_RENAMED
+lib_LIBRARIES = m_subscriber
+else
 utils_PROGRAMS = m_subscriber
+endif
 
 m_subscriber_SOURCES = m_subscriber.c
 
index 4b6d084a938a8773a9bbd1b8f7d1748294ff458d..819ba3e59c9c7e9d5e6152b868f800a0782153e3 100644 (file)
 #include "orte.h"
 #include <stdio.h>
 
-ORTEDomain        *d = NULL;
-char              instance2Recv[64];
+#ifdef MAIN_RENAMED
+#define main orte_m_subscriber_main
+#define exit return
+#endif
+
+static ORTEDomain        *d = NULL;
+static char              instance2Recv[64];
 
 int maxDataSize(ORTEGetMaxSizeParam *gms) {
   return gms->max_size;
 }
 
-void
+static void
 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
   char *instance=(char*)vinstance;
 
@@ -53,7 +58,7 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 }
 
 
-void *
+static void *
 subscriberCreate(void *arg) {
   ORTESubscription    *s;
   NtpTime             deadline,minimumSeparation;
index 8c8f288358e40a8ba845f72a8bf4781b327724be..4e6e4217f26108dd0752d7c5bd4d8982fce8fc64 100644 (file)
@@ -1,6 +1,11 @@
 ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES),y)
 
+ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES_AS_LIBRARY),y)
+INCLUDES += -D MAIN_RENAMED
+lib_LIBRARIES = orteping
+else
 bin_PROGRAMS = orteping
+endif
 
 orteping_SOURCES = orteping.c
 
index 9fdf32f36306e8fbc86928c246e2d01087d76e3b..575feeae064cab53a9d480c94bd00415fa063383 100644 (file)
   #include <getopt.h>
 #endif
 
+#ifdef MAIN_RENAMED
+#define main orte_ping_main
+#define exit return
+#endif
+
 Boolean                 quite=ORTE_FALSE;
 int                    regfail=0;
 
@@ -56,7 +61,7 @@ onRegFail(void *param) {
   regfail=1;
 }
 
-void
+static void
 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
   uint32_t *instance=(uint32_t*)vinstance;
   
@@ -71,7 +76,7 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
   }
 }
 
-void
+static void
 sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
   uint32_t *instance=(uint32_t*)vinstance;
   
index 67b707b1a5c96a5e4311fe409f83976bf319ad5d..97fc242158413d6d56d3650f159c13c1d3371e2c 100644 (file)
@@ -1,6 +1,11 @@
 ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES),y)
 
+ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES_AS_LIBRARY),y)
+INCLUDES += -D MAIN_RENAMED
+lib_LIBRARIES = r_publisher r_subscriber_reliable r_subscriber_besteffort
+else
 utils_PROGRAMS = r_publisher r_subscriber_reliable r_subscriber_besteffort
+endif
 
 r_publisher_SOURCES = r_publisher.c
 
index c97033f7ba73e994c92674af9d4541cf8f10690e..98ce8796f23b915ec1dd7fb3b628a64a288e000b 100644 (file)
 #endif
 #include "orte.h"
 
-ORTEDomain        *d;
-char              instance2Send[64];
-int               counter=0;
+#ifdef MAIN_RENAMED
+#define main orte_r_publisher_main
+#define exit return
+#endif
+
+static ORTEDomain        *d;
+static char              instance2Send[64];
+static int               counter=0;
 
-void
+static void
 sendCallBack(const ORTESendInfo *info,void *vinstance, void *sendCallBackParam) {
   char *instance=(char*)vinstance;
 
index 48280633829e3ee59e9a97205e5b07d13e003cf7..5ab3345b17d999de1282c8a722e1cf9463983175 100644 (file)
 #endif
 #include "orte.h"
 
-ORTEDomain        *d;
-char              instance2Recv[64];
+#ifdef MAIN_RENAMED
+#define main orte_r_subscriber_besteffort_main
+#define exit return
+#endif
+
+static ORTEDomain        *d;
+static char              instance2Recv[64];
 
-void
+static void
 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
   char *instance=(char*)vinstance;
   
index 16869884149b5e8f517264ecc95b94b26e04579d..354c60962758fa8d2e51d89d10299a4a949641fc 100644 (file)
 #endif
 #include "orte.h"
 
-ORTEDomain        *d;
-char              instance2Recv[64];
+#ifdef MAIN_RENAMED
+#define main orte_r_subscriber_reliable_main
+#define exit return
+#endif
+
+static ORTEDomain        *d;
+static char              instance2Recv[64];
 
-void
+static void
 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
   char *instance=(char*)vinstance;
   
index 9339f73fe64bd1eb8d67366cfbd5e2e46984fe49..eb0ece129bfffb2e4875e2db97fd42599ebd86c2 100644 (file)
@@ -1,6 +1,11 @@
 ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES),y)
 
+ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES_AS_LIBRARY),y)
+INCLUDES += -D MAIN_RENAMED
+lib_LIBRARIES = schneider_subscriber
+else
 utils_PROGRAMS =  schneider_subscriber
+endif
 
 schneider_subscriber_SOURCES = schneider_subscriber.c
 
index a9ff0745d68389c94602ac20efcb55f60b546afe..d0452ae0423a64f06d36fd330de8b5c87d648acd 100644 (file)
 #include "orte.h"
 #include <stdio.h>
 
-ORTEDomain        *d = NULL;
-char              instance2Recv[64];
+#ifdef MAIN_RENAMED
+#define main orte_schneider_subscriber_main
+#define exit return
+#endif
+
+static ORTEDomain        *d = NULL;
+static char              instance2Recv[64];
 
 int maxDataSize(ORTEGetMaxSizeParam *gms) {
   return gms->max_size;
 }
 
-void
+static void
 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
   char *instance=(char*)vinstance;
 
@@ -53,7 +58,7 @@ recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam)
 }
 
 
-void *
+static void *
 subscriberCreate(void *arg) {
   ORTESubscription    *s;
   NtpTime             deadline,minimumSeparation;
index cf15445cbcdd65a6958930959f5104d7ab24374d..2015c60d13b3c02be4502f3d0d0f362a18a23fd5 100644 (file)
@@ -1,6 +1,11 @@
 ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES),y)
 
+ifeq ($(CONFIG_OC_ETH_ORTE_EXAMPLES_AS_LIBRARY),y)
+INCLUDES += -D MAIN_RENAMED
+lib_LIBRARIES = ortespy
+else
 bin_PROGRAMS = ortespy
+endif
 
 ortespy_SOURCES = ortespy.c
 
index f3c5e7d4eb61634c3dcbd076c729045809e329bc..363589c9f6b59cc5a3fe1e7b9fc27afe66119545 100644 (file)
 #endif
 #include "string.h"
 
-ORTEDomain              *d;
-NtpTime                 deadline,minimumSeparation;
-int32_t                 instanceRecv;
+#ifdef MAIN_RENAMED
+#define main orte_spy_main
+#define exit return
+#endif
+
+static ORTEDomain              *d;
+static NtpTime                 deadline,minimumSeparation;
+static int32_t                 instanceRecv;
 
-void
+static void
 recvCallBack(const ORTERecvInfo *info,void *vinstance, void *recvCallBackParam) {
   char lbuff[MAX_STRING_NTPTIME_LENGTH];
   char rbuff[MAX_STRING_NTPTIME_LENGTH];
index 84dc59516d076ca68d31d57e9ef5db1909b92b11..6b9e932b55d4e22380e79339999f35a21ed181c3 100644 (file)
@@ -1,11 +1,17 @@
 default_CONFIG = CONFIG_OC_ETH_ORTE_MANAGER=y
+default_CONFIG = CONFIG_OC_ETH_ORTE_MANAGER_AS_LIBRARY=x
 
 ifeq ($(CONFIG_OC_ETH_ORTE_MANAGER),y)
 
-bin_PROGRAMS = ortemanager
-
 INCLUDES = -I $(srcdir)/../include
 
+ifeq ($(CONFIG_OC_ETH_ORTE_MANAGER_AS_LIBRARY),y)
+INCLUDES += -D MAIN_RENAMED
+lib_LIBRARIES = ortemanager
+else
+bin_PROGRAMS = ortemanager
+endif
+
 lib_LOADLIBES =  orte pthread
 
 ortemanager_SOURCES = ortemanager.c
@@ -24,7 +30,7 @@ default_CONFIG += CONFIG_OC_ETH_ORTE_MANAGER_RTL=n
 ifeq ($(CONFIG_OC_ETH_ORTE_MANAGER_RTL),y)
 
 rtlinux_MODULES = ortemanager_rt
-               
+
 rtlinux_INCLUDES = -I $(srcdir)/../include
 
 ortemanager_rt_SOURCES = ortemanager.c
index e5dd85181ee5eb635cb907197091fa09afc05a22..fa88433985d006aeb35137d2d7b4058bdef0ada1 100644 (file)
  
 #include "orte_all.h"
 
+#ifdef MAIN_RENAMED
+#define main ortemanager_main
+#define exit return
+#endif
+
 #ifndef CONFIG_ORTE_RT
 //global variables
-ORTEDomain          *d;
-ORTEDomainProp      dp;
-int32_t             opt,domain=ORTE_DEFAULT_DOMAIN;
-Boolean             orteDaemon=ORTE_FALSE;
-Boolean             orteWinService=ORTE_FALSE;
-ORTEDomainAppEvents *events=NULL;
+static ORTEDomain          *d;
+static ORTEDomainProp      dp;
+static int32_t             opt,domain=ORTE_DEFAULT_DOMAIN;
+static Boolean             orteDaemon=ORTE_FALSE;
+static Boolean             orteWinService=ORTE_FALSE;
+static ORTEDomainAppEvents *events=NULL;
 
 //event system
 Boolean