diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk index 8965b1c1..5025218e 100644 --- a/build/tasks/kernel.mk +++ b/build/tasks/kernel.mk @@ -230,15 +230,17 @@ KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX) endif endif +BUILD_TOP := $(shell pwd) + ifeq ($(TARGET_KERNEL_CLANG_COMPILE),true) ifneq ($(TARGET_KERNEL_CLANG_VERSION),) # Find the clang-* directory containing the specified version - KERNEL_CLANG_VERSION := $(shell find $(ANDROID_BUILD_TOP)/prebuilts/clang/host/$(HOST_OS)-x86/ -name AndroidVersion.txt -exec grep -l $(TARGET_KERNEL_CLANG_VERSION) "{}" \; | sed -e 's|/AndroidVersion.txt$$||g;s|^.*/||g') + KERNEL_CLANG_VERSION := $(shell find $(BUILD_TOP)/prebuilts/clang/host/$(HOST_OS)-x86/ -name AndroidVersion.txt -exec grep -l $(TARGET_KERNEL_CLANG_VERSION) "{}" \; | sed -e 's|/AndroidVersion.txt$$||g;s|^.*/||g') else # Use the default version of clang if TARGET_KERNEL_CLANG_VERSION hasn't been set by the device config KERNEL_CLANG_VERSION := $(LLVM_PREBUILTS_VERSION) endif - TARGET_KERNEL_CLANG_PATH ?= $(ANDROID_BUILD_TOP)/prebuilts/clang/host/$(HOST_OS)-x86/$(KERNEL_CLANG_VERSION)/bin + TARGET_KERNEL_CLANG_PATH ?= $(BUILD_TOP)/prebuilts/clang/host/$(HOST_OS)-x86/$(KERNEL_CLANG_VERSION)/bin ifeq ($(KERNEL_ARCH),arm64) KERNEL_CLANG_TRIPLE ?= CLANG_TRIPLE=aarch64-linux-gnu- else ifeq ($(KERNEL_ARCH),arm) @@ -253,7 +255,7 @@ ifneq ($(USE_CCACHE),) ccache := $(shell which ccache) ifeq ($(ccache),) - ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache + ccache := $(BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache # Check that the executable is here. ccache := $(strip $(wildcard $(ccache))) endif @@ -270,7 +272,7 @@ endif ccache = ifeq ($(HOST_OS),darwin) - MAKE_FLAGS += C_INCLUDE_PATH=$(ANDROID_BUILD_TOP)/external/elfutils/libelf:/usr/local/opt/openssl/include + MAKE_FLAGS += C_INCLUDE_PATH=$(BUILD_TOP)/external/elfutils/libelf:/usr/local/opt/openssl/include MAKE_FLAGS += LIBRARY_PATH=/usr/local/opt/openssl/lib endif