[riot-notifications] [RIOT-OS/RIOT] pkg: micropython: initial commit (#2968)

Kaspar Schleiser notifications at github.com
Thu Jul 18 12:18:25 CEST 2019


kaspar030 commented on this pull request.



> +PY_H := $(PY:%.py=$(PY_HEADER_DIR)/%.py.h)
+
+ifneq (, $(PY_H))
+	CFLAGS += -I$(PY_HEADER_DIR)
+endif
+
+$(PY_HEADER_DIR):
+	@mkdir -p $@
+
+$(PY_H): $(PY_HEADER_DIR)
+$(PY_H): $(PY_HEADER_DIR)/%.py.h: %.py $(PY)
+	cd $(dir $<); xxd -i $(notdir $<) > $@
+
+# make C and C++ objects of this module depend on generated headers, so they
+# get re-build on changes to the python files.
+$(OBJC) $(OBJCXX): $(PY_H)

Chicken-and-egg problem: without specifying everything manually, the dependencies of a given ```.c``` are only available after building it. Without the header present, the build fails. Thus there's no (easy) way to get the dependency.

Making the objects of a given module that is using python files depend on the generated headers ensures they get re-built. It is possible that more objects than necessary get re-built. IMO that's acceptable for a first iteration, given that our makefiles basically require to "make clean" anyways.

-- 
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/2968#discussion_r304842415
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190718/d12add4a/attachment-0001.htm>


More information about the notifications mailing list