Files
kernel_oneplus_8750-modules/Makefile
Jia Ding f69d7fd14f qcacld-3.0: Add WLAN_ROOT to use Make option $(M)
Currently WLAN_ROOT is using absolute path of module source
directory. On platforms with long module source path, build failure
is seen with argument list too long at compiling phase, such as below.

make[8]: /bin/sh: Argument list too long

Such error is due to reaching maximum character length of arguments
in the $(MAKE) command.

Indeed make option -Iabsolute_path is appended to ccflags with full
absolute path and we do have a rather long list of include options.

In this change, WLAN_ROOT_MODULE_SOURCE_PATH option is added so that
top layer Make options can set it and then WLAN_ROOT can use
Make variable $(M) as is. When $(M) is a relative path of module
source directory to kernel source directory, argument list too long
issue can be mitigated with shorter total character length of
-Irelative_path options.

CRs-Fixed: 3666416
Change-Id: I019067e1cb225eae84f1155d2d88a980c23cb95d
2023-12-01 23:02:28 -08:00

47 lines
1.7 KiB
Makefile

KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
# 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)
ifeq ($(WLAN_ROOT),)
ifeq ($(WLAN_ROOT_MODULE_SOURCE_PATH),)
# WLAN_ROOT must contain an absolute path (i.e. not a relative path)
KBUILD_OPTIONS := WLAN_ROOT=$(shell cd $(KERNEL_SRC); readlink -e $(M))
else
# Honor what is passed from Make variable $(M), which could be a relative path.
KBUILD_OPTIONS := WLAN_ROOT=$(M)
endif
# MODNAME should be qca_cld3_wlan for helium based wear target
ifeq (qca_cld3, $(WLAN_WEAR_CHIPSET))
KBUILD_OPTIONS += MODNAME?=$(WLAN_WEAR_CHIPSET)_wlan
else
KBUILD_OPTIONS += MODNAME?=wlan
endif
#By default build for CLD
WLAN_SELECT := CONFIG_QCA_CLD_WLAN=m
KBUILD_OPTIONS += CONFIG_QCA_WIFI_ISOC=0
KBUILD_OPTIONS += CONFIG_QCA_WIFI_2_0=1
KBUILD_OPTIONS += $(WLAN_SELECT)
KBUILD_OPTIONS += $(KBUILD_EXTRA) # Extra config if any
endif
all:
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
modules_install:
$(MAKE) INSTALL_MOD_STRIP=1 M=$(M) -C $(KERNEL_SRC) modules_install
clean:
$(MAKE) -C $(KERNEL_SRC) M=$(M) clean $(KBUILD_OPTIONS)