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