Correct way to add include directories to new project

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I have created a new project and one of the sources needs access to multiple include

directories.  I have edited the new make file as follows:

NAME := testPlatform

$(NAME)_SOURCES:= testPlatform.c

$(NAME)_INCLUDES +: -I./WICED/RTOS/FreeRTOS/ver7.5.2/Source/include

After clean and build, I get a strange string in the config.mk file (in the build dir tree)

that looks something like

testPlatform_INCLUDES := -I./app/testProgram/testPlatform-I./WICED/RTOS/FREERTOS/ver7.5/2/Source/incude

no space between the include specs  and the compile fails.  Have replaced +: with other syntax choices but

same result.  If I edit config.mk and add a space, include files are found correctly.  But, if I ever do a clean,

I loose that info from the config.mk file.

Also is there a list of significant make variable names that mean something in project make files?  It took a while to find the

xxx_INCLUDES name in an example and also the $(NAME)_PREBUILT_LIBRARY := xxx.a for use in creating project-wide

libraries.  Even if its just a list significant names, that would be a help..

Thanks

0 Likes
1 Solution

mcp

Don't add -I in $(NAME)_INCLUDES and the include path should be relative to component directory!

View solution in original post

0 Likes
4 Replies
JoYi_1844281
Level 6
Level 6
100 sign-ins 100 replies posted 50 likes received

Try += 

0 Likes
Anonymous
Not applicable

Thanks for the reply.  But, it does not work in my build environment.

I have a project in the apps directory:

apps/testSystem/testPlatform

in testPlatform.mk, I have the line

$(NAME)_INCLUDES += -I./WICED/RTOS/FreeRTOS/ver7.5.2/Source/include

I do a clean followed by a make testPlatform-myPlatform and see

the following in the build/testPlatform/config.mk

testPlatform_INCLUDES     := -I./apps/sensorPlatform/testPlatform/-I./WICED/RTOS/FreeRTOS/ver7.5.2/Source/include

The field will not resolve into an acceptable include directory due to the missing " ".

If I edit the config.mk and "don't" do any further cleans, it works.  But, I admit this a clumsy work around.

THanks,

Chuck

0 Likes

mcp

Don't add -I in $(NAME)_INCLUDES and the include path should be relative to component directory!

0 Likes
Anonymous
Not applicable

Thanks,  finally had time to try it.  I already had relative paths in place, but

had not tried leaving out the "-I".

Regards,

rtis

0 Likes