

MBDIR := $(MACHINETALK)/messagebus


ifeq ($(BUILD_DEV),yes)

MESSAGEBUS_SRCS :=  $(addprefix $(MBDIR)/, \
	messagebus.cc \
	rtproxy.cc )

MESSAGEBUS_CXX_CFLAGS = -g $(CXXFLAGS) $(PROTOBUF_CFLAGS) $(CZMQ_CFLAGS)
#-DPB_FIELD_32BIT
MESSAGEBUS_CXX_LDFLAGS=  $(CXX_PROTOLIB) $(PROTOBUF_LIBS) $(CZMQ_LIBS) -lstdc++ -luuid

$(call TOOBJSDEPS, $(MESSAGEBUS_SRCS)) : EXTRAFLAGS += $(MESSAGEBUS_CXX_CFLAGS)

../bin/messagebus: $(call TOOBJS, $(MESSAGEBUS_SRCS)) \
	../lib/libmtalk.so.0 \
	../lib/liblinuxcncini.so.0 \
	../lib/liblinuxcnchal.so.0 \
	../lib/libmachinetalk-pb2++.so.0 \
	../lib/libmachinetalk-npb.so.0
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^  \
	 $(MESSAGEBUS_CXX_LDFLAGS)

USERSRCS += $(MESSAGEBUS_SRCS)

TARGETS += ../bin/messagebus



# just a test
ifeq ($(BUILD_RFRAME),yes)


RFRAME_SRCS :=  $(addprefix $(MBDIR)/, \
	rframe.cc )

RFRAME_CXX_CFLAGS = -g -std=c++0x $(PROTOBUF_CFLAGS) $(CZMQ_CFLAGS)  # -DPB_FIELD_32BIT
RFRAME_CXX_LDFLAGS=  $(CXX_PROTOLIB) $(PROTOBUF_LIBS) $(CZMQ_LIBS) -lstdc++

$(call TOOBJSDEPS, $(RFRAME_SRCS)) : EXTRAFLAGS += $(RFRAME_CXX_CFLAGS)

../bin/rframe: $(call TOOBJS, $(RFRAME_SRCS)) \
	../lib/liblinuxcncini.so.0 \
	../lib/liblinuxcnchal.so.0 \
	../lib/libmachinetalk-pb2++.so.0 \
	../lib/libmachinetalk-npb.so.0
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) -o $@ $^  \
	 $(RFRAME_CXX_LDFLAGS)

USERSRCS += $(RFRAME_SRCS)

TARGETS += ../bin/rframe

endif


endif # BUILD_DEV

