Page 1 of 1

Explicitly exclude components (howto)

Posted: Fri Apr 06, 2018 5:00 pm
by ninjaneer
Hey!

I've noticed that there's no make variable to exclude components to cut down on full build times, so I've created one for myself.

On about line 150 of IDF_PATH/make/project.mk, add the following after "COMPONENTS := $(sort... endif" and before "export COMPONENTS" :

Code: Select all

ifdef EXCLUDE_COMPONENTS
ifdef EXCLUDE_COMPONENTS
COMPONENTS := $(filter-out $(EXCLUDE_COMPONENTS), $(COMPONENTS))
$(info Excluded components: $(EXCLUDE_COMPONENTS))
endif
$(info Component list: $(COMPONENTS))
Now in the project Makefile, you can have something like:

Code: Select all

PROJECT_NAME := SomeSensorProject
EXCLUDE_COMPONENTS := openssl aws_iot bt coap nghttp

include $(IDF_PATH)/make/project.mk
I've only tested it with the msys32 subsystem under eclipse, but it's generic makefile language so hopefully it will work everywhere.

If interested, give it a try to see how it works for you.

Re: Explicitly exclude components (howto)

Posted: Sat Apr 07, 2018 3:13 am
by ESP_Sprite
Fyi, if you feel this is useful enough in general (and are willing to also modify the docs to mention this new variable), feel free to make a push request against the esp-idf github repo and we'll see if we can merge it into the master tree.

Re: Explicitly exclude components (howto)

Posted: Sat Apr 07, 2018 7:28 am
by ninjaneer
Will do... it's a marginal gain with the IDF when building clean, but I think anyone dealing with an underpowered automated build server might appreciate it.

Re: Explicitly exclude components (howto)

Posted: Sat Apr 07, 2018 10:53 pm
by javaben
I would like to endorse this addition as I think it would facilitate unit test builds as separate constructs.

In eclipse, I would like to use the 'Build Configuration' for different builds, but it doesn't appear that the different configurations make their way into the esp-idf build. For instance, on Eclipse, I set up 'release', 'debug', and 'unittest', and then leave out certain 'components' and alternative 'app_main' source files based on the configuration, but everything appears to build regardless of which 'build configuration' is 'active', so the suggestion above might facilitate this.

Re: Explicitly exclude components (howto)

Posted: Mon Dec 13, 2021 1:30 pm
by ESPERR
Hello,
Are there any components that cannot be excluded?
I am trying to strip components from the "sample"-example which is meant to be the most simple project that can be built. But I still end up having the esp_http_client or JSON component for example in the project_description.json of the build folder even tho I am excluding it in my Makefile.

Makefile:

Code: Select all

PROJECT_NAME := sample_project
EXCLUDE_COMPONENTS := json
include $(IDF_PATH)/make/project.mk