2 # Copyright (C) 2011-2012 ARM Limited. All rights reserved.
4 # This program is free software and is provided to you under the terms of the GNU General Public License version 2
5 # as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
7 # A copy of the licence is included with the program, and can also be obtained from Free Software
8 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
13 USING_INTERNAL_PROFILING ?= 0
15 # The Makefile sets up "arch" based on the CONFIG, creates the version info
16 # string and the __malidrv_build_info.c file, and then call the Linux build
17 # system to actually build the driver. After that point the Kbuild file takes
20 # set up defaults if not defined by the user
27 $(shell if $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
34 # This conditional makefile exports the global definition ARM_INTERNAL_BUILD. Customer releases will not include arm_internal.mak
35 -include ../../../arm_internal.mak
37 # Give warning of old config parameters are used
39 $(warning "You have specified the CONFIG variable which is no longer in used. Use TARGET_PLATFORM instead.")
43 $(warning "You have specified the CPU variable which is no longer in used. Use TARGET_PLATFORM instead.")
46 # Include the mapping between TARGET_PLATFORM and KDIR + MALI_PLATFORM
47 -include MALI_CONFIGURATION
48 export KDIR ?= $(KDIR-$(TARGET_PLATFORM))
49 export MALI_PLATFORM ?= $(MALI_PLATFORM-$(TARGET_PLATFORM))
51 ifneq ($(TARGET_PLATFORM),)
52 ifeq ($(MALI_PLATFORM),)
53 $(error "Invalid TARGET_PLATFORM: $(TARGET_PLATFORM)")
57 # validate lookup result
59 $(error No KDIR found for platform $(TARGET_PLATFORM))
64 export CONFIG_MALI400_UMP=y
65 export EXTRA_DEFINES += -DCONFIG_MALI400_UMP=1
67 UMP_SYMVERS_FILE ?= ../umpv2/Module.symvers
69 UMP_SYMVERS_FILE ?= ../ump/Module.symvers
71 KBUILD_EXTRA_SYMBOLS = $(realpath $(UMP_SYMVERS_FILE))
72 $(warning $(KBUILD_EXTRA_SYMBOLS))
75 # Define host system directory
76 KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
78 include $(KDIR)/.config
81 # when compiling for ARM we're cross compiling
82 export CROSS_COMPILE ?= $(call check_cc2, arm-linux-gnueabi-gcc, arm-linux-gnueabi-, arm-none-linux-gnueabi-)
85 # report detected/selected settings
86 ifdef ARM_INTERNAL_BUILD
87 $(warning TARGET_PLATFORM $(TARGET_PLATFORM))
88 $(warning KDIR $(KDIR))
89 $(warning MALI_PLATFORM $(MALI_PLATFORM))
93 export CONFIG_MALI400=m
95 ifneq ($(MALI_PLATFORM),)
96 export MALI_PLATFORM_FILES = $(wildcard platform/$(MALI_PLATFORM)/*.c)
99 ifeq ($(USING_PROFILING),1)
100 ifeq ($(CONFIG_TRACEPOINTS),)
101 $(warning CONFIG_TRACEPOINTS reqired for profiling)
103 export CONFIG_MALI400_PROFILING=y
104 export EXTRA_DEFINES += -DCONFIG_MALI400_PROFILING=1
105 ifeq ($(USING_INTERNAL_PROFILING),1)
106 export CONFIG_MALI400_INTERNAL_PROFILING=y
107 export EXTRA_DEFINES += -DCONFIG_MALI400_INTERNAL_PROFILING=1
112 ifneq ($(BUILD),release)
113 export CONFIG_MALI400_DEBUG=y
116 all: $(UMP_SYMVERS_FILE)
117 $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules
118 @rm $(FILES_PREFIX)__malidrv_build_info.c $(FILES_PREFIX)__malidrv_build_info.o
121 $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
124 $(MAKE) ARCH=$(ARCH) -C $(KDIR) kernelrelease
126 export CONFIG KBUILD_EXTRA_SYMBOLS