Hi support team,
Firstly I'm not familiar with linux makefile, in esp-idf SDK example, all the example are based on one main.c file, if I want to pass the compiling, I need to put all of the c files into the same path as that of the main.c located; actually in real application ,we need sub folders to manage different function modules , for example:
in the folder: /workspace/esp-idf-template/main: may includes:
main.c
iot_sdk
------src
---mqqt.c
---smartconfig.c
------inc
---mqtt.h
---smartconfig.h
if I assign the file structure above, how to set the configure file: such as component.mk and others.
It would be helpful for real application development.
How to config makefile with subfolder
Re: How to config makefile with subfolder
By default, the component.mk file will pick up all source files (.c, .cpp, .S) in the same directory, and add an "include" directory to the search path. You can override this behaviour as described in the documentation.
For your example you posted, a component.mk in the same directory as main.c would look something like
In this example the "main" component contains all of these source files. However, you may want to structure your code in a different way to this so that your project also contains multiple components. The "Example Project" in the docs gives an example of an alternative layout: http://esp-idf.readthedocs.io/en/latest ... le-project
For your example you posted, a component.mk in the same directory as main.c would look something like
Code: Select all
COMPONENT_SRCDIRS = . iot_sdk/src/
COMPONENT_ADD_INCLUDEDIRS = iot_sdk/inc
Who is online
Users browsing this forum: ESP_Sprite and 170 guests