blob: 0c0b4734b8d0e66a32d7e284013b99b29e8bdb8a [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001ifeq ($(CONFIG_BUILD_YOCTO),y)
2 MTK_PLATFORM := $(subst ",,$(CONFIG_MTK_PLATFORM))
3 MET_ROOT_DIR := $(MET_DRIVER_DIR)
4 MET_COMMON_DIR := $(MET_DRIVER_DIR)/common
5 MET_PLF_DIR := $(MET_DRIVER_DIR)/$(MTK_PLATFORM)
6 MET_BUILD_DEFAULT := n
7
8 ifneq ($(KERNEL_OUT),)
9 include $(KERNEL_OUT)/.config
10 ccflags-y += -imacros $(KERNEL_OUT)/include/generated/autoconf.h
11 endif
12else
13 #$(info TARGET_BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM))
14 #$(info TARGET_PRODUCT=$(TARGET_PRODUCT))
15 #MTK_PLATFORM := $(subst ",,$(TARGET_BOARD_PLATFORM))
16 #MTK_PLATFORM := $(TARGET_DEVICE)
17 MTK_PLATFORM := mt2712
18 mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
19 MET_ROOT_DIR := $(patsubst %/,%,$(dir $(mkfile_path)))
20 MET_COMMON_DIR := $(wildcard $(MET_ROOT_DIR)/common)
21 MET_PLF_DIR := $(wildcard $(MET_ROOT_DIR)/$(MTK_PLATFORM))
22 MET_BUILD_DEFAULT := n
23
24 #$(info MTK_PLATFORM=$(TARGET_DEVICE))
25 #$(info mkfile_path=$(mkfile_path))
26 #$(info MET_ROOT_DIR=$(MET_ROOT_DIR))
27 #$(info MET_COMMON_DIR=$(MET_COMMON_DIR))
28 #$(info MET_PLF_DIR=$(MET_PLF_DIR))
29endif
30
31ifeq ($(CONFIG_MODULES),y)
32
33ifeq ($(CONFIG_FTRACE),y)
34 ifeq ($(CONFIG_TRACING),y)
35 FTRACE_READY := y
36 endif
37endif
38
39$(info ******** Start to build met_drv for $(MTK_PLATFORM) ********)
40ifneq ($(MET_PLF_DIR),)
41 ifeq ($(FTRACE_READY),y)
42 ifeq ($(CONFIG_BUILD_YOCTO),y)
43 include $(MET_COMMON_DIR)/Kbuild.yocto
44 else
45 include $(MET_COMMON_DIR)/Kbuild
46 endif
47 else
48 $(warning Not building met.ko due to CONFIG_FTRACE/CONFIG_TRACING is not set, build met default)
49 MET_BUILD_DEFAULT = y
50 endif
51else
52 $(warning not support $(MTK_PLATFORM), build met default)
53 MET_BUILD_DEFAULT = y
54endif
55else #CONFIG_MODULES = n
56 $(warning Not building met.ko due to CONFIG_MODULES is not set, build met default)
57 MET_BUILD_DEFAULT := y
58endif
59
60ifeq ($(MET_BUILD_DEFAULT),y)
61 MET_DEF_DIR := $(MET_ROOT_DIR)/default
62 include $(MET_DEF_DIR)/Kbuild
63endif