build: detect OS via cc -dumpmachine
Rather than running 'uname', which returns information about the build system, use the C compiler's -dumpmachine option, which outputs the target triplet, which looks something like "x86_64-unknown-linux-gnu". This enables us to detect the correct target OS when the configured $(CC) is a cross compiler. Change-Id: I5659dd5b091094cc8e408a6c6f4e7f64a65e9070 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/385166 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
cccd5ad557
commit
98f84e6255
@ -47,7 +47,15 @@ ifeq ($(MAKECMDGOALS),)
|
|||||||
MAKECMDGOALS=$(.DEFAULT_GOAL)
|
MAKECMDGOALS=$(.DEFAULT_GOAL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OS := $(shell uname)
|
TARGET_TRIPLET := $(shell $(CC) -dumpmachine)
|
||||||
|
TARGET_TRIPLET_WORDS := $(subst -, ,$(TARGET_TRIPLET))
|
||||||
|
|
||||||
|
ifneq ($(filter linux%,$(TARGET_TRIPLET_WORDS)),)
|
||||||
|
OS = Linux
|
||||||
|
endif
|
||||||
|
ifneq ($(filter freebsd%,$(TARGET_TRIPLET_WORDS)),)
|
||||||
|
OS = FreeBSD
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -fno-strict-aliasing -I$(SPDK_ROOT_DIR)/include
|
COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wmissing-declarations -fno-strict-aliasing -I$(SPDK_ROOT_DIR)/include
|
||||||
|
Loading…
Reference in New Issue
Block a user