Explicitly exclude components (howto)

User avatar
ninjaneer
Posts: 5
Joined: Mon Apr 02, 2018 5:15 pm

Explicitly exclude components (howto)

Postby ninjaneer » Fri Apr 06, 2018 5:00 pm

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.

ESP_Sprite
Posts: 9757
Joined: Thu Nov 26, 2015 4:08 am

Re: Explicitly exclude components (howto)

Postby ESP_Sprite » Sat Apr 07, 2018 3:13 am

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.

User avatar
ninjaneer
Posts: 5
Joined: Mon Apr 02, 2018 5:15 pm

Re: Explicitly exclude components (howto)

Postby ninjaneer » Sat Apr 07, 2018 7:28 am

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.

User avatar
javaben
Posts: 35
Joined: Mon Mar 19, 2018 11:49 pm

Re: Explicitly exclude components (howto)

Postby javaben » Sat Apr 07, 2018 10:53 pm

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.

ESPERR
Posts: 1
Joined: Mon Dec 13, 2021 1:25 pm

Re: Explicitly exclude components (howto)

Postby ESPERR » Mon Dec 13, 2021 1:30 pm

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

Who is online

Users browsing this forum: Baidu [Spider] and 192 guests