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.
This commit is contained in:
@@ -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 $@
|
||||
|
||||
Reference in New Issue
Block a user