mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
py: Implement a module system for external, user C modules.
This system makes it a lot easier to include external libraries as static, native modules in MicroPython. Simply pass USER_C_MODULES (like FROZEN_MPY_DIR) as a make parameter.
This commit is contained in:
committed by
Damien George
parent
cf22f4793c
commit
2e516074da
9
py/py.mk
9
py/py.mk
@@ -129,6 +129,13 @@ $(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare
|
||||
$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
|
||||
endif
|
||||
|
||||
# External modules written in C.
|
||||
ifneq ($(USER_C_MODULES),)
|
||||
CFLAGS_MOD += -DMICROPY_CMODULES_INCLUDE_H='"genhdr/cmodules.h"'
|
||||
include $(USER_C_MODULES)/*/micropython.mk
|
||||
SRC_QSTR += $(BUILD)/genhdr/cmodules.h
|
||||
endif
|
||||
|
||||
# py object files
|
||||
PY_CORE_O_BASENAME = $(addprefix py/,\
|
||||
mpstate.o \
|
||||
@@ -300,7 +307,7 @@ endif
|
||||
|
||||
# Sources that may contain qstrings
|
||||
SRC_QSTR_IGNORE = py/nlr%
|
||||
SRC_QSTR = $(SRC_MOD) $(filter-out $(SRC_QSTR_IGNORE),$(PY_CORE_O_BASENAME:.o=.c)) $(PY_EXTMOD_O_BASENAME:.o=.c)
|
||||
SRC_QSTR += $(SRC_MOD) $(filter-out $(SRC_QSTR_IGNORE),$(PY_CORE_O_BASENAME:.o=.c)) $(PY_EXTMOD_O_BASENAME:.o=.c)
|
||||
|
||||
# Anything that depends on FORCE will be considered out-of-date
|
||||
FORCE:
|
||||
|
||||
Reference in New Issue
Block a user