For Makefile-based projects, the cross-toolchain environment
variables established by running the cross-toolchain environment
setup script are subject to general make
rules.
To illustrate this, consider the following four cross-toolchain environment variables:
CC=i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux LD=i586-poky-linux-ld --sysroot=/opt/poky/2.5/sysroots/i586-poky-linux CFLAGS=-O2 -pipe -g -feliminate-unused-debug-types CXXFLAGS=-O2 -pipe -g -feliminate-unused-debug-types
Now, consider the following three cases:
Case 1 - No Variables Set in the
Makefile
:
Because these variables are not specifically set in the
Makefile
, the variables retain their
values based on the environment.
Case 2 - Variables Set in the
Makefile
:
Specifically setting variables in the
Makefile
during the build results in
the environment settings of the variables being
overwritten.
Case 3 - Variables Set when the
Makefile
is Executed from the
Command Line:
Executing the Makefile
from the
command-line results in the variables being overwritten
with command-line content regardless of what is being set
in the Makefile
.
In this case, environment variables are not considered
unless you use the "-e" flag during the build:
$ make -e file
If you use this flag, then the environment values of the
variables override any variables specifically set in the
Makefile
.