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
+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