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 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


Back to the top