274781a8bc
* Updated the Makefile for mstpcap to accomodate macOS and to build the bacnet lib. Compiling working version of mstpcap on macOS 14, although compiling should work on many earlier versions. The --extcap-interfaces flag now works for macOS which allows one to use mstpcap as an extcap for Wireshark while listing the available serial ports and baud rates. * note: Had to use uname to figure out if one is on Darwin/macOS vs vanilla BSD. From there, macOS specific supported features and location are used. For instance, the 76800 baud rate is natively supported. * note: MacOS doesn't like placing the mstpcap executable in the global extcap plugin directory as it corrupts the Wireshark executable from an xattr and SIP (System Integrity Protection) perspective and macOS will refuse to run it calling it 'corrupt'. One could turn off xattr stuff, using xattr -cr, but could be risky long term. A safer, permissible workaround is to place the executable in the user .local extcap directory: '/Users/<your_user_name>/.local/lib/wireshark/extcap/'. If the directory doesn't exist just create it and copy the executable there. * note: make the executable from the root or apps folder, as there are defines in the apps folder that are common to all the apps. The mstpcap executable is copied to bacnet-stack/bin/ folder. --------- Co-authored-by: Michael O'Neill <em.pee.oh@gmail.com>
78 lines
2.1 KiB
Makefile
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
|