adamgreen / gcc4mbed

Project to allow GCC compilation of code using mbed SDK libraries.
172 stars 68 forks source link

Makefile: add a way to exclude specific files with EXCLUDE #24

Closed clementleger closed 9 years ago

clementleger commented 9 years ago

This patch add a special make variable named EXCLUDE to allow exclusion of specific files from the final object. It allows to make conditionnal builds much simpler.

adamgreen commented 9 years ago

Thanks for the PR. I do have a few questions / notes before I merge.

What was the scenario that required this support? Why couldn't the files to be excluded be placed in a different directory?

The new EXCLUDE variable should probably be documented here as well.

clementleger commented 9 years ago

Hello Adam,

For some large projects, you may want to add conditionnal build part which can be directly defined in the Makefile such as MY_FEATURE := 0. This var is then used to add some defines such as -DMY_FEATURE=0 and exclude the smy_feature directory from the source. In fact, I'm trying to port SmoothieBoard to a new platform and I was in the process of updating gcc4mbed. I saw that SmoothieWare modified the device-common.mk file in order to exclude /libs/Network from SRC when NONETWORK = 1. Instead of modifying the gcc4mbed Makefiles, I thought it was more elegant to allow the user to exclude some files directly from his makefile. This allows more flexible builds.

adamgreen commented 9 years ago

Thanks for the PR and answering my questions.

I have merged this PR into the working branch. I will merge into master after the next test pass.