tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / Makefile
1 #
2 # Copyright (C) 2011-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
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
18 # over.
19
20 # set up defaults if not defined by the user
21 ARCH ?= arm
22
23 OSKOS=linux
24 FILES_PREFIX=
25
26 check_cc2 = \
27         $(shell if $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
28         then \
29                 echo "$(2)"; \
30         else \
31                 echo "$(3)"; \
32         fi ;)
33
34 # This conditional makefile exports the global definition ARM_INTERNAL_BUILD. Customer releases will not include arm_internal.mak
35 -include ../../../arm_internal.mak
36
37 # Give warning of old config parameters are used
38 ifneq ($(CONFIG),)
39 $(warning "You have specified the CONFIG variable which is no longer in used. Use TARGET_PLATFORM instead.")
40 endif
41
42 ifneq ($(CPU),)
43 $(warning "You have specified the CPU variable which is no longer in used. Use TARGET_PLATFORM instead.")
44 endif
45
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))
50
51 ifneq ($(TARGET_PLATFORM),)
52 ifeq ($(MALI_PLATFORM),)
53 $(error "Invalid TARGET_PLATFORM: $(TARGET_PLATFORM)")
54 endif
55 endif
56
57 # validate lookup result
58 ifeq ($(KDIR),)
59 $(error No KDIR found for platform $(TARGET_PLATFORM))
60 endif
61
62
63 ifeq ($(USING_UMP),1)
64 export CONFIG_MALI400_UMP=y
65 export EXTRA_DEFINES += -DCONFIG_MALI400_UMP=1
66 ifeq ($(USE_UMPV2),1)
67 UMP_SYMVERS_FILE ?= ../umpv2/Module.symvers
68 else
69 UMP_SYMVERS_FILE ?= ../ump/Module.symvers
70 endif
71 KBUILD_EXTRA_SYMBOLS = $(realpath $(UMP_SYMVERS_FILE))
72 $(warning $(KBUILD_EXTRA_SYMBOLS))
73 endif
74
75 # Define host system directory
76 KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
77
78 include $(KDIR)/.config
79
80 ifeq ($(ARCH), arm)
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-)
83 endif
84
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))
90 endif
91
92 # Set up build config
93 export CONFIG_MALI400=m
94
95 ifneq ($(MALI_PLATFORM),)
96 export MALI_PLATFORM_FILES = $(wildcard platform/$(MALI_PLATFORM)/*.c)
97 endif
98
99 ifeq ($(USING_PROFILING),1)
100 ifeq ($(CONFIG_TRACEPOINTS),)
101 $(warning CONFIG_TRACEPOINTS reqired for profiling)
102 else
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
108 endif
109 endif
110 endif
111
112 ifneq ($(BUILD),release)
113 export CONFIG_MALI400_DEBUG=y
114 endif
115
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
119
120 clean:
121         $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
122
123 kernelrelease:
124         $(MAKE) ARCH=$(ARCH) -C $(KDIR) kernelrelease
125
126 export CONFIG KBUILD_EXTRA_SYMBOLS