Run `uname -sm` once, don't use python for HOST_OS_EXTRA
This saves 20-50ms for `lunch` (~7-10%), and double that for every build
execution.
Test: Check HOST_OS_EXTRA on Linux & Mac
Change-Id: I863200b2287c8867f40606237895b1d3ad91e1b3
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 46066e3..d17e9e0 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -97,8 +97,6 @@
# compiles except for arm/mips, so the HOST is whatever we are
# running on
-UNAME := $(shell uname -sm)
-
# HOST_OS
ifneq (,$(findstring Linux,$(UNAME)))
HOST_OS := linux
@@ -110,7 +108,15 @@
HOST_OS := darwin
endif
-HOST_OS_EXTRA:=$(shell python -c "import platform; print(platform.platform())")
+HOST_OS_EXTRA := $(shell uname -rsm)
+ifeq ($(HOST_OS),linux)
+ ifneq ($(wildcard /etc/os-release),)
+ HOST_OS_EXTRA += $(shell source /etc/os-release; echo $$PRETTY_NAME)
+ endif
+else ifeq ($(HOST_OS),darwin)
+ HOST_OS_EXTRA += $(shell sw_vers -productVersion)
+endif
+HOST_OS_EXTRA := $(subst $(space),-,$(HOST_OS_EXTRA))
# BUILD_OS is the real host doing the build.
BUILD_OS := $(HOST_OS)