diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2022-10-08 23:28:24 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2022-10-11 23:23:18 +1100 |
commit | 3cc6decfc4d6b459014940ae01f90d4f1fae0da6 (patch) | |
tree | 8d43d29c91b2de7da2c6db42b179d708b8715b86 /docs/develop | |
parent | 67d05ed02b26b6ba2dcc638f2deed937a08417d7 (diff) |
py/py.mk: Make user-C-module handling self-contained in py.mk.
Removes the need for the port to add anything to OBJS or SRC_QSTR.
Also makes it possible for user-C-modules to differentiate between code
that should be processed for QSTR vs other files (e.g. helpers and
libraries).
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'docs/develop')
-rw-r--r-- | docs/develop/cmodules.rst | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/docs/develop/cmodules.rst b/docs/develop/cmodules.rst index 143057f7f..1b3ba04da 100644 --- a/docs/develop/cmodules.rst +++ b/docs/develop/cmodules.rst @@ -49,9 +49,17 @@ A MicroPython user C module is a directory with the following files: in your ``micropython.mk`` to a local make variable, eg ``EXAMPLE_MOD_DIR := $(USERMOD_DIR)`` - Your ``micropython.mk`` must add your modules source files relative to your - expanded copy of ``$(USERMOD_DIR)`` to ``SRC_USERMOD``, eg - ``SRC_USERMOD += $(EXAMPLE_MOD_DIR)/example.c`` + Your ``micropython.mk`` must add your modules source files to the + ``SRC_USERMOD_C`` or ``SRC_USERMOD_LIB_C`` variables. The former will be + processed for ``MP_QSTR_`` and ``MP_REGISTER_MODULE`` definitions, the latter + will not (e.g. helpers and library code that isn't MicroPython-specific). + These paths should include your expaned copy of ``$(USERMOD_DIR)``, e.g.:: + + SRC_USERMOD_C += $(EXAMPLE_MOD_DIR)/modexample.c + SRC_USERMOD_LIB_C += $(EXAMPLE_MOD_DIR)/utils/algorithm.c + + Similarly, use ``SRC_USERMOD_CXX`` and ``SRC_USERMOD_LIB_CXX`` for C++ + source files. If you have custom compiler options (like ``-I`` to add directories to search for header files), these should be added to ``CFLAGS_USERMOD`` for C code |