summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Girigowda <sgirigow@codeaurora.org>2018-01-31 18:39:11 -0800
committersnandini <snandini@codeaurora.org>2018-02-01 16:26:31 -0800
commit5e8c55e22992fefa5da3732be081d6141c961658 (patch)
treebeb01aeea57fc49ec1ff0fb9f3a9fab53767e579
parent926a1c6866972c58f45159dd064307e18033921d (diff)
qcacld-3.0: Allow out-of-tree build with relative path in M
The Make variable $(M) must point to the directory that contains the module source code (which includes this Makefile). It can either be an absolute or a relative path. If it is a relative path, then it must be relative to the kernel source directory (KERNEL_SRC). An absolute path can be obtained very easily through $(shell pwd). Generating a path relative to KERNEL_SRC is difficult and we accept some outside help by letting the caller override the variable $(M). Allowing a relative path for $(M) enables us to have the build system put output/object files (.o, .ko.) into a directory different from the module source directory. Change-Id: Ic5dbcaa4579e4b7fe8b01399e03293c3bd425d27 CRs-Fixed: 2182672
-rw-r--r--Makefile20
1 files changed, 16 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 0e11ae6e7ae7..40ea0b812436 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,18 @@
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
-KBUILD_OPTIONS := WLAN_ROOT=$(PWD)
+# The Make variable $(M) must point to the directory that contains the module
+# source code (which includes this Makefile). It can either be an absolute or a
+# relative path. If it is a relative path, then it must be relative to the
+# kernel source directory (KERNEL_SRC). An absolute path can be obtained very
+# easily through $(shell pwd). Generating a path relative to KERNEL_SRC is
+# difficult and we accept some outside help by letting the caller override the
+# variable $(M). Allowing a relative path for $(M) enables us to have the build
+# system put output/object files (.o, .ko.) into a directory different from the
+# module source directory.
+M ?= $(shell pwd)
+
+# WLAN_ROOT must contain an absolute path (i.e. not a relative path)
+KBUILD_OPTIONS := WLAN_ROOT=$(shell cd $(KERNEL_SRC); readlink -e $(M))
KBUILD_OPTIONS += MODNAME?=wlan
#By default build for CLD
@@ -11,10 +23,10 @@ KBUILD_OPTIONS += $(WLAN_SELECT)
KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any
all:
- $(MAKE) -C $(KERNEL_SRC) M=$(shell pwd) modules $(KBUILD_OPTIONS)
+ $(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
modules_install:
- $(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(shell pwd) modules_install
+ $(MAKE) INSTALL_MOD_STRIP=1 M=$(M) -C $(KERNEL_SRC) modules_install
clean:
- $(MAKE) -C $(KERNEL_SRC) M=$(PWD) clean
+ $(MAKE) -C $(KERNEL_SRC) M=$(M) clean