Files
bacnet_stack/apps/mstpcap/Makefile
T
Kari Argillander 369da70f2a Strip tabs and trailing white spaces, and fix end of files (#748)
* format: Strip trailing whitespaces

We want to get rid of trailing whitespaces completly as they make just git
noice. Much better to start using automated tools to get rid of them once and
not getting them back again. This way git history will be cleaner and review
easier.

Commit was generated with:

    pre-commit run --all-files trailing-whitespace

* format: Files should have exactly one new line end of them

It is good practice that every file has one new line. It is not now days so
mandatory but it also is not nice if file has lot of newlines end of it. We will
use pre-commit which takes automatically care about this so let's fix all.

Commit was generated with:

    pre-commit run --all-files end-of-file-fixer

* format: Convert tabs to spaces

Project mostly use spaces over tabs. When mixing tabs and spaces this usually
makes formatting issues and also when changing those in commits it will make lot
of git noise. We will force spaces most of the time and use pre-commit to fix.

Commit was generated with:

    pre-commit run --all-files remove-tabs

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
2024-08-25 14:13:57 -05:00

78 lines
2.1 KiB
Makefile

#Makefile to build BACnet Application
# Executable file name
TARGET = mstpcap
# BACNET_PORT, BACNET_PORT_DIR, BACNET_PORT_SRC are defined in common Makefile
# BACNET_SRC_DIR is defined in common apps Makefile
SRCS = main.c \
${BACNET_PORT_DIR}/rs485.c \
${BACNET_PORT_DIR}/mstimer-init.c \
${BACNET_PORT_DIR}/datetime-init.c \
${BACNET_SRC_DIR}/bacnet/bacdcode.c \
${BACNET_SRC_DIR}/bacnet/bacint.c \
${BACNET_SRC_DIR}/bacnet/bacreal.c \
${BACNET_SRC_DIR}/bacnet/bacstr.c \
${BACNET_SRC_DIR}/bacnet/iam.c \
${BACNET_SRC_DIR}/bacnet/datetime.c \
${BACNET_SRC_DIR}/bacnet/indtext.c \
${BACNET_SRC_DIR}/bacnet/npdu.c \
${BACNET_SRC_DIR}/bacnet/basic/sys/days.c \
${BACNET_SRC_DIR}/bacnet/basic/sys/debug.c \
${BACNET_SRC_DIR}/bacnet/basic/sys/fifo.c \
${BACNET_SRC_DIR}/bacnet/basic/sys/filename.c \
${BACNET_SRC_DIR}/bacnet/basic/sys/mstimer.c \
${BACNET_SRC_DIR}/bacnet/basic/sys/ringbuf.c \
${BACNET_SRC_DIR}/bacnet/datalink/cobs.c \
${BACNET_SRC_DIR}/bacnet/datalink/mstp.c \
${BACNET_SRC_DIR}/bacnet/datalink/mstptext.c \
${BACNET_SRC_DIR}/bacnet/datalink/crc.c
# This demo seems to be a little unique
DEFINES = $(BACNET_DEFINES) -DBACDL_MSTP
# WARNINGS, DEBUGGING, OPTIMIZATION are defined in common apps Makefile
# BACNET_DEFINES is defined in common apps Makefile
# put all the flags together
INCLUDES = -I$(BACNET_SRC_DIR) -I$(BACNET_PORT_DIR)
CFLAGS += $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(BACNET_DEFINES) $(INCLUDES)
# Linker Flags - we don't use any from originating caller
LFLAGS := -Wl,$(SYSTEM_LIB)
# GCC dead code removal
CFLAGS += -ffunction-sections -fdata-sections
ifeq ($(shell uname -s),Darwin)
LFLAGS += -Wl,-dead_strip
else
LFLAGS += -Wl,--gc-sections
endif
# GCC dead code removal
# TARGET_EXT defined in common apps Makefile
TARGET_BIN = ${TARGET}$(TARGET_EXT)
OBJS += ${SRCS:.c=.o}
.PHONY: all
all: Makefile ${TARGET_BIN}
${TARGET_BIN}: ${OBJS} Makefile
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
size $@
cp $@ ../../bin
.c.o:
${CC} -c ${CFLAGS} $*.c -o $@
.PHONY: depend
depend:
rm -f .depend
${CC} -MM ${CFLAGS} *.c >> .depend
.PHONY: clean
clean:
rm -f core ${TARGET_BIN} ${OBJS} $(TARGET).map
.PHONY: include
include: .depend