I am creating a bash script that uses a local copy of gcc for arm. I need to have multiple versions of gcc around for compatibility. My bash script downloads the binary correctly, sets up the path locally but the make files ignore the local version.
After reading some docs make: Using Environment Variables I found that there is an export -e OPTION=VALUE from a bash script that will override the make default path.
This works well in my local copy of bash, but when running it through circle testing servers it fails, saying that -e is an invalid option.
Anyone know of a better way to override paths inside of make? Specifically for a third party project that I can't change the make files for.
GCC_ARM_VER=gcc-arm-none-eabi-4_8-2014q2 export -e GCC_ARM_PATH=$BINDIR/gcc-arm-embedded/$GCC_ARM_VER/bin export PATH=$GCC_ARM_PATH:$PATH make all -s -C "$BASE_FIRMWARE/"firmware APPDIR="$CWD/firmware" TARGET_DIR="$CWD/bin" PLATFORM="$1" || exit And then in the make file (arm-tools.mk):
# Define the compiler/tools prefix GCC_PREFIX ?= arm-none-eabi- include $(COMMON_BUILD)/common-tools.mk AR = $(GCC_ARM_PATH)$(GCC_PREFIX)gcc-ar # # default flags for targeting ARM # # C compiler flags CFLAGS += -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb # C++ specific flags CPPFLAGS += -fno-exceptions -fno-rtti -fcheck-new CONLYFLAGS += ASFLAGS += -g3 -gdwarf-2 -mcpu=cortex-m3 -mthumb LDFLAGS += -nostartfiles -Xlinker --gc-sections ...
makemanual. As said here ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/…-eismakeoption, notexportoption. Back to your question - isGCC_ARM_PATHset somewhere in yourarm-tools.mkbefore it's used?makecannot be overridden (in the top-levelmake) by either the environment or the makefile. The normal precedence hierarchy (highest to lowest) is command-line argument, makefile, environment; themake -eoption changes that to command-line argument, environment, makefile.