Initial commit
[kernel/linux-3.0.git] / drivers / gpu / vithar_rev0 / ump / src / devicedrv / Makefile
1 #
2 # (C) COPYRIGHT 2008-2012 ARM Limited. All rights reserved.
3 #
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.
6 #
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. 
9 #
10 #
11
12
13 ifneq ($(KBUILD_EXTMOD),)
14 OS=linux
15 include $(KBUILD_EXTMOD)/Makefile.common
16 else
17 include $(VITHAR_ROOT)/$(UMP_PATH)/Makefile.common
18 endif
19
20 ifdef CONFIG_ION
21 include $(VITHAR_ROOT)/$(UMP_PATH)/imports/ion/Makefile
22 endif
23
24 # default to building for the host
25 ARCH ?= $(shell uname -m)
26
27 # linux build system integration
28
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 ######################################################################
36
37 ifeq ($(MALI_UNIT_TEST),1)
38 OS=linux
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)
44 endif
45
46 #ifneq ($(KERNELRELEASE),)
47 ifneq ($(VITHAR_ROOT),)
48 # Inside the kernel build system
49
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)
51
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
55
56 ifeq ($(wildcard $(KBUILD_EXTMOD)/linux/license/gpl/*),)
57 EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/linux/license/proprietary
58 else
59 EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)/linux/license/gpl
60 endif
61
62 SRC +=  linux/ump_kernel_linux.c linux/ump_kernel_linux_mem.c
63
64 #MODULE:=ump.ko
65
66 #obj-m := $(MODULE:.ko=.o)
67 #$(MODULE:.ko=-y) := $(SRC:.c=.o)
68
69 ifeq ($(MALI_UNIT_TEST),1)
70 $(MODULE:.ko=-objs) := $(SRC:.c=.o) $(RELATIVE_ROOT)/osk/src/linux/lib.a
71 else
72 #$(MODULE:.ko=-objs) := $(SRC:.c=.o) 
73 endif
74
75 else
76 # Outside the kernel build system
77 #
78 #
79
80 # Get any user defined KDIR-<names> or maybe even a hardcoded KDIR
81 -include KDIR_CONFIGURATION
82
83 # Define host system directory
84 KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
85
86 ifeq ($(ARCH), arm)
87         # when compiling for ARM we're cross compiling
88         export CROSS_COMPILE ?= arm-none-linux-gnueabi-
89         CONFIG ?= arm
90 else
91         # Compiling for the host
92         CONFIG ?= $(shell uname -m)
93 endif
94
95 # default cpu to select
96 CPU ?= $(shell uname -m)
97
98 # look up KDIR based om CPU selection
99 KDIR ?= $(KDIR-$(CPU))
100
101 ifeq ($(KDIR),)
102 $(error No KDIR found for platform $(CPU))
103 endif
104
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)
109 else
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)
114 endif
115
116 all:
117 ifeq ($(MALI_UNIT_TEST),1)
118         $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) KBUILD_EXTRA_SYMBOLS="$(ROOT)/uk/src/ukk/linux/Module.symvers"
119 else
120         $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR)
121 endif
122
123 kernelrelease:
124 ifeq ($(MALI_UNIT_TEST),1)
125         $(MAKE) -C $(KDIR) KBUILD_EXTRA_SYMBOLS="$(ROOT)/uk/src/ukk/linux/Module.symvers" kernelrelease
126 else
127         $(MAKE) -C $(KDIR) kernelrelease
128 endif
129
130 clean:
131         $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
132
133 endif