tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / r4p0_rel0 / Makefile
1 #
2 # Copyright (C) 2010-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 USE_UMPV2=0
12 USING_PROFILING ?= 1
13 USING_INTERNAL_PROFILING ?= 0
14 USING_POWER_PERFORMANCE_POLICY ?= 0
15 MALI_HEATMAPS_ENABLED ?= 0
16 MALI_DMA_BUF_MAP_ON_ATTACH ?= 1
17 MALI_PMU_PARALLEL_POWER_UP ?= 0
18
19 # The Makefile sets up "arch" based on the CONFIG, creates the version info
20 # string and the __malidrv_build_info.c file, and then call the Linux build
21 # system to actually build the driver. After that point the Kbuild file takes
22 # over.
23
24 # set up defaults if not defined by the user
25 ARCH ?= arm
26
27 OSKOS=linux
28 FILES_PREFIX=
29
30 check_cc2 = \
31         $(shell if $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
32         then \
33                 echo "$(2)"; \
34         else \
35                 echo "$(3)"; \
36         fi ;)
37
38 # This conditional makefile exports the global definition ARM_INTERNAL_BUILD. Customer releases will not include arm_internal.mak
39 -include ../../../arm_internal.mak
40
41 # Give warning of old config parameters are used
42 ifneq ($(CONFIG),)
43 $(warning "You have specified the CONFIG variable which is no longer in used. Use TARGET_PLATFORM instead.")
44 endif
45
46 ifneq ($(CPU),)
47 $(warning "You have specified the CPU variable which is no longer in used. Use TARGET_PLATFORM instead.")
48 endif
49
50 # Include the mapping between TARGET_PLATFORM and KDIR + MALI_PLATFORM
51 -include MALI_CONFIGURATION
52 export KDIR ?= $(KDIR-$(TARGET_PLATFORM))
53 export MALI_PLATFORM ?= $(MALI_PLATFORM-$(TARGET_PLATFORM))
54
55 ifneq ($(TARGET_PLATFORM),)
56 ifeq ($(MALI_PLATFORM),)
57 $(error "Invalid TARGET_PLATFORM: $(TARGET_PLATFORM)")
58 endif
59 endif
60
61 # validate lookup result
62 ifeq ($(KDIR),)
63 $(error No KDIR found for platform $(TARGET_PLATFORM))
64 endif
65
66
67 ifeq ($(USING_UMP),1)
68 export CONFIG_MALI400_UMP=y
69 export EXTRA_DEFINES += -DCONFIG_MALI400_UMP=1
70 ifeq ($(USE_UMPV2),1)
71 UMP_SYMVERS_FILE ?= ../umpv2/Module.symvers
72 else
73 UMP_SYMVERS_FILE ?= ../ump/Module.symvers
74 endif
75 KBUILD_EXTRA_SYMBOLS = $(realpath $(UMP_SYMVERS_FILE))
76 $(warning $(KBUILD_EXTRA_SYMBOLS))
77 endif
78
79 # Define host system directory
80 KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
81
82 include $(KDIR)/.config
83
84 ifeq ($(ARCH), arm)
85 # when compiling for ARM we're cross compiling
86 export CROSS_COMPILE ?= $(call check_cc2, arm-linux-gnueabi-gcc, arm-linux-gnueabi-, arm-none-linux-gnueabi-)
87 endif
88
89 # report detected/selected settings
90 ifdef ARM_INTERNAL_BUILD
91 $(warning TARGET_PLATFORM $(TARGET_PLATFORM))
92 $(warning KDIR $(KDIR))
93 $(warning MALI_PLATFORM $(MALI_PLATFORM))
94 endif
95
96 # Set up build config
97 export CONFIG_MALI400=m
98
99 export EXTRA_DEFINES += -DCONFIG_MALI400=1
100
101 ifneq ($(MALI_PLATFORM),)
102 export EXTRA_DEFINES += -DMALI_FAKE_PLATFORM_DEVICE=1
103 export MALI_PLATFORM_FILES = $(wildcard platform/$(MALI_PLATFORM)/*.c)
104 endif
105
106 ifeq ($(USING_PROFILING),1)
107 ifeq ($(CONFIG_TRACEPOINTS),)
108 $(warning CONFIG_TRACEPOINTS required for profiling)
109 else
110 export CONFIG_MALI400_PROFILING=y
111 export EXTRA_DEFINES += -DCONFIG_MALI400_PROFILING=1
112 ifeq ($(USING_INTERNAL_PROFILING),1)
113 export CONFIG_MALI400_INTERNAL_PROFILING=y
114 export EXTRA_DEFINES += -DCONFIG_MALI400_INTERNAL_PROFILING=1
115 endif
116 ifeq ($(MALI_HEATMAPS_ENABLED),1)
117 export MALI_HEATMAPS_ENABLED=y
118 export EXTRA_DEFINES += -DCONFIG_MALI400_HEATMAPS_ENABLED
119 endif
120 endif
121 endif
122
123 ifeq ($(MALI_DMA_BUF_MAP_ON_ATTACH),1)
124 export CONFIG_MALI_DMA_BUF_MAP_ON_ATTACH=y
125 export EXTRA_DEFINES += -DCONFIG_MALI_DMA_BUF_MAP_ON_ATTACH
126 endif
127
128 ifeq ($(MALI_SHARED_INTERRUPTS),1)
129 export CONFIG_MALI_SHARED_INTERRUPTS=y
130 export EXTRA_DEFINES += -DCONFIG_MALI_SHARED_INTERRUPTS
131 endif
132
133 ifeq ($(USING_POWER_PERFORMANCE_POLICY),1)
134 export CONFIG_MALI400_POWER_PERFORMANCE_POLICY=y
135 export EXTRA_DEFINES += -DCONFIG_MALI400_POWER_PERFORMANCE_POLICY
136 endif
137
138 ifeq ($(MALI_PMU_PARALLEL_POWER_UP),1)
139 export CONFIG_MALI_PMU_PARALLEL_POWER_UP=y
140 export EXTRA_DEFINES += -DCONFIG_MALI_PMU_PARALLEL_POWER_UP
141 endif
142
143 ifneq ($(BUILD),release)
144 export CONFIG_MALI400_DEBUG=y
145 endif
146
147 all: $(UMP_SYMVERS_FILE)
148         $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) modules
149         @rm $(FILES_PREFIX)__malidrv_build_info.c $(FILES_PREFIX)__malidrv_build_info.o
150
151 clean:
152         $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
153
154 kernelrelease:
155         $(MAKE) ARCH=$(ARCH) -C $(KDIR) kernelrelease
156
157 export CONFIG KBUILD_EXTRA_SYMBOLS