Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Environment Variables expanded in subdir.mk when "Expand Env. Variables Refs in Makefiles" not checked

Hi Jonah,


Thanks for the prompt reply.  I do have the GNU Arm Eclipse plugins as I tried these out but realised I could do what I needed with just the CDT by using GCC Cross with Envrionment variables. 

I tried uninstalling the GNU Arm Eclipse plugins but the problem still persists.

So I installed a clean version of Mars with CDT and created a Hello World project using Cross GCC and set it up with my environment variables and subdir.mk contained the environment variables with no expansion.

So I imported my troublesome project into the clean installation of eclipse and the problem still persists, so it is something todo with my project.

After several hours of trying different things I think I have found the problem.  My configuration name has spaces in and if I remove them the subdir.mk files are generated correctly.  I doubled checked in the clean installation and if you rename the Debug Configuration to something like "Debug (Test)" then you will see the problem.


Could you try renaming the configuration to have spaces in and confirm that you see this as well?


Many Thanks,
Martin.



From: cdt-dev-bounces@xxxxxxxxxxx <cdt-dev-bounces@xxxxxxxxxxx> on behalf of Jonah Graham <jonah@xxxxxxxxxxxxxxxx>
Sent: 11 July 2016 11:02:03
To: CDT General developers list.
Subject: Re: [cdt-dev] Environment Variables expanded in subdir.mk when "Expand Env. Variables Refs in Makefiles" not checked
 
Hi Martin,

I doubt this bug would have been fixed between CDT 8.8 and CDT 9.0,
but it may have. It also may be more subtle than that because on CDT
8.8.1 and 9.0 I see the correct behaviour. Perhaps there are some
additional settings at play here? Are you using some additional
plug-ins such as http://gnuarmeclipse.github.io/?

As for where subdir,mk is generated, see:

subdir.mk defined here:
https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java#n51

the setting is accessed via keepEnvironmentVariablesInBuildfile() here:
https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/tree/build//org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java#n301

Checking the references/call hierarchy of the above should point you
at all the relevant code.

Jonah
~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com


On 11 July 2016 at 10:33, Martin Townsend
<Martin.Townsend@xxxxxxxxxxxxxx> wrote:
> Hi,
>
> I'm using CDT 8.8.1 with Mars.2 Release of Eclipse (4.5.2) and have setup a project for cross compilation which works great.  We put the generated makefiles under source control as they are used by external tools that can compile and package the same code base.
>
> Before starting eclipse we set several Environment variables which are then used within the CDT (mainly $CC and $CFLAGS), then we ensure that the "Expand Env. Variables Refs in Makefiles" is not checked.  Then in the C/C++ build settings -> Tool Settings we use ${CC} ${CFLAGS} in the Command to invoke our cross compiler.  The main generated makefile uses the environment variables as expected:
>
>     ....
>     @echo 'Building target: $@'
>     @echo 'Invoking: Cross GCC Linker'
>     ${CC} ${CFLAGS} ${LDFLAGS} -shared -o "mod_smu.so" $(OBJS) $(USER_OBJS) $(LIBS)
>     @echo 'Finished building target: $@'
>     @echo ' '
>     ....
>
>
> but the generated subdir.mk files do expand the environment variables:
>
>         @echo 'Building file: $<'
>         @echo 'Invoking: Cross GCC Compiler'
>         arm-none-linux-gnueabi-gcc  -march=armv7-a -marm -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/sdk/2016.01/....[snip]....
>         @echo 'Finished building: $<'
>         @echo ' '
>
> Is this a bug? if so has it been fixed in 9.0?
> Also if someone could point me to where in the code that the subdir.mk files are generated so I can put a temporary fix in place it would be most appreciated.
>
>
> Many Thanks,
> Martin.
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top