2 # (C) COPYRIGHT 2008-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 ifneq ($(KBUILD_EXTMOD),)
15 include $(KBUILD_EXTMOD)/Makefile.common
17 include $(VITHAR_ROOT)/$(UMP_PATH)/Makefile.common
21 include $(VITHAR_ROOT)/$(UMP_PATH)/imports/ion/Makefile
24 # default to building for the host
25 ARCH ?= $(shell uname -m)
27 # linux build system integration
29 ######################################################################
30 #******************************************************************###
31 #TODO: remove OSK references for Linux Kernel mainline release: **###
32 #***** I.E. for each ifeq ($(MALI_UNIT_TEST),1) leave only the **###
33 #####* body in the else branch and remove the rest **###
34 #####**************************************************************###
35 ######################################################################
37 ifeq ($(MALI_UNIT_TEST),1)
39 RELATIVE_ROOT=../../..
40 ROOT = $(PWD)/../../..
41 OSK_PATH = $(ROOT)/osk
42 include $(OSK_PATH)/src/$(OS)/Makefile.osk
43 EXTRA_CFLAGS += -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) -DMALI_DEBUG=$(MALI_DEBUG) -DMALI_LICENSE_IS_GPL=$(MALI_LICENSE_IS_GPL) -DMALI_BASE_TRACK_MEMLEAK=$(MALI_BASE_TRACK_MEMLEAK)
46 #ifneq ($(KERNELRELEASE),)
47 ifneq ($(VITHAR_ROOT),)
48 # Inside the kernel build system
50 EXTRA_CFLAGS += -I$(KBUILD_EXTMOD) -I$(KBUILD_EXTMOD)/common -I$(KBUILD_EXTMOD)/linux -I$(KBUILD_EXTMOD)/../.. -I$(KBUILD_EXTMOD)/../../.. -DUMP_LICENSE_IS_GPL=$(MALI_LICENSE_IS_GPL)
52 # For customer releases the Linux Device Drivers will be provided as ARM proprietary and GPL releases:
53 # The ARM proprietary product will only include the license/proprietary directory
54 # The GPL product will only include the license/gpl directory
56 ifeq ($(wildcard $(KBUILD_EXTMOD)/linux/license/gpl/*),)
57 EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/linux/license/proprietary
59 EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/linux/license/gpl
62 SRC += linux/ump_kernel_linux.c linux/ump_kernel_linux_mem.c
66 #obj-m := $(MODULE:.ko=.o)
67 #$(MODULE:.ko=-y) := $(SRC:.c=.o)
69 ifeq ($(MALI_UNIT_TEST),1)
70 $(MODULE:.ko=-objs) := $(SRC:.c=.o) $(RELATIVE_ROOT)/osk/src/linux/lib.a
72 #$(MODULE:.ko=-objs) := $(SRC:.c=.o)
76 # Outside the kernel build system
80 # Get any user defined KDIR-<names> or maybe even a hardcoded KDIR
81 -include KDIR_CONFIGURATION
83 # Define host system directory
84 KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
87 # when compiling for ARM we're cross compiling
88 export CROSS_COMPILE ?= arm-none-linux-gnueabi-
91 # Compiling for the host
92 CONFIG ?= $(shell uname -m)
95 # default cpu to select
96 CPU ?= $(shell uname -m)
98 # look up KDIR based om CPU selection
99 KDIR ?= $(KDIR-$(CPU))
102 $(error No KDIR found for platform $(CPU))
105 # Validate selected config
106 ifneq ($(shell [ -d arch-$(CONFIG) ] && [ -f arch-$(CONFIG)/config.h ] && echo "OK"), OK)
107 $(warning Current directory is $(shell pwd))
108 $(error No configuration found for config $(CONFIG). Check that arch-$(CONFIG)/config.h exists)
110 # Link arch to the selected arch-config directory
111 $(shell [ -L arch ] && rm arch)
112 $(shell ln -sf arch-$(CONFIG) arch)
113 $(shell touch arch/config.h)
117 ifeq ($(MALI_UNIT_TEST),1)
118 $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) KBUILD_EXTRA_SYMBOLS="$(ROOT)/uk/src/ukk/linux/Module.symvers"
120 $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR)
124 ifeq ($(MALI_UNIT_TEST),1)
125 $(MAKE) -C $(KDIR) KBUILD_EXTRA_SYMBOLS="$(ROOT)/uk/src/ukk/linux/Module.symvers" kernelrelease
127 $(MAKE) -C $(KDIR) kernelrelease
131 $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean