[riot-notifications] [RIOT-OS/RIOT] Add nanopb package (#11157)

Juan I Carrano notifications at github.com
Tue Mar 12 18:13:06 CET 2019


jcarrano commented on this pull request.



> +
+TOOLCHAIN_FILE = $(PKG_BUILDDIR)/xcompile-toolchain.cmake
+
+PKG_DIR=$(CURDIR)
+PROTO_DIR=$(APPDIR)/proto
+PROTO_BUILD_DIR=$(APPDIR)/proto_compiled
+PROTO_FILES=$(shell ls $(PROTO_DIR))
+
+all: $(PKG_BUILDDIR)/Makefile
+	cp $(PKG_BUILDDIR)/libnanopb.a $(BINDIR)/nanopb.a
+
+$(PKG_BUILDDIR)/Makefile: $(TOOLCHAIN_FILE)
+	rm -rf $(PROTO_BUILD_DIR) && \
+	mkdir $(PROTO_BUILD_DIR) && \
+	cp $(PKG_DIR)/Makefile.template $(PKG_BUILDDIR)/Makefile && \
+	$(MAKE) -e PROTO_BUILD_DIR="$(PROTO_BUILD_DIR)" -e PROTO_FILES="$(PROTO_FILES)" \

The package's makefile should only take care of building the package. The rest of the rules must be in Makefile.include so that they are added to the main makefile. It is possible to define it so that the user does not have to worry about anything: the same way it is done for `.c` files:

- Use a wildcard to collect `.proto` files
- From this collection, create a target for each .proto.
- Define an implicit rule so that make knows how to build a `pb.{c,h}` from a `.proto`

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11157#discussion_r264789097
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190312/3e335e4c/attachment.html>


More information about the notifications mailing list