diff --git a/MQTTSNGateway/README.md b/MQTTSNGateway/README.md index 3c7b8bb..67f5e57 100644 --- a/MQTTSNGateway/README.md +++ b/MQTTSNGateway/README.md @@ -33,14 +33,15 @@ BrokerSecurePortNo=8883 ClientAuthentication=NO #ClientsList=/path/to/your_clients.conf -RootCAfile=/path/to/your_Root_CA.crt -RootCApath=/path/to/your_certs_directory/ +#RootCAfile=/path/to/your_Root_CA.crt +#RootCApath=/path/to/your_certs_directory/ +#CertsDirectory=/path/to/your_client_certs_directory/ GatewayID=1 GatewayName=PahoGateway-01 KeepAlive=900 -#LoginID= -#Password= +#LoginID=your_ID +#Password=your_Password # UDP GatewayPortNo=10000 @@ -50,6 +51,7 @@ MulticastPortNo=1883 # XBee Baudrate=38400 SerialDevice=/dev/ttyUSB0 +ApiMode=2 ``` **BrokerName** to specify a domain name of the Broker, and **BrokerPortNo** is a port No of the Broker. **BrokerSecurePortNo** is for TLS connection. diff --git a/MQTTSNGateway/gateway.conf b/MQTTSNGateway/gateway.conf index 3438767..6d020c6 100644 --- a/MQTTSNGateway/gateway.conf +++ b/MQTTSNGateway/gateway.conf @@ -20,7 +20,7 @@ BrokerSecurePortNo=8883 ClientAuthentication=NO #ClientsList=/path/to/your_clients.conf -RootCAfile=/etc/ssl/certs/ca-certificates.crt +#RootCAfile=/etc/ssl/certs/ca-certificates.crt #RootCApath=/etc/ssl/certs/ #CertsDirectory=/usr/share/GW/IoTcerts/ diff --git a/MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.cpp b/MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.cpp index 967c63a..11a2d3e 100644 --- a/MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.cpp +++ b/MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.cpp @@ -117,7 +117,7 @@ void BrokerRecvTask::run(void) /* post a BrokerRecvEvent */ ev = new Event(); ev->setBrokerRecvEvent(client, packet); - if ( _gateway->getPacketEventQue()->post(ev) == 1 ) + if ( _gateway->getPacketEventQue()->post(ev) == 0 ) { delete ev; } diff --git a/MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.h b/MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.h index a5dd9a8..4177015 100644 --- a/MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.h +++ b/MQTTSNGateway/src/MQTTSNGWBrokerRecvTask.h @@ -22,7 +22,6 @@ namespace MQTTSNGW { -#define ERRNO_APL_03 13 // Task Initialize Error /*===================================== Class BrokerRecvTask =====================================*/ diff --git a/MQTTSNGateway/src/MQTTSNGWBrokerSendTask.h b/MQTTSNGateway/src/MQTTSNGWBrokerSendTask.h index 81b0a7a..7ce73ea 100644 --- a/MQTTSNGateway/src/MQTTSNGWBrokerSendTask.h +++ b/MQTTSNGateway/src/MQTTSNGWBrokerSendTask.h @@ -22,7 +22,6 @@ namespace MQTTSNGW { -#define ERRNO_APL_04 14 // Task Initialize Error /*===================================== Class BrokerSendTask =====================================*/ diff --git a/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp b/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp index a8db6d3..ff87f5b 100644 --- a/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp +++ b/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp @@ -77,7 +77,7 @@ void ClientRecvTask::run() log(0, packet); ev = new Event(); ev->setBrodcastEvent(packet); - if ( _gateway->getPacketEventQue()->post(ev) == 1 ) + if ( _gateway->getPacketEventQue()->post(ev) == 0 ) { delete ev; } @@ -93,7 +93,7 @@ void ClientRecvTask::run() log(client, packet); ev = new Event(); ev->setClientRecvEvent(client,packet); - if ( _gateway->getPacketEventQue()->post(ev) == 1 ) + if ( _gateway->getPacketEventQue()->post(ev) == 0 ) { delete ev; } @@ -123,7 +123,7 @@ void ClientRecvTask::run() client->setClientAddress(_sensorNetwork->getSenderAddress()); ev = new Event(); ev->setClientRecvEvent(client, packet); - if ( _gateway->getPacketEventQue()->post(ev) == 1 ) + if ( _gateway->getPacketEventQue()->post(ev) == 0 ) { delete ev; } diff --git a/MQTTSNGateway/src/MQTTSNGWProcess.h b/MQTTSNGateway/src/MQTTSNGWProcess.h index d79f829..c1b9110 100644 --- a/MQTTSNGateway/src/MQTTSNGWProcess.h +++ b/MQTTSNGateway/src/MQTTSNGWProcess.h @@ -19,6 +19,7 @@ #include #include +#include #include "MQTTSNGWDefines.h" #include "Threading.h" @@ -164,6 +165,7 @@ public: _head = 0; _tail = 0; _cnt = 0; + _maxSize = 0; } ~Que() @@ -213,28 +215,33 @@ public: int post(T* t) { - QueElement* elm = new QueElement(t); - if ( _head ) + if ( t && ( _maxSize == 0 || size() < _maxSize )) { - if ( _tail == _head ) + QueElement* elm = new QueElement(t); + if ( _head ) { + if ( _tail == _head ) + { + elm->_prev = _tail; + _tail = elm; + _head->_next = elm; + } + else + { + _tail->_next = elm; elm->_prev = _tail; _tail = elm; + } } else { - _tail->_next = elm; - elm->_prev = _tail; - _tail = elm; + _head = elm; + _tail = elm; } + _cnt++; + return _cnt; } - else - { - _head = elm; - _tail = elm; - } - _cnt++; - return _cnt; + return 0; } int size(void) @@ -242,8 +249,14 @@ public: return _cnt; } + void setMaxSize(int maxSize) + { + _maxSize = maxSize; + } + private: int _cnt; + int _maxSize; QueElement* _head; QueElement* _tail; }; diff --git a/MQTTSNGateway/src/MQTTSNGateway.cpp b/MQTTSNGateway/src/MQTTSNGateway.cpp index 8b6e72c..fa90643 100644 --- a/MQTTSNGateway/src/MQTTSNGateway.cpp +++ b/MQTTSNGateway/src/MQTTSNGateway.cpp @@ -188,7 +188,7 @@ GatewayParams* Gateway::getGWParams(void) =====================================*/ EventQue::EventQue() { - _maxSize = 0; + } EventQue::~EventQue() @@ -198,7 +198,7 @@ EventQue::~EventQue() void EventQue::setMaxSize(uint16_t maxSize) { - _maxSize = maxSize; + _que.setMaxSize((int)maxSize); } Event* EventQue::wait(void) @@ -245,15 +245,12 @@ Event* EventQue::timedwait(uint16_t millsec) int EventQue::post(Event* ev) { - if ( ev && ( _maxSize == 0 || size() < _maxSize ) ) - { - _mutex.lock(); - _que.post(ev); - _sem.post(); - _mutex.unlock(); - return 0; - } - return 1; + int rc = 0; + _mutex.lock(); + rc = _que.post(ev); + _sem.post(); + _mutex.unlock(); + return rc; } int EventQue::size() diff --git a/MQTTSNGateway/src/MQTTSNGateway.h b/MQTTSNGateway/src/MQTTSNGateway.h index b9c1710..f3e2b4d 100644 --- a/MQTTSNGateway/src/MQTTSNGateway.h +++ b/MQTTSNGateway/src/MQTTSNGateway.h @@ -31,7 +31,7 @@ namespace MQTTSNGW /*================================= * Starting prompt ==================================*/ -#define GATEWAY_VERSION " * Version: 0.5.0" +#define GATEWAY_VERSION " * Version: 0.6.0" #define PAHO_COPYRIGHT0 " * MQTT-SN Transparent Gateway" #define PAHO_COPYRIGHT1 " * Part of Project Paho in Eclipse" @@ -138,7 +138,6 @@ private: Que _que; Mutex _mutex; Semaphore _sem; - uint16_t _maxSize; }; /* diff --git a/MQTTSNGateway/src/linux/Threading.cpp b/MQTTSNGateway/src/linux/Threading.cpp index 25a7d8e..b6eeb5c 100644 --- a/MQTTSNGateway/src/linux/Threading.cpp +++ b/MQTTSNGateway/src/linux/Threading.cpp @@ -502,7 +502,7 @@ bool Thread::equals(pthread_t *t1, pthread_t *t2) int Thread::start(void) { - Runnable *runnable = this; + Runnable* runnable = this; return pthread_create(&_threadID, 0, _run, runnable); } diff --git a/MQTTSNGateway/src/linux/Threading.h b/MQTTSNGateway/src/linux/Threading.h index 8c74784..185ce69 100644 --- a/MQTTSNGateway/src/linux/Threading.h +++ b/MQTTSNGateway/src/linux/Threading.h @@ -19,6 +19,7 @@ #include #include +#include "MQTTSNGWDefines.h" namespace MQTTSNGW { diff --git a/MQTTSNGateway/src/linux/xbee/SensorNetwork.cpp b/MQTTSNGateway/src/linux/xbee/SensorNetwork.cpp index 1d37654..75e90a0 100644 --- a/MQTTSNGateway/src/linux/xbee/SensorNetwork.cpp +++ b/MQTTSNGateway/src/linux/xbee/SensorNetwork.cpp @@ -152,6 +152,7 @@ SensorNetAddress* SensorNetwork::getSenderAddress(void) XBee::XBee(){ _serialPort = new SerialPort(); _respCd = 0; + _respId = 0; _dataLen = 0; _frameId = 0; _apiMode = 2; diff --git a/MQTTSNGateway/src/mainGateway.cpp b/MQTTSNGateway/src/mainGateway.cpp index 9ffc74a..227f9c8 100644 --- a/MQTTSNGateway/src/mainGateway.cpp +++ b/MQTTSNGateway/src/mainGateway.cpp @@ -25,18 +25,17 @@ using namespace MQTTSNGW; /* * Gateway Process */ -Gateway* gateway = new Gateway(); -PacketHandleTask* t0 = new PacketHandleTask(gateway); -ClientRecvTask* t1 = new ClientRecvTask(gateway); -ClientSendTask* t2 = new ClientSendTask(gateway); -BrokerRecvTask* t3 = new BrokerRecvTask(gateway); -BrokerSendTask* t4 = new BrokerSendTask(gateway); +Gateway* gw = new Gateway(); +PacketHandleTask task1(gw); +ClientRecvTask task2(gw); +ClientSendTask task3(gw); +BrokerRecvTask task4(gw); +BrokerSendTask task5(gw); int main(int argc, char** argv) { - gateway->initialize(argc, argv); - gateway->run(); - delete gateway; + gw->initialize(argc, argv); + gw->run(); + delete gw; return 0; } - diff --git a/MQTTSNGateway/src/tests/TestProcessFramework.cpp b/MQTTSNGateway/src/tests/TestProcessFramework.cpp new file mode 100644 index 0000000..6b6fe04 --- /dev/null +++ b/MQTTSNGateway/src/tests/TestProcessFramework.cpp @@ -0,0 +1,151 @@ +/************************************************************************************** + * Copyright (c) 2016, Tomoaki Yamaguchi + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Tomoaki Yamaguchi - initial API and implementation + **************************************************************************************/ + +#include +#include +#include "TestProcessFramework.h" +#include "MQTTSNGWProcess.h" +#include "Timer.h" + +using namespace std; +using namespace MQTTSNGW; + +#define ARGV "./testPFW" +#define CONFDIR "./" +#define CONF "gateway.conf" + +const char* currentDateTime(void); + +TestProcessFramework::TestProcessFramework() +{ + theMultiTaskProcess = this; + theProcess = this; +} + +TestProcessFramework::~TestProcessFramework() +{ + +} + +void TestProcessFramework::initialize(int argc, char** argv) +{ + MultiTaskProcess::initialize(argc, argv); + assert(0 == strcmp(CONFDIR, getConfigDirName()->c_str())); + assert(0 == strcmp(CONF, getConfigFileName()->c_str())); + resetRingBuffer(); +} + +void TestProcessFramework::run(void) +{ + char value[256]; + int* v = 0; + int i = 0; + Timer tm; + TestQue que; + + assert(1 == getArgc() || 3 == getArgc() ); + assert(0 == strcmp(ARGV, *getArgv())); + getParam("BrokerName", value); + assert(0 == strcmp("iot.eclipse.org", value)); + + for ( i = 0; i < 1000; i++) + { + putLog("Test RingBuffer %d ", 1234567890); + } + putLog("\n\nRingBuffer Test complieted. Enter CTRL+C\n"); + + for ( i = 0; i < 10; i++ ) + { + v = new int(i); + que.post(v); + } + assert( 10 == que.size()); + + for ( i = 0; i < 10; i++ ) + { + assert(i == *que.front()); + int* p = que.front(); + if ( p ) + { + assert(i == *p); + que.pop(); + delete p; + } + } + assert(0 == que.front()); + assert(0 == que.size()); + + que.setMaxSize(5); + for ( i = 0; i < 10; i++ ) + { + v = new int(i); + que.post(v); + assert( 5 >= que.size()); + } + for ( i = 0; i < 10; i++ ) + { + int* p = que.front(); + if ( p ) + { + que.pop(); + delete p; + } + } + + printf("%s Timer start\n", currentDateTime()); + tm.start(1000); + while (!tm.isTimeup()); + printf("%s Timer 1sec\n", currentDateTime()); + + tm.start(); + while (!tm.isTimeup(1000)); + printf("%s Timer 1sec\n", currentDateTime()); + + MultiTaskProcess::run(); + printf("ProcessFramework test complited.\n"); +} + +TestQue::TestQue() +{ + +} + +TestQue::~TestQue() +{ + +} + +int* TestQue::front(void) +{ + return _que.front(); +} +void TestQue::pop(void) +{ + _que.pop(); +} +int TestQue::size(void) +{ + return _que.size(); +} +void TestQue::setMaxSize(int maxsize) +{ + _que.setMaxSize(maxsize); +} + +void TestQue::post(int* val) +{ + _que.post(val); +} diff --git a/MQTTSNGateway/src/tests/TestProcessFramework.h b/MQTTSNGateway/src/tests/TestProcessFramework.h new file mode 100644 index 0000000..88617f1 --- /dev/null +++ b/MQTTSNGateway/src/tests/TestProcessFramework.h @@ -0,0 +1,50 @@ +/************************************************************************************** + * Copyright (c) 2016, Tomoaki Yamaguchi + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Tomoaki Yamaguchi - initial API and implementation + **************************************************************************************/ +#ifndef TESTPROCESSFRAMEWORK_H_ +#define TESTPROCESSFRAMEWORK_H_ + +#include "MQTTSNGWProcess.h" + + +namespace MQTTSNGW +{ +class TestProcessFramework: public MultiTaskProcess{ +public: + TestProcessFramework(); + ~TestProcessFramework(); + virtual void initialize(int argc, char** argv); + void run(void); + +private: + +}; + +class TestQue +{ +public: + TestQue(); + ~TestQue(); + void post(int*); + int* front(void); + void pop(void); + int size(void); + void setMaxSize(int maxsize); +private: + Que _que; +}; +} + +#endif /* TESTPROCESSFRAMEWORK_H_ */ diff --git a/MQTTSNGateway/src/tests/TestTask.cpp b/MQTTSNGateway/src/tests/TestTask.cpp new file mode 100644 index 0000000..cf1667e --- /dev/null +++ b/MQTTSNGateway/src/tests/TestTask.cpp @@ -0,0 +1,49 @@ +/************************************************************************************** + * Copyright (c) 2016, Tomoaki Yamaguchi + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Tomoaki Yamaguchi - initial API and implementation + **************************************************************************************/ +#include +#include "TestTask.h" +#include "Threading.h" + +using namespace std; +using namespace MQTTSNGW; + +TestTask::TestTask(TestProcessFramework* proc) +{ + proc->attach((Thread*)this); +} + +TestTask::~TestTask() +{ + +} + +void TestTask::initialize(int argc, char** argv) +{ + printf("Task initialize complite.\n"); +} + +void TestTask::run(void) +{ + while(true) + { + printf("Task is running. Enter CTRL+C \n"); + if (theProcess->checkSignal() == SIGINT) + { + throw Exception("Terminated by CTL-C"); + } + sleep(1); + } +} diff --git a/MQTTSNGateway/src/tests/TestTask.h b/MQTTSNGateway/src/tests/TestTask.h new file mode 100644 index 0000000..c79db00 --- /dev/null +++ b/MQTTSNGateway/src/tests/TestTask.h @@ -0,0 +1,42 @@ +/************************************************************************************** + * Copyright (c) 2016, Tomoaki Yamaguchi + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Tomoaki Yamaguchi - initial API and implementation + **************************************************************************************/ +#ifndef TESTTASK_H_ +#define TESTTASK_H_ + +#include "Threading.h" +#include "TestProcessFramework.h" + +namespace MQTTSNGW +{ + +class TestTask: public Thread +{ +MAGIC_WORD_FOR_THREAD; + ; +public: + TestTask(TestProcessFramework* proc); + ~TestTask(); + void initialize(int argc, char** argv); + void run(void); + +private: + +}; + +} + + +#endif /* TESTTASK_H_ */ diff --git a/MQTTSNGateway/src/tests/mainTestProcessFramework.cpp b/MQTTSNGateway/src/tests/mainTestProcessFramework.cpp new file mode 100644 index 0000000..9c23e04 --- /dev/null +++ b/MQTTSNGateway/src/tests/mainTestProcessFramework.cpp @@ -0,0 +1,31 @@ +/************************************************************************************** + * Copyright (c) 2016, Tomoaki Yamaguchi + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Tomoaki Yamaguchi - initial API and implementation + **************************************************************************************/ +#include "TestProcessFramework.h" +#include "TestTask.h" + +using namespace MQTTSNGW; + +TestProcessFramework* proc = new TestProcessFramework(); +TestTask* task = new TestTask(proc); + +int main(int argc, char** argv) +{ + proc->initialize(argc, argv); + proc->run(); + delete proc; + return 0; +} + diff --git a/Makefile b/Makefile index 6f33f36..8fee46a 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ APPL := mainGateway LPROGNAME := MQTT-SNLogmonitor LAPPL := mainLogmonitor +TESTPROGNAME := testPFW +TESTAPPL := mainTestProcessFramework + CONFIG := MQTTSNGateway/gateway.conf CLIENTS := MQTTSNGateway/clients.conf @@ -12,6 +15,7 @@ SUBDIR := MQTTSNPacket/src OS := linux SENSORNET := udp +TEST := tests CPPSRCS := \ $(SRCDIR)/MQTTGWConnectionHandler.cpp \ @@ -34,7 +38,10 @@ $(SRCDIR)/MQTTSNGWSubscribeHandler.cpp \ $(SRCDIR)/$(OS)/$(SENSORNET)/SensorNetwork.cpp \ $(SRCDIR)/$(OS)/Timer.cpp \ $(SRCDIR)/$(OS)/Network.cpp \ -$(SRCDIR)/$(OS)/Threading.cpp +$(SRCDIR)/$(OS)/Threading.cpp \ +$(SRCDIR)/$(TEST)/TestProcessFramework.cpp \ +$(SRCDIR)/$(TEST)/TestTask.cpp + CSRCS := $(SUBDIR)/MQTTSNConnectClient.c \ $(SUBDIR)/MQTTSNConnectServer.c \ @@ -51,13 +58,14 @@ $(SUBDIR)/MQTTSNUnsubscribeServer.c CXX := g++ CPPFLAGS += -INCLUDES += -IMQTTSNGateway/src \ --IMQTTSNGateway/src/$(OS) \ --IMQTTSNGateway/src/$(OS)/$(SENSORNET) \ --IMQTTSNPacket/src +INCLUDES += -I$(SRCDIR) \ +-I$(SRCDIR)/$(OS) \ +-I$(SRCDIR)/$(OS)/$(SENSORNET) \ +-I$(SUBDIR) \ +-I$(SRCDIR)/$(TEST) DEFS := -LIBS += +LIBS += -L/usr/local/lib LDFLAGS := CXXFLAGS := -Wall -O3 -std=c++11 LDADD := -lpthread -lssl -lcrypto @@ -65,17 +73,22 @@ OUTDIR := Build PROG := $(OUTDIR)/$(PROGNAME) LPROG := $(OUTDIR)/$(LPROGNAME) +TPROG := $(OUTDIR)/$(TESTPROGNAME) + OBJS := $(CPPSRCS:%.cpp=$(OUTDIR)/%.o) OBJS += $(CSRCS:%.c=$(OUTDIR)/%.o) DEPS := $(CPPSRCS:%.cpp=$(OUTDIR)/%.d) DEPS += $(CSRCS:%.c=$(OUTDIR)/%.d) -.PHONY: install clean +.PHONY: install clean exectest -all: $(PROG) $(LPROG) +all: $(PROG) $(LPROG) $(TPROG) monitor: $(LPROG) +test: $(TPROG) $(LPROG) exectest + + -include $(DEPS) $(PROG): $(OBJS) $(OUTDIR)/$(SRCDIR)/$(APPL).o @@ -84,6 +97,10 @@ $(PROG): $(OBJS) $(OUTDIR)/$(SRCDIR)/$(APPL).o $(LPROG): $(OBJS) $(OUTDIR)/$(SRCDIR)/$(LAPPL).o $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) $(LDADD) +$(TPROG): $(OBJS) $(OUTDIR)/$(SRCDIR)/$(TEST)/$(TESTAPPL).o + $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) $(LDADD) + + $(OUTDIR)/$(SRCDIR)/%.o:$(SRCDIR)/%.cpp @if [ ! -e `dirname $@` ]; then mkdir -p `dirname $@`; fi $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) $(DEFS) -o $@ -c -MMD -MP -MF $(@:%.o=%.d) $< @@ -92,6 +109,10 @@ $(OUTDIR)/$(SRCDIR)/$(APPL).o:$(SRCDIR)/$(APPL).cpp @if [ ! -e `dirname $@` ]; then mkdir -p `dirname $@`; fi $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) $(DEFS) -o $@ -c -MMD -MP -MF $(@:%.o=%.d) $< +$(OUTDIR)/$(SRCDIR)/$(TEST)/$(TESTAPPL).o:$(SRCDIR)/$(TEST)/$(TESTAPPL).cpp + @if [ ! -e `dirname $@` ]; then mkdir -p `dirname $@`; fi + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) $(DEFS) -o $@ -c -MMD -MP -MF $(@:%.o=%.d) $< + $(OUTDIR)/$(SRCDIR)/$(LAPPL).o:$(SRCDIR)/$(LAPPL).cpp @if [ ! -e `dirname $@` ]; then mkdir -p `dirname $@`; fi $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(INCLUDES) $(DEFS) -o $@ -c -MMD -MP -MF $(@:%.o=%.d) $< @@ -108,5 +129,9 @@ install: cp -pf $(LPROG) ../ cp -pf $(CONFIG) ../ cp -pf $(CLIENTS) ../ - + +exectest: + cp -pf $(CONFIG) $(OUTDIR) + cd $(OUTDIR); ./$(TESTPROGNAME) -f ./gateway.conf + \ No newline at end of file