endif
ifneq ($(KBUILD_SRC),)
-TOP_KBUILD_SRC := $(KBUILD_SRC)/
+ ifneq ($(wildcard $(KBUILD_SRC)/$(src)),)
+ TOP_KBUILD_SRC := $(KBUILD_SRC)/
+ endif
endif
+
OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB ?= 16
ifeq ($(CONFIG_MALI400_PROFILING),y)
$(warning "You have specified the CPU variable which is no longer in used. Use TARGET_PLATFORM instead.")
endif
+# KDIR not set when included by modpost
+ifneq ($(KBUILD_EXTMOD),)
+ ifeq ($(KDIR),)
+ KDIR := $(KBUILD_SRC)
+ endif
+endif
+
# Include the mapping between TARGET_PLATFORM and KDIR + MALI_PLATFORM
-include MALI_CONFIGURATION
export KDIR ?= $(KDIR-$(TARGET_PLATFORM))
# Define host system directory
KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
-include $(KDIR)/.config
+# .config could be in an output directory, different than KDIR
+# and it's not needed during modpost
+ifeq ($(KBUILD_EXTMOD),)
+ include $(KDIR)/.config
+endif
ifeq ($(ARCH), arm)
# when compiling for ARM we're cross compiling
TARGET_PLATFORM ?= aml-meson
ifneq ($(KBUILD_SRC),)
-TOP_KBUILD_SRC := $(KBUILD_SRC)/
+ ifneq ($(wildcard $(KBUILD_SRC)/$(src)),)
+ TOP_KBUILD_SRC := $(KBUILD_SRC)/
+ endif
endif
# Validate selected config
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
+# Skip this Makefile when included from modpost
+ifeq ($(KBUILD_EXTMOD),)
+
# For each arch check: CROSS_COMPILE , KDIR , CFLAGS += -DARCH
export ARCH ?= arm
clean:
$(MAKE) -C $(KDIR) M=$(CURDIR) clean
$(MAKE) -C $(KDIR) M=$(CURDIR)/../mali clean
+
+endif