2017-05-19 01:02:19 +02:00
|
|
|
PKG_NAME=openthread
|
|
|
|
PKG_URL=https://github.com/openthread/openthread.git
|
2019-05-16 23:08:30 +02:00
|
|
|
PKG_VERSION=thread-reference-20180926
|
2019-10-04 13:50:44 +02:00
|
|
|
PKG_LICENSE=BSD-3-Clause
|
2018-09-25 17:29:04 +02:00
|
|
|
PKG_BUILDDIR ?= $(PKGDIRBASE)/$(PKG_NAME)
|
2017-05-19 01:02:19 +02:00
|
|
|
|
2019-10-02 12:47:02 +02:00
|
|
|
include $(RIOTBASE)/pkg/pkg.mk
|
|
|
|
|
2019-05-08 14:44:38 +02:00
|
|
|
ifneq (,$(filter openthread-ftd,$(USEMODULE)))
|
|
|
|
TD = ftd
|
2018-06-12 17:40:27 +02:00
|
|
|
$(info Compile OpenThread for FTD device)
|
2019-05-08 14:44:38 +02:00
|
|
|
else ifneq (,$(filter openthread-mtd,$(USEMODULE)))
|
2018-06-12 17:40:27 +02:00
|
|
|
$(info Compile OpenThread for MTD device)
|
2019-05-08 14:44:38 +02:00
|
|
|
TD = mtd
|
|
|
|
JOINER_ARG = --enable-joiner
|
|
|
|
else
|
|
|
|
$(error "Please use either USEMODULE=openthread-ftd or USEMODULE=openthread-mtd")
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq (,$(filter openthread-cli,$(USEMODULE)))
|
2019-05-16 23:08:30 +02:00
|
|
|
CLI_ARG = --enable-cli --enable-$(TD)
|
2018-06-12 17:40:27 +02:00
|
|
|
endif
|
2019-05-08 14:44:38 +02:00
|
|
|
|
|
|
|
OPENTHREAD_ARGS += $(CLI_ARG) $(JOINER_ARG) --enable-application-coap
|
2018-06-12 17:40:27 +02:00
|
|
|
CONFIG_FILE = OPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"platform_config.h\"'
|
|
|
|
$(info $$OPENTHREAD_ARGS is [${OPENTHREAD_ARGS}])
|
2017-05-19 01:02:19 +02:00
|
|
|
|
2018-02-22 09:14:25 +01:00
|
|
|
OPENTHREAD_COMMON_FLAGS = -fdata-sections -ffunction-sections -Os
|
2018-06-12 17:40:27 +02:00
|
|
|
OPENTHREAD_COMMON_FLAGS += -Wno-implicit-fallthrough -Wno-unused-parameter
|
2020-02-24 14:12:13 +01:00
|
|
|
OPENTHREAD_CXXFLAGS += -Wno-class-memaccess
|
2018-02-22 09:14:25 +01:00
|
|
|
|
2019-06-27 15:18:37 +02:00
|
|
|
all:
|
2017-05-19 01:02:19 +02:00
|
|
|
cd $(PKG_BUILDDIR) && PREFIX="/" ./bootstrap
|
|
|
|
cd $(PKG_BUILDDIR) && CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)"\
|
|
|
|
OBJC="" OBJCXX="" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" \
|
|
|
|
STRIP="$(STRIP)" \
|
2018-06-12 17:40:27 +02:00
|
|
|
CPPFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(CFLAGS_CPU) -D$(CONFIG_FILE)" \
|
2017-05-19 01:02:19 +02:00
|
|
|
CFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(CFLAGS_CPU) " \
|
2020-02-24 14:12:13 +01:00
|
|
|
CXXFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(OPENTHREAD_CXXFLAGS) \
|
|
|
|
$(CFLAGS_CPU) -fno-exceptions -fno-rtti " \
|
2017-05-19 01:02:19 +02:00
|
|
|
LDFLAGS="$(OPENTHREAD_COMMON_FLAGS) $(CFLAGS_CPU) -nostartfiles -specs=nano.specs \
|
|
|
|
-specs=nosys.specs -Wl,--gc-sections -Wl,-Map=map.map " \
|
|
|
|
./configure --disable-docs --host=$(TARGET_ARCH) --target=$(TARGET_ARCH) \
|
2018-03-22 09:12:12 +01:00
|
|
|
--prefix=/ --enable-default-logging $(OPENTHREAD_ARGS)
|
2017-05-19 01:02:19 +02:00
|
|
|
cd $(PKG_BUILDDIR) && DESTDIR=$(PKG_BUILDDIR)/output PREFIX=/ make -j4 --no-print-directory install
|
|
|
|
|
2018-06-12 17:40:27 +02:00
|
|
|
cp $(PKG_BUILDDIR)/output/lib/libmbedcrypto.a ${BINDIR}/mbedcrypto.a
|
2019-05-08 14:44:38 +02:00
|
|
|
|
|
|
|
cp $(PKG_BUILDDIR)/output/lib/libopenthread-$(TD).a ${BINDIR}/openthread-$(TD).a
|
|
|
|
ifneq (,$(filter openthread-cli,$(USEMODULE)))
|
|
|
|
cp $(PKG_BUILDDIR)/output/lib/libopenthread-cli-$(TD).a ${BINDIR}/openthread-cli.a
|
2018-06-12 17:40:27 +02:00
|
|
|
endif
|