From 15fe7e56c2408513169074a27b3968b205682afb Mon Sep 17 00:00:00 2001 From: ekh Date: Fri, 10 May 2013 19:24:26 +0000 Subject: [PATCH] Allow compilation of BACnet/IP demos in Cygwin in Windows --- bacnet-stack/demo/Makefile | 14 +++++++++++++- bacnet-stack/ports/linux/net.h | 6 ++++++ bacnet-stack/readme.txt | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/bacnet-stack/demo/Makefile b/bacnet-stack/demo/Makefile index 35db4c3b..47fbeab9 100644 --- a/bacnet-stack/demo/Makefile +++ b/bacnet-stack/demo/Makefile @@ -61,10 +61,22 @@ SUBDIRS = readprop writeprop readfile writefile reinit server dcc \ ifeq (${BACDL_DEFINE},-DBACDL_BIP=1) SUBDIRS += whoisrouter iamrouter initrouter readbdt endif -ifeq (${BACNET_PORT},linux) + +# EKH: only include MSTP stuff if building targets MSTP or ALL. This allows us to compile under Cygwin, which has no support for RS485 (yet) +# I searched for a clean way of doing the 'or' operation and the best I could come up with was http://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or +addMSTP= +ifdef BACDL_ALL + addMSTP = true +endif +ifeq (${BACDL_DEFINE},-DBACDL_MSTP=1) + addMSTP = true +endif +ifdef addMSTP # if we want MSTP +ifeq (${BACNET_PORT},linux) # AND we are compiling under linux/cygwin SUBDIRS += mstpcap mstpcrc #SUBDIRS += router endif +endif ifeq (${BACNET_PORT},win32) SUBDIRS += ptransfer mstpcap mstpcrc diff --git a/bacnet-stack/ports/linux/net.h b/bacnet-stack/ports/linux/net.h index 3f1f3ba7..2746d42d 100644 --- a/bacnet-stack/ports/linux/net.h +++ b/bacnet-stack/ports/linux/net.h @@ -75,19 +75,25 @@ #define ENUMS #include +#ifndef __CYGWIN__ #include +#endif #include +#ifndef __CYGWIN__ #include +#endif #include /* for the glibc version number */ #if __GLIBC__ >= 2 && __GLIBC_MINOR >= 1 #include #include /* the L2 protocols */ #else #include +#ifndef __CYGWIN__ #include #include #include #endif +#endif #include #include #include diff --git a/bacnet-stack/readme.txt b/bacnet-stack/readme.txt index 79bba046..0fa6845b 100644 --- a/bacnet-stack/readme.txt +++ b/bacnet-stack/readme.txt @@ -62,7 +62,7 @@ are created that run under Windows or Linux. They use the BACnet/IP datalink layer for communication by default, but could be compiled to use BACnet Ethernet, ARCNET, or MS/TP. -Linux/Unix +Linux/Unix/Cygwin $ make clean all Windows