5 years, 11 months ago.

Include or exclude folders based on target

Hi,

Have a utility folder with that are compiled several targets and project. I can of course add the all the sub folders that should be compiled for each project/target when calling mbed python build system. But it would be great if I can just can add a file to my folder and specify what files to compile for given a target.

utilities

- common
- target_1
- target_2
- target_3
- target_1+2

My question: Can I add a .travis.yml, makefile or something else the utilities folder that specifies which folders or files to compile depending on the given target?

Something similar must be done when compiling mbed os. In mbed there are different folder used for different targets, like NUCLEO or Nordic NRF.

Thanks,

Henrik

1 Answer

5 years, 11 months ago.

Could you do it using something along the lines of

#ifdef TARGET_NUCLEO
  #include "file1"
#else
  #include "file2"
#endif

In the mbed source tree various folders have names in capitals, if that folder is to be used buring the build process then a #define of that name will be defined.

e.g. for the LPC1768 the following will all be defined TARGET_NXP, TARGET_LPC176X, and TARGET_MBED_LPC1768

Accepted Answer

Thanks, naming the sub folders with the target name (TARGET_NXP) I can solve this.

posted by Henrik Avenberg 03 May 2018