qcacld-3.0: Support new build tree structure

The kernel can be either directly under build_root/kernel or in a
subdirectory within it. The WLAN module has a hard coded assumption
for the path. Hence add the changes to correct it based on flags
TARGET_KERNEL_VERSION and KERNEL_TO_BUILD_ROOT_OFFSET.

Change-Id: Ic4738da5c414a1ce1d74e2b42b918b906f5fda98
CRs-fixed: 992940
diff --git a/Android.mk b/Android.mk
index c0739ea..69e91dc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -14,6 +14,14 @@
 # Build/Package only in case of supported target
 ifneq ($(WLAN_CHIPSET),)
 
+# If TARGET_KERNEL_VERSION is not defined, using default kernel path,
+# otherwise kernel path should come from top level Android makefiles.
+ifeq ($(TARGET_KERNEL_VERSION),)
+$(info "WLAN: TARGET_KERNEL_VERSION not defined, assuming default")
+TARGET_KERNEL_SOURCE := kernel
+KERNEL_TO_BUILD_ROOT_OFFSET := ../
+endif
+
 LOCAL_PATH := $(call my-dir)
 
 # This makefile is only for DLKM
@@ -33,7 +41,7 @@
 # Build wlan.ko as $(WLAN_CHIPSET)_wlan.ko
 ###########################################################
 # This is set once per LOCAL_PATH, not per (kernel) module
-KBUILD_OPTIONS := WLAN_ROOT=../$(WLAN_BLD_DIR)/qcacld-3.0
+KBUILD_OPTIONS := WLAN_ROOT=$(KERNEL_TO_BUILD_ROOT_OFFSET)$(WLAN_BLD_DIR)/qcacld-3.0
 KBUILD_OPTIONS += WLAN_COMMON_ROOT=../../../opensource/wlan/qca-wifi-host-cmn
 KBUILD_OPTIONS += WLAN_COMMON_INC=../vendor/qcom/opensource/wlan/qca-wifi-host-cmn