1KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
2M ?= $(shell pwd)
3
4# $(WLAN_PLATFORM_ROOT) has to be a absolute path
5ifeq ($(WLAN_PLATFORM_ROOT),)
6WLAN_PLATFORM_ROOT = $(shell pwd)
7
8# If it reaches here, compilation is probably without Android.mk,
9# so enable all flags (including debug flag CONFIG_CNSS2_DEBUG) by
10# default.
11KBUILD_OPTIONS := WLAN_PLATFORM_ROOT=$(WLAN_PLATFORM_ROOT)
12ifeq ($(WLAN_BASEMACHINE),qcs40x)
13KBUILD_OPTIONS += CONFIG_CNSS_OUT_OF_TREE=y
14KBUILD_OPTIONS += CONFIG_ICNSS2=m
15KBUILD_OPTIONS += CONFIG_ICNSS2_QMI=y
16KBUILD_OPTIONS += CONFIG_ICNSS2_DEBUG=y
17KBUILD_OPTIONS += CONFIG_CNSS_QMI_SVC=m
18KBUILD_OPTIONS += CONFIG_WCNSS_MEM_PRE_ALLOC=m
19KBUILD_OPTIONS += CONFIG_CNSS_UTILS=m
20KBUILD_OPTIONS += CONFIG_CNSS_GENL=m
21KBUILD_OPTIONS += CONFIG_CNSS_PLAT_IPC_QMI_SVC=m
22else ifeq ($(USE_EXTERNAL_CONFIGS),)
23KBUILD_OPTIONS += CONFIG_CNSS_OUT_OF_TREE=y
24KBUILD_OPTIONS += CONFIG_CNSS2=m
25KBUILD_OPTIONS += CONFIG_ICNSS2=m
26KBUILD_OPTIONS += CONFIG_CNSS2_QMI=y
27KBUILD_OPTIONS += CONFIG_ICNSS2_QMI=y
28KBUILD_OPTIONS += CONFIG_CNSS2_DEBUG=y
29KBUILD_OPTIONS += CONFIG_ICNSS2_DEBUG=y
30KBUILD_OPTIONS += CONFIG_CNSS_QMI_SVC=m
31KBUILD_OPTIONS += CONFIG_CNSS_PLAT_IPC_QMI_SVC=m
32KBUILD_OPTIONS += CONFIG_CNSS_GENL=m
33KBUILD_OPTIONS += CONFIG_WCNSS_MEM_PRE_ALLOC=m
34KBUILD_OPTIONS += CONFIG_CNSS_UTILS=m
35KBUILD_OPTIONS += CONFIG_CNSS2_SSR_DRIVER_DUMP=y
36endif
37endif
38
39all: modules
40
41%:
42	$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
43
44modules_install:
45	$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
46
47clean:
48	$(MAKE) -C $(KERNEL_SRC) M=$(M) clean
49