Page 1 of 1

User C module

Posted: Tue Dec 22, 2020 7:57 am
by Keja
hello all,

I've started investigating how to add some C modules , I want to do this because I have some drivers in C that I would like to use (though I'm still considering rewritting the drivers in Python, can't be a bad excersise ...)

So I started reading the documentation and followed the example to include the simplefunction.c in my unix port. It works fine as long as I use the same folder structure as the example and compiling with the command :

Code: Select all

make USER_C_MODULES=../../../usermod/snippets all
I was curious to understand better how if all works but was unable to do the same using another directory and pointing to that directory in the make command.

I figured I don't understand enough the make files and was hopping to get some explanation on those lines :

Code: Select all

USERMODULES_DIR := $(USERMOD_DIR)

# Add all C files to SRC_USERMOD.
SRC_USERMOD += $(USERMODULES_DIR)/simplefunction.c

CFLAGS_USERMOD += -I$(USERMODULES_DIR)
How does the pre compiler know the value of USERMOD_DIR ?
What do I need to modifiy to point to a different directory for my customs C modules?

Thanks for reading