mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-19 09:54:15 +01:00
build: sanitize user environment variables
Certain environment variables or command-line overrides can result in difficult-to-diagnose build issues. These variables are now filtered from the calling environment prior to invoking the lower level makefiles. These variables which may affect gcc are removed from the environment and from the command-line overrides: TMPDIR GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH CFLAGS CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH DEPENDENCIES_OUTPUT These variables which are now deprecated are removed from the environment and from the command-line overrides: USE_BOOTLOADER
This commit is contained in:
parent
29ec2f198b
commit
4028c0b2ee
20
Makefile
20
Makefile
@ -4,6 +4,26 @@ TOOLS_DIR=$(ROOT_DIR)/tools
|
||||
BUILD_DIR=$(ROOT_DIR)/build
|
||||
DL_DIR=$(ROOT_DIR)/downloads
|
||||
|
||||
# Clean out undesirable variables from the environment and command-line
|
||||
# to remove the chance that they will cause problems with our build
|
||||
define SANITIZE_VAR
|
||||
$(if $(filter-out undefined,$(origin $(1))),
|
||||
$(info *NOTE* Sanitized $(2) variable '$(1)' from $(origin $(1)))
|
||||
MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES))
|
||||
override $(1) :=
|
||||
unexport $(1)
|
||||
)
|
||||
endef
|
||||
|
||||
# These specific variables can influence gcc in unexpected (and undesirable) ways
|
||||
SANITIZE_GCC_VARS := TMPDIR GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH
|
||||
SANITIZE_GCC_VARS += CFLAGS CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH DEPENDENCIES_OUTPUT
|
||||
$(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowed)))
|
||||
|
||||
# These specific variables used to be valid but now they make no sense
|
||||
SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER
|
||||
$(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
|
||||
|
||||
# We almost need to consider autoconf/automake instead of this
|
||||
# I don't know if windows supports uname :-(
|
||||
QT_SPEC=win32-g++
|
||||
|
Loading…
x
Reference in New Issue
Block a user