mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 04:52:59 +01:00
pkg: introduce nanoPb Protocol Buffers library
This commit is contained in:
parent
4c3d473e4e
commit
cd18dad5ca
@ -52,8 +52,8 @@ ifeq ($(strip $(ASSMSRC))$(NO_AUTO_SRC),)
|
|||||||
ASSMSRC := $(wildcard *.S)
|
ASSMSRC := $(wildcard *.S)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# include makefile snippets that modify GENSRC here:
|
# include makefile snippets for packages in $(USEPKG) that modify GENSRC:
|
||||||
#include foo/bar.inc.mk
|
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.gensrc)
|
||||||
|
|
||||||
GENOBJC := $(GENSRC:%.c=%.o)
|
GENOBJC := $(GENSRC:%.c=%.o)
|
||||||
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)
|
OBJC_LTO := $(SRC:%.c=$(BINDIR)/$(MODULE)/%.o)
|
||||||
|
11
pkg/nanopb/Makefile
Normal file
11
pkg/nanopb/Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
PKG_NAME=nanopb
|
||||||
|
PKG_URL=https://github.com/nanopb/nanopb
|
||||||
|
PKG_VERSION=493adf3616bee052649c63c473f8355630c2797f # nanopb-0.3.9.4
|
||||||
|
PKG_LICENSE=MIT
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
all: git-download
|
||||||
|
"$(MAKE)" -C $(PKG_BUILDDIR) -f $(CURDIR)/Makefile.nanopb
|
||||||
|
|
||||||
|
include $(RIOTBASE)/pkg/pkg.mk
|
23
pkg/nanopb/Makefile.gensrc
Normal file
23
pkg/nanopb/Makefile.gensrc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
PROTOC ?= protoc
|
||||||
|
PROTOC_GEN_NANOPB ?= $(PKGDIRBASE)/nanopb/generator/protoc-gen-nanopb
|
||||||
|
|
||||||
|
PROTOBUF_FILES ?= $(wildcard *.proto)
|
||||||
|
GENSRC += $(PROTOBUF_FILES:%.proto=$(BINDIR)/$(MODULE)/%.pb.c)
|
||||||
|
GENOBJC := $(GENSRC:%.c=%.o)
|
||||||
|
|
||||||
|
ifneq (, $(PROTOBUF_FILES))
|
||||||
|
INCLUDES += -I$(BINDIR)/$(MODULE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(SRC): $(GENSRC)
|
||||||
|
|
||||||
|
$(GENSRC): $(PROTOBUF_FILES)
|
||||||
|
$(Q)D=$(BINDIR)/$(MODULE) && \
|
||||||
|
mkdir -p "$$D" && \
|
||||||
|
cd $(CURDIR) && \
|
||||||
|
make -C $(PKGDIRBASE)/nanopb/generator/proto && \
|
||||||
|
for protofile in $(PROTOBUF_FILES); do \
|
||||||
|
protoc --plugin=protoc-gen-nanopb=$(PROTOC_GEN_NANOPB) \
|
||||||
|
--nanopb_out="$$D" \
|
||||||
|
$^ \
|
||||||
|
; done
|
1
pkg/nanopb/Makefile.include
Normal file
1
pkg/nanopb/Makefile.include
Normal file
@ -0,0 +1 @@
|
|||||||
|
INCLUDES += -I$(PKGDIRBASE)/nanopb
|
3
pkg/nanopb/Makefile.nanopb
Normal file
3
pkg/nanopb/Makefile.nanopb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
SRCS := pb_encode.c pb_decode.c pb_common.c
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.base
|
8
pkg/nanopb/doc.txt
Normal file
8
pkg/nanopb/doc.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @defgroup pkg_nanopb small Protocol Buffers library
|
||||||
|
* @ingroup pkg
|
||||||
|
* @ingroup sys
|
||||||
|
* @brief Provides a protocol buffers library to RIOT
|
||||||
|
*
|
||||||
|
* @see https://github.com/nanopb/nanopb
|
||||||
|
*/
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user