Makefile-Based Projects
- For Makefile-based projects, the cross-toolchain environment
- variables established by running the cross-toolchain environment
- setup script override any settings you might have in your
- Makefile.
- For example, if you had settings such as the following in your
- Makefile, the environment variables defined
- by the script would override them:
+ 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=arm-poky-linux-gnueabi-gcc
- LD=arm-poky-linux-gnueabi-ld
- CFLAGS=”${CFLAGS} --sysroot=<sysroot-dir>”
- CXXFLAGS=”${CXXFLAGS} --sysroot=<sysroot-dir>”
+ CC=i586-poky-linux-gcc -m32 -march=i586 --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux
+ LD=i586-poky-linux-ld --sysroot=/opt/poky/1.8/sysroots/i586-poky-linux
+ CFLAGS=-O2 -pipe -g -feliminate-unused-debug-types
+ CXXFLAGS=-O2 -pipe -g -feliminate-unused-debug-types
- Consequently, you should not set variables like
- CC
- and
- LD
- in your Makefile.
- For the list of variables set up by the cross-toolchain environment
- setup script, see the
- "Setting Up the Cross-Development Environment"
- section.
+ 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.
+
+
+
+ For the list of variables set up by the cross-toolchain environment
+ setup script, see the
+ "Setting Up the Cross-Development Environment"
+ section.
+
-