Fixed makefile for building the Linux router application. (#585)

* Fixed Makefile for building the Linux router application.
This commit is contained in:
Steve Karg
2024-02-28 17:08:00 -06:00
committed by GitHub
parent 1176b0d966
commit 5c55683f86
6 changed files with 43 additions and 9 deletions
+1 -1
View File
@@ -403,7 +403,7 @@ writefile: $(BACNET_LIB_TARGET)
$(MAKE) -B -C $@
.PHONY: router
router: $(BACNET_LIB_TARGET)
router:
$(MAKE) -B -C $@
.PHONY: router-ipv6
+11 -6
View File
@@ -1,4 +1,6 @@
#Makefile to build BACnet Application for the Linux Port
# Note: requires libconfig-dev to be installed
# sudo apt-get install -qq libconfig-dev
# tools - only if you need them.
# Most platforms have this already defined
@@ -10,14 +12,11 @@ TARGET = router
TARGET_BIN = ${TARGET}$(TARGET_EXT)
ifeq (${BACNET_PORT},linux)
#PFLAGS =
# -pthread
TARGET_EXT =
LIBS = -lpthread -lconfig -lm
LFLAGS += $(LIBS)
LFLAGS = $(LIBS)
endif
#DEFINES = $(BACNET_DEFINES) -DBACDL_MSTP -DBACDL_BIP
SOURCE_DIR = ../../src
BACNET_SOURCE_DIR = ${SOURCE_DIR}/bacnet
@@ -42,20 +41,26 @@ SRCS = main.c \
${BACNET_SOURCE_DIR}/bacstr.c \
${BACNET_SOURCE_DIR}/npdu.c \
${BACNET_SOURCE_DIR}/bacaddr.c \
${BACNET_SOURCE_DIR}/hostnport.c \
mstpmodule.c \
ipmodule.c \
portthread.c \
msgqueue.c \
network_layer.c
CFLAGS += -I${SOURCE_DIR} -I${BACNET_PORT_DIR}
# note: router does not use common libbacnet.a library,
# so use CFLAGS without common app defines or includes
CFLAGS = -I${SOURCE_DIR} -I${BACNET_PORT_DIR}
CFLAGS += -DBACNET_STACK_DEPRECATED_DISABLE
CFLAGS += -std=gnu99
CFLAGS += $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION)
OBJS = ${SRCS:.c=.o}
all: Makefile ${TARGET_BIN}
${TARGET_BIN}: ${OBJS} Makefile
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
${CC} ${OBJS} ${LFLAGS} -o $@
size $@
cp $@ ../../bin
+8 -1
View File
@@ -517,6 +517,8 @@ bool parse_cmd(int argc, char *argv[])
current->route_info.net = port_count;
}
break;
default:
break;
}
dev_opt =
getopt_long(argc, argv, bipString, Options, &index);
@@ -620,6 +622,8 @@ bool parse_cmd(int argc, char *argv[])
current->route_info.net = (uint16_t)result;
}
break;
default:
break;
}
dev_opt = getopt_long(
argc, argv, mstpString, Options, &index);
@@ -630,6 +634,8 @@ bool parse_cmd(int argc, char *argv[])
return false;
}
break;
default:
break;
}
}
return true;
@@ -648,8 +654,9 @@ void init_port_threads(ROUTER_PORT *port_list)
case MSTP:
port->func = &dl_mstp_thread;
break;
default:
break;
}
port->state = INIT;
thread = (pthread_t *)malloc(sizeof(pthread_t));
pthread_create(thread, NULL, port->func, port);
+2
View File
@@ -116,6 +116,8 @@ uint16_t process_network_message(BACMSG *msg, MSG_DATA *data, uint8_t **buff)
case 4:
PRINT(ERROR, "Error: Message too long\n");
break;
default:
break;
}
break;
}