From 6a523e4d23c71477c7f3b93ace3852832b14af47 Mon Sep 17 00:00:00 2001 From: bacpack Date: Thu, 25 Nov 2010 04:17:58 +0000 Subject: [PATCH] First attempt to clean-up Makefiles. 1. Top (main) makefile defines build configuration variables and export them for sub-makes to use. BAC_ROUTING is defined here - is has been removed from config.h. 2. A new makefile has been added in demo subdirectory. It builds the demo applications. NOTE: the 'ports' target is not build. --- bacnet-stack/Makefile | 158 +++++++------------------ bacnet-stack/demo/Makefile | 69 +++++++++++ bacnet-stack/demo/dcc/Makefile | 44 +------ bacnet-stack/demo/epics/Makefile | 44 +------ bacnet-stack/demo/gateway/Makefile | 55 +-------- bacnet-stack/demo/iamrouter/Makefile | 44 +------ bacnet-stack/demo/initrouter/Makefile | 44 +------ bacnet-stack/demo/mstpcap/Makefile | 37 +----- bacnet-stack/demo/readfile/Makefile | 43 +------ bacnet-stack/demo/readprop/Makefile | 43 +------ bacnet-stack/demo/readpropm/Makefile | 43 +------ bacnet-stack/demo/reinit/Makefile | 44 +------ bacnet-stack/demo/server/Makefile | 55 +-------- bacnet-stack/demo/timesync/Makefile | 44 +------ bacnet-stack/demo/ucov/Makefile | 44 +------ bacnet-stack/demo/whohas/Makefile | 44 +------ bacnet-stack/demo/whois/Makefile | 45 +------ bacnet-stack/demo/whoisrouter/Makefile | 44 +------ bacnet-stack/demo/writefile/Makefile | 44 +------ bacnet-stack/demo/writeprop/Makefile | 48 +------- bacnet-stack/include/config.h | 3 - bacnet-stack/lib/Makefile | 36 +----- 22 files changed, 172 insertions(+), 903 deletions(-) create mode 100644 bacnet-stack/demo/Makefile diff --git a/bacnet-stack/Makefile b/bacnet-stack/Makefile index 441efa0b..c7ac8ad1 100644 --- a/bacnet-stack/Makefile +++ b/bacnet-stack/Makefile @@ -1,124 +1,56 @@ -# Main Makefile for BACnet-stack project +# Main Makefile for BACnet-stack project with GCC -# Including "routing" in this list to add routing functionality -all: library readprop writeprop readfile writefile reinit server dcc \ - whohas whois ucov timesync epics readpropm mstpcap \ - routing - @echo "utilities are in the bin directory" +# tools - only if you need them. +# Most platforms have this already defined +# CC = gcc +# AR = ar -clean: lib/Makefile\ - demo/readprop/Makefile \ - demo/readpropm/Makefile \ - demo/writeprop/Makefile \ - demo/readfile/Makefile \ - demo/writefile/Makefile \ - demo/reinit/Makefile \ - demo/server/Makefile \ - demo/dcc/Makefile \ - demo/whohas/Makefile \ - demo/whois/Makefile \ - demo/ucov/Makefile \ - demo/timesync/Makefile \ - demo/epics/Makefile \ - demo/whoisrouter/Makefile \ - demo/iamrouter/Makefile \ - demo/initrouter/Makefile \ - demo/mstpcap/Makefile \ - demo/gateway/Makefile - make -C lib clean - make -C demo/readprop clean - make -C demo/readpropm clean - make -C demo/writeprop clean - make -C demo/readfile clean - make -C demo/writefile clean - make -C demo/reinit clean - make -C demo/server clean - make -C demo/dcc clean - make -C demo/whohas clean - make -C demo/whois clean - make -C demo/ucov clean - make -C demo/timesync clean - make -C demo/epics clean - make -C demo/whoisrouter clean - make -C demo/iamrouter clean - make -C demo/initrouter clean - make -C demo/mstpcap clean - make -C demo/gateway clean +# configuration +BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL -DBACFILE +# for now 1 and 0 are used to build or not to build the routing demo +BACNET_DEFINES += -DBAC_ROUTING=1 -library: lib/Makefile - make -C lib all +#BACDL_DEFINE=-DBACDL_ETHERNET=1 +#BACDL_DEFINE=-DBACDL_ARCNET=1 +#BACDL_DEFINE=-DBACDL_MSTP=1 +BACDL_DEFINE=-DBACDL_BIP=1 -readprop: demo/readprop/Makefile - ( cd demo/readprop ; make ; cp bacrp ../../bin ) +DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) -DWEAK_FUNC= -readpropm: demo/readpropm/Makefile - ( cd demo/readpropm ; make ; cp bacrpm ../../bin ) +# directories +BACNET_PORT = linux +BACNET_PORT_DIR = ../ports/${BACNET_PORT} -writeprop: demo/writeprop/Makefile - ( cd demo/writeprop ; make ; cp bacwp ../../bin ) +BACNET_OBJECT = ../demo/object +BACNET_HANDLER = ../demo/handler +BACNET_CORE = ../src +BACNET_INCLUDE = ../include +# compiler configuration +#STANDARDS = -std=c99 +INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -I$(BACNET_OBJECT) -I$(BACNET_HANDLER) +OPTIMIZATION = -Os +DEBUGGING = +WARNINGS = -Wall -Wmissing-prototypes +ifeq (${BUILD},debug) +OPTIMIZATION = -O0 +DEBUGGING = -g -DDEBUG_ENABLED=1 +ifeq (${BACDL_DEFINE},-DBACDL_BIP=1) +DEFINES += -DBIP_DEBUG +endif +endif +CFLAGS = $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES) -readfile: demo/readfile/Makefile - ( cd demo/readfile ; make ; cp bacarf ../../bin ) +.EXPORT_ALL_VARIABLES: -writefile: demo/writefile/Makefile - ( cd demo/writefile ; make ; cp bacawf ../../bin ) - -reinit: demo/reinit/Makefile - ( cd demo/reinit ; make ; cp bacrd ../../bin ) - -server: demo/server/Makefile - ( cd demo/server ; make ; cp bacserv ../../bin ) - -dcc: demo/dcc/Makefile - ( cd demo/dcc ; make ; cp bacdcc ../../bin ) - -whohas: demo/whohas/Makefile - ( cd demo/whohas ; make ; cp bacwh ../../bin ) - -timesync: demo/timesync/Makefile - ( cd demo/timesync ; make ; cp bacts ../../bin ) - -epics: demo/epics/Makefile - ( cd demo/epics ; make ; cp bacepics ../../bin ) - -ucov: demo/ucov/Makefile - ( cd demo/ucov ; make ; cp bacucov ../../bin ) - -whois: demo/whois/Makefile - ( cd demo/whois ; make ; cp bacwi ../../bin ) - -mstpcap: demo/mstpcap/Makefile - ( cd demo/mstpcap ; make clean all; cp mstpcap ../../bin ) - -# Add "ports" to the build, if desired -ports: atmega168 bdk-atxx4-mstp at91sam7s - @echo "Built the ports" - -atmega168: ports/atmega168/Makefile - make -C ports/atmega168 clean all - -at91sam7s: ports/at91sam7s/makefile - make -C ports/at91sam7s clean all - -bdk-atxx4-mstp: ports/bdk-atxx4-mstp/Makefile - make -C ports/bdk-atxx4-mstp clean all - -# Build these demo projects if you want to test routing capability -# Also enable BACROUTE_ENABLE in lib/Makefile and BAC_ROUTING in config.h -routing: whoisrouter iamrouter initrouter gateway - @echo "Built routing demos" - -whoisrouter: demo/whoisrouter/Makefile - ( cd demo/whoisrouter ; make ; cp bacwir ../../bin ) - -iamrouter: demo/iamrouter/Makefile - ( cd demo/iamrouter ; make ; cp baciamr ../../bin ) - -initrouter: demo/initrouter/Makefile - ( cd demo/initrouter ; make ; cp bacinitr ../../bin ) - -gateway: demo/gateway/Makefile - ( cd demo/gateway ; make ; cp bacgateway ../../bin ) +all: library demos +.PHONY : all library demos clean +library: + $(MAKE) -C lib all +demos: + $(MAKE) -C demo all +clean: + $(MAKE) -C lib clean + $(MAKE) -C demo clean diff --git a/bacnet-stack/demo/Makefile b/bacnet-stack/demo/Makefile new file mode 100644 index 00000000..c190acaf --- /dev/null +++ b/bacnet-stack/demo/Makefile @@ -0,0 +1,69 @@ + +# Directories +BACNET_PORT = linux +BACNET_PORT_DIR = ../../ports/${BACNET_PORT} +BACNET_INCLUDE = ../../include +# BACnet Library +BACNET_LIB_DIR = ../../lib +BACNET_LIB_NAME = bacnet +BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a +# Compiler Setup +INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) +ifeq (${BACNET_PORT},linux) +PFLAGS = -pthread +TARGET_EXT = +LIBRARIES=-lc,-lgcc,-lrt,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) +endif +ifeq (${BACNET_PORT},win32) +TARGET_EXT = .exe +LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) +LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm +LIBRARIES=$(LIBRARY1),$(LIBRARY2) +endif +#build for release (default) or debug +DEBUGGING = +OPTIMIZATION = -Os +ifeq (${BUILD},debug) +OPTIMIZATION = -O0 +DEBUGGING = -g +endif +# put all the flags together +CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) +LFLAGS = -Wl,$(LIBRARIES) + +.EXPORT_ALL_VARIABLES: + +SUBDIRS = readprop writeprop readfile writefile reinit server dcc \ + whohas whois ucov timesync epics readpropm mstpcap + +ifneq (,$(findstring BAC_ROUTING=1,$(BACNET_DEFINES))) + SUBDIRS += whoisrouter iamrouter initrouter gateway +endif + + +.PHONY : all $(SUBDIRS) clean + +all : $(SUBDIRS) + @echo "utilities are in the bin directory" + +$(SUBDIRS) : + $(MAKE) -C $@ + +clean : + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done + +# Add "ports" to the build, if desired +ports: atmega168 bdk-atxx4-mstp at91sam7s + @echo "Built the ports" + +atmega168: ports/atmega168/Makefile + make -C ports/atmega168 clean all + +at91sam7s: ports/at91sam7s/makefile + make -C ports/at91sam7s clean all + +bdk-atxx4-mstp: ports/bdk-atxx4-mstp/Makefile + make -C ports/bdk-atxx4-mstp clean all + diff --git a/bacnet-stack/demo/dcc/Makefile b/bacnet-stack/demo/dcc/Makefile index c22e86f0..7db89e50 100644 --- a/bacnet-stack/demo/dcc/Makefile +++ b/bacnet-stack/demo/dcc/Makefile @@ -6,56 +6,18 @@ TARGET = bacdcc -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME),-lc,-lgcc,-lm -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/epics/Makefile b/bacnet-stack/demo/epics/Makefile index 45103323..853ae6af 100644 --- a/bacnet-stack/demo/epics/Makefile +++ b/bacnet-stack/demo/epics/Makefile @@ -6,56 +6,18 @@ TARGET = bacepics -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_SOURCE = ../../src -BACNET_INCLUDE = ../../include -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME),-lc,-lgcc,-lm -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -DDEBUG_ENABLED=1 -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/gateway/Makefile b/bacnet-stack/demo/gateway/Makefile index a4b7ebf8..7a7f38da 100644 --- a/bacnet-stack/demo/gateway/Makefile +++ b/bacnet-stack/demo/gateway/Makefile @@ -7,67 +7,18 @@ # Executable file name TARGET = bacgateway -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET -#BACDL_DEFINE = -DBACDL_ARCNET -#BACDL_DEFINE = -DBACDL_MSTP -BACDL_DEFINE = -DBACDL_BIP -BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL -DBACFILE -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lrt,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif - -#build for release (default) or debug -ifeq (${BUILD},debug) -# Use -g to put info for gdb in the executable -DEBUGGING = -g -DDEBUG_ENABLED=1 -OPTIMIZATION = -O0 -LINK_OPTIMIZATION = -ifeq (${BACDL_DEFINE},-DBACDL_BIP=1) -DEFINES += -DBIP_DEBUG -endif -else -DEBUGGING = -# Use -f optimizations and then link option --gc-sections to reduce executable size. -# Of course, not when you want debug output for gdb! -OPTIMIZATION = -Os -fdata-sections -ffunction-sections -LINK_OPTIMIZATION = -Wl,--gc-sections -endif - -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) $(LINK_OPTIMIZATION) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/iamrouter/Makefile b/bacnet-stack/demo/iamrouter/Makefile index 5ea72554..b3c3d05e 100644 --- a/bacnet-stack/demo/iamrouter/Makefile +++ b/bacnet-stack/demo/iamrouter/Makefile @@ -6,56 +6,18 @@ TARGET = baciamr -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/initrouter/Makefile b/bacnet-stack/demo/initrouter/Makefile index 357494d8..cc0439f7 100644 --- a/bacnet-stack/demo/initrouter/Makefile +++ b/bacnet-stack/demo/initrouter/Makefile @@ -6,56 +6,18 @@ TARGET = bacinitr -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/mstpcap/Makefile b/bacnet-stack/demo/mstpcap/Makefile index d228a834..b60fb66f 100644 --- a/bacnet-stack/demo/mstpcap/Makefile +++ b/bacnet-stack/demo/mstpcap/Makefile @@ -7,39 +7,11 @@ # Executable file name TARGET = mstpcap -# Configure the BACnet Datalink Layer -BACDL_DEFINE = -DBACDL_MSTP -BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL -DBACFILE -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) +TARGET_BIN = ${TARGET}$(TARGET_EXT) -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} +# This demo seems to be a little unique +DEFINES = $(BACNET_DEFINES) -DBACDL_MSTP BACNET_SOURCE_DIR = ../../src -BACNET_INCLUDE = ../../include - -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lrt,-lm -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARIES=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -CFLAGS += -fdata-sections -ffunction-sections -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES),--gc-sections SRCS = main.c \ ${BACNET_PORT_DIR}/rs485.c \ @@ -54,10 +26,11 @@ SRCS = main.c \ OBJS = ${SRCS:.c=.o} all: Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin .c.o: ${CC} -c ${CFLAGS} $*.c -o $@ diff --git a/bacnet-stack/demo/readfile/Makefile b/bacnet-stack/demo/readfile/Makefile index 9a654067..cd272bc3 100644 --- a/bacnet-stack/demo/readfile/Makefile +++ b/bacnet-stack/demo/readfile/Makefile @@ -6,55 +6,18 @@ TARGET = bacarf -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME),-lc,-lgcc,-lm -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/readprop/Makefile b/bacnet-stack/demo/readprop/Makefile index 97f05d07..7d58fb51 100644 --- a/bacnet-stack/demo/readprop/Makefile +++ b/bacnet-stack/demo/readprop/Makefile @@ -7,55 +7,18 @@ # Executable file name TARGET = bacrp -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/readpropm/Makefile b/bacnet-stack/demo/readpropm/Makefile index 58e5eb85..0e2f47d4 100644 --- a/bacnet-stack/demo/readpropm/Makefile +++ b/bacnet-stack/demo/readpropm/Makefile @@ -7,55 +7,18 @@ # Executable file name TARGET = bacrpm -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/reinit/Makefile b/bacnet-stack/demo/reinit/Makefile index f056879e..bdcbe2b1 100644 --- a/bacnet-stack/demo/reinit/Makefile +++ b/bacnet-stack/demo/reinit/Makefile @@ -7,56 +7,18 @@ # Executable file name TARGET = bacrd -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/server/Makefile b/bacnet-stack/demo/server/Makefile index 5760cc58..f32e9a5b 100644 --- a/bacnet-stack/demo/server/Makefile +++ b/bacnet-stack/demo/server/Makefile @@ -7,67 +7,18 @@ # Executable file name TARGET = bacserv -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET -#BACDL_DEFINE = -DBACDL_ARCNET -#BACDL_DEFINE = -DBACDL_MSTP -BACDL_DEFINE = -DBACDL_BIP -BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL -DBACFILE -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lrt,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif - -#build for release (default) or debug -ifeq (${BUILD},debug) -# Use -g to put info for gdb in the executable -DEBUGGING = -g -DDEBUG_ENABLED=1 -OPTIMIZATION = -O0 -LINK_OPTIMIZATION = -ifeq (${BACDL_DEFINE},-DBACDL_BIP=1) -DEFINES += -DBIP_DEBUG -endif -else -DEBUGGING = -# Use -f optimizations and then link option --gc-sections to reduce executable size. -# Of course, not when you want debug output for gdb! -OPTIMIZATION = -Os -fdata-sections -ffunction-sections -LINK_OPTIMIZATION = -Wl,--gc-sections -endif - -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) $(LINK_OPTIMIZATION) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/timesync/Makefile b/bacnet-stack/demo/timesync/Makefile index e460ce95..afa3f7a1 100644 --- a/bacnet-stack/demo/timesync/Makefile +++ b/bacnet-stack/demo/timesync/Makefile @@ -7,56 +7,18 @@ # Executable file name TARGET = bacts -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/ucov/Makefile b/bacnet-stack/demo/ucov/Makefile index 33951206..5a5e5ec9 100644 --- a/bacnet-stack/demo/ucov/Makefile +++ b/bacnet-stack/demo/ucov/Makefile @@ -7,56 +7,18 @@ # Executable file name TARGET = bacucov -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/whohas/Makefile b/bacnet-stack/demo/whohas/Makefile index 18e1b26e..bfdae683 100644 --- a/bacnet-stack/demo/whohas/Makefile +++ b/bacnet-stack/demo/whohas/Makefile @@ -7,56 +7,18 @@ # Executable file name TARGET = bacwh -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/whois/Makefile b/bacnet-stack/demo/whois/Makefile index 16fb8db6..aa4abd6c 100644 --- a/bacnet-stack/demo/whois/Makefile +++ b/bacnet-stack/demo/whois/Makefile @@ -6,57 +6,18 @@ TARGET = bacwi -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -#BACDL_DEFINE = -DBACDL_BIP=1 -DBIP_DEBUG -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/whoisrouter/Makefile b/bacnet-stack/demo/whoisrouter/Makefile index 935933fa..7563f2b1 100644 --- a/bacnet-stack/demo/whoisrouter/Makefile +++ b/bacnet-stack/demo/whoisrouter/Makefile @@ -6,56 +6,18 @@ TARGET = bacwir -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/writefile/Makefile b/bacnet-stack/demo/writefile/Makefile index 323aff27..707ab3ba 100644 --- a/bacnet-stack/demo/writefile/Makefile +++ b/bacnet-stack/demo/writefile/Makefile @@ -7,56 +7,18 @@ # Executable file name TARGET = bacawf -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/demo/writeprop/Makefile b/bacnet-stack/demo/writeprop/Makefile index 64da5471..a92db403 100644 --- a/bacnet-stack/demo/writeprop/Makefile +++ b/bacnet-stack/demo/writeprop/Makefile @@ -7,60 +7,18 @@ # Executable file name TARGET = bacwp -# Configure the BACnet Datalink Layer -#BACDL_DEFINE = -DBACDL_ETHERNET=1 -#BACDL_DEFINE = -DBACDL_ARCNET=1 -#BACDL_DEFINE = -DBACDL_MSTP=1 -BACDL_DEFINE = -DBACDL_BIP=1 -BACNET_DEFINES = -DBACFILE=1 -DPRINT_ENABLED=1 -DBACAPP_ALL - -# by default bacwp can handle 64 tag/value pairs -#WRITEPROPS_DEFINE = -DMAX_PROPERTY_VALUES=64 - -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) $(WRITEPROPS_DEFINE) - -# Directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../../ports/${BACNET_PORT} -BACNET_INCLUDE = ../../include - -# BACnet Library -BACNET_LIB_DIR = ../../lib -BACNET_LIB_NAME = bacnet -BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a -# Compiler Setup -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -ifeq (${BACNET_PORT},linux) -PFLAGS = -pthread -TARGET_BIN = ${TARGET} -LIBRARIES=-lc,-lgcc,-lm,-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -endif -ifeq (${BACNET_PORT},win32) -TARGET_BIN = ${TARGET}.exe -LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME) -LIBRARY2=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm -LIBRARIES=$(LIBRARY1),$(LIBRARY2) -endif -#build for release (default) or debug -DEBUGGING = -OPTIMIZATION = -Os -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -endif -# put all the flags together -CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES) -LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES) +TARGET_BIN = ${TARGET}$(TARGET_EXT) SRCS = main.c OBJS = ${SRCS:.c=.o} all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN} - size ${TARGET_BIN} ${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET} ${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@ + size $@ + cp $@ ../../bin lib: ${BACNET_LIB_TARGET} diff --git a/bacnet-stack/include/config.h b/bacnet-stack/include/config.h index b23c719c..89a69f25 100644 --- a/bacnet-stack/include/config.h +++ b/bacnet-stack/include/config.h @@ -46,9 +46,6 @@ #endif /* Enable the Gateway (Routing) functionality here, if desired. */ -#if !defined(BAC_ROUTING) -#define BAC_ROUTING 1 -#endif #if !defined(MAX_NUM_DEVICES) #if BAC_ROUTING #define MAX_NUM_DEVICES 3 /* Eg, Gateway + two remote devices */ diff --git a/bacnet-stack/lib/Makefile b/bacnet-stack/lib/Makefile index d5e57a57..b3dd0fd8 100644 --- a/bacnet-stack/lib/Makefile +++ b/bacnet-stack/lib/Makefile @@ -9,39 +9,6 @@ TARGET = bacnet LIBRARY = lib$(TARGET).a -# configuration -BACNET_DEFINES=-DPRINT_ENABLED=1 -DBACAPP_ALL -DBACFILE -#BACDL_DEFINE=-DBACDL_ETHERNET=1 -#BACDL_DEFINE=-DBACDL_ARCNET=1 -#BACDL_DEFINE=-DBACDL_MSTP=1 -BACDL_DEFINE=-DBACDL_BIP=1 -# Enable (or else don't define it) Routing functionality -# (also enable BAC_ROUTING in config.h and "routes" in main Makefile) -BACROUTE_ENABLE=y - -DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) -# directories -BACNET_PORT = linux -BACNET_PORT_DIR = ../ports/${BACNET_PORT} - -BACNET_OBJECT = ../demo/object -BACNET_HANDLER = ../demo/handler -BACNET_CORE = ../src -BACNET_INCLUDE = ../include -# compiler configuration -#STANDARDS = -std=c99 -INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -I$(BACNET_OBJECT) -I$(BACNET_HANDLER) -OPTIMIZATION = -Os -DEBUGGING = -WARNINGS = -Wall -Wmissing-prototypes -ifeq (${BUILD},debug) -OPTIMIZATION = -O0 -DEBUGGING = -g -DDEBUG_ENABLED=1 -ifeq (${BACDL_DEFINE},-DBACDL_BIP=1) -DEFINES += -DBIP_DEBUG -endif -endif -CFLAGS = $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES) CORE_SRC = \ $(BACNET_CORE)/apdu.c \ @@ -193,7 +160,8 @@ ifdef BACDL_ALL PORT_SRC = ${PORT_ALL_SRC} endif -ifdef BACROUTE_ENABLE + +ifneq (,$(findstring BAC_ROUTING=1,$(BACNET_DEFINES))) ROUTING_SRC = \ $(BACNET_HANDLER)/h_routed_npdu.c \ $(BACNET_HANDLER)/s_router.c \