cleaned up gateway build from Gnu Make by having it build the library again with its own defines, and removed the gateway defines in the various Makefile files.

This commit is contained in:
skarg
2013-04-12 23:12:32 +00:00
parent 2551c69ec8
commit e5dccc0fc0
5 changed files with 43 additions and 49 deletions
+5 -14
View File
@@ -17,9 +17,6 @@ MY_BACNET_DEFINES += -DBACFILE
MY_BACNET_DEFINES += -DINTRINSIC_REPORTING
BACNET_DEFINES ?= $(MY_BACNET_DEFINES)
# un-comment the next line to build the routing demo application
#BACNET_DEFINES += -DBAC_ROUTING
#BACDL_DEFINE=-DBACDL_ETHERNET=1
#BACDL_DEFINE=-DBACDL_ARCNET=1
#BACDL_DEFINE=-DBACDL_MSTP=1
@@ -37,19 +34,10 @@ MAKE_DEFINE ?=
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE) $(BBMD_DEFINE) -DWEAK_FUNC=
DEFINES += $(MAKE_DEFINE)
# directories
# BACnet Ports Directory
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
INCLUDE1 = -I$(BACNET_PORT_DIR) -I$(BACNET_OBJECT) -I$(BACNET_HANDLER)
INCLUDE2 = -I$(BACNET_INCLUDE)
INCLUDES = $(INCLUDE1) $(INCLUDE2)
# Default compiler settings
OPTIMIZATION = -Os
DEBUGGING =
WARNINGS = -Wall -Wmissing-prototypes
@@ -75,6 +63,9 @@ library:
demos:
$(MAKE) -s -C demo all
gateway:
$(MAKE) -B -s -C demo gateway
router:
$(MAKE) -s -C demo router
+13 -16
View File
@@ -21,25 +21,20 @@ BACNET_LIB_TARGET = $(BACNET_LIB_DIR)/lib$(BACNET_LIB_NAME).a
INCLUDE1 = -I$(BACNET_PORT_DIR) -I$(BACNET_OBJECT) -I$(BACNET_HANDLER)
INCLUDE2 = -I$(BACNET_INCLUDE)
INCLUDES = $(INCLUDE1) $(INCLUDE2)
BACNET_LIB=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME)
ifeq (${BACNET_PORT},linux)
PFLAGS = -pthread
TARGET_EXT =
LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME)
LIBRARY2=-lc,-lgcc,-lrt,-lm
LIBRARIES=$(LIBRARY1),$(LIBRARY2)
SYSTEM_LIB=-lc,-lgcc,-lrt,-lm
endif
ifeq (${BACNET_PORT},bsd)
PFLAGS = -pthread
TARGET_EXT =
LIBRARY1=-L$(BACNET_LIB_DIR),-l$(BACNET_LIB_NAME)
LIBRARY2=-lc,-lgcc,-lm
LIBRARIES=$(LIBRARY1),$(LIBRARY2)
SYSTEM_LIB=-lc,-lgcc,-lm
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)
SYSTEM_LIB=-lws2_32,-lgcc,-lm,-liphlpapi,-lwinmm
endif
#build for release (default) or debug
DEBUGGING =
@@ -49,8 +44,8 @@ OPTIMIZATION = -O0
DEBUGGING = -g
endif
# put all the flags together
CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES)
LFLAGS = -Wl,$(LIBRARIES)
CFLAGS := -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES)
LFLAGS := -Wl,$(BACNET_LIB),$(SYSTEM_LIB)
.EXPORT_ALL_VARIABLES:
@@ -70,11 +65,7 @@ ifeq (${BACNET_PORT},win32)
SUBDIRS += ptransfer mstpcap mstpcrc
endif
ifneq (,$(findstring -DBAC_ROUTING,$(BACNET_DEFINES)))
SUBDIRS += gateway
endif
.PHONY : all router clean
.PHONY : all gateway router clean
TARGETS = all clean
@@ -83,5 +74,11 @@ $(TARGETS): %: $(patsubst %, %.%, $(SUBDIRS))
$(foreach TGT, $(TARGETS), $(patsubst %, %.$(TGT), $(SUBDIRS))):
$(MAKE) -s -b -C $(subst ., , $@)
gateway:
$(MAKE) -s -b -C gateway
router:
$(MAKE) -s -b -C router
+8 -6
View File
@@ -9,21 +9,22 @@ TARGET = bacgateway
TARGET_BIN = ${TARGET}$(TARGET_EXT)
# put any overloaded or special built src files here,
# so the linker uses these instead of the functions in the library
SRCS = main.c \
$(BACNET_OBJECT)/gw_device.c \
${CORE_SRC} \
${PORT_SRC} \
${HANDLER_SRC} \
${OBJECT_SRC} \
${ROUTING_SRC}
$(BACNET_HANDLER)/h_routed_npdu.c \
$(BACNET_HANDLER)/s_router.c
OBJS = ${SRCS:.c=.o}
DEFINES += -DBAC_ROUTING
CFLAGS = $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES)
all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN}
${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET}
${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET}
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
size $@
cp $@ ../../bin
@@ -44,3 +45,4 @@ clean:
rm -f core ${TARGET_BIN} ${OBJS} ${BACNET_LIB_TARGET} $(TARGET).map
include: .depend
+1 -1
View File
@@ -410,7 +410,7 @@ bool Routed_Device_Name(
pDev->bacObj.Object_Name);
}
return FALSE;
return false;
}
/** Manages ReadProperty service for fields which are different for routed
+16 -12
View File
@@ -9,6 +9,17 @@
#
# Assumes rm and cp are available
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
INCLUDE1 = -I$(BACNET_PORT_DIR) -I$(BACNET_OBJECT) -I$(BACNET_HANDLER)
INCLUDE2 = -I$(BACNET_INCLUDE)
INCLUDES = $(INCLUDE1) $(INCLUDE2)
# target
TARGET = bacnet
LIBRARY = lib$(TARGET).a
@@ -103,11 +114,11 @@ HANDLER_SRC = \
$(BACNET_HANDLER)/s_cov.c \
$(BACNET_HANDLER)/s_ptransfer.c \
$(BACNET_HANDLER)/s_rd.c \
$(BACNET_HANDLER)/s_router.c \
$(BACNET_HANDLER)/s_rp.c \
$(BACNET_HANDLER)/s_rpm.c \
$(BACNET_HANDLER)/s_ts.c \
$(BACNET_HANDLER)/s_cevent.c \
$(BACNET_HANDLER)/s_router.c \
$(BACNET_HANDLER)/s_uevent.c \
$(BACNET_HANDLER)/s_whohas.c \
$(BACNET_HANDLER)/s_whois.c \
@@ -183,20 +194,13 @@ ifdef BACDL_ALL
PORT_SRC = ${PORT_ALL_SRC}
endif
ifneq (,$(findstring -DBAC_ROUTING,$(BACNET_DEFINES)))
ROUTING_SRC = \
$(BACNET_HANDLER)/h_routed_npdu.c \
$(BACNET_HANDLER)/s_router.c \
$(BACNET_OBJECT)/gw_device.c
else
ROUTING_SRC =
endif
SRCS = ${CORE_SRC} ${PORT_SRC} ${HANDLER_SRC} ${OBJECT_SRC} ${ROUTING_SRC}
SRCS = ${CORE_SRC} ${PORT_SRC} ${HANDLER_SRC} ${OBJECT_SRC}
OBJS = ${SRCS:.c=.o}
# use local includes, but other values from calling Makefile
CFLAGS = $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES)
all: $(LIBRARY)
lib: $(LIBRARY)