1*4882a593Smuzhiyun# 2*4882a593Smuzhiyun# Copyright (C) 2010-2012, 2014, 2016-2017 ARM Limited. All rights reserved. 3*4882a593Smuzhiyun# 4*4882a593Smuzhiyun# This program is free software and is provided to you under the terms of the GNU General Public License version 2 5*4882a593Smuzhiyun# 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*4882a593Smuzhiyun# 7*4882a593Smuzhiyun# A copy of the licence is included with the program, and can also be obtained from Free Software 8*4882a593Smuzhiyun# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 9*4882a593Smuzhiyun# 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun# For each arch check: CROSS_COMPILE , KDIR , CFLAGS += -DARCH 12*4882a593Smuzhiyun 13*4882a593Smuzhiyunexport ARCH ?= arm 14*4882a593SmuzhiyunBUILD ?= debug 15*4882a593Smuzhiyun 16*4882a593Smuzhiyuncheck_cc2 = \ 17*4882a593Smuzhiyun $(shell if $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \ 18*4882a593Smuzhiyun then \ 19*4882a593Smuzhiyun echo "$(2)"; \ 20*4882a593Smuzhiyun else \ 21*4882a593Smuzhiyun echo "$(3)"; \ 22*4882a593Smuzhiyun fi ;) 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun# Check that required parameters are supplied. 25*4882a593Smuzhiyunifeq ($(CONFIG),) 26*4882a593SmuzhiyunCONFIG := default 27*4882a593Smuzhiyunendif 28*4882a593Smuzhiyunifeq ($(CPU)$(KDIR),) 29*4882a593Smuzhiyun$(error "KDIR or CPU must be specified.") 30*4882a593Smuzhiyunendif 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun# Get any user defined KDIR-<names> or maybe even a hardcoded KDIR 33*4882a593Smuzhiyun-include KDIR_CONFIGURATION 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun# Define host system directory 36*4882a593SmuzhiyunKDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build 37*4882a593Smuzhiyun 38*4882a593Smuzhiyunifeq ($(ARCH), arm) 39*4882a593Smuzhiyun# when compiling for ARM we're cross compiling 40*4882a593Smuzhiyunexport CROSS_COMPILE ?= $(call check_cc2, arm-linux-gnueabi-gcc, arm-linux-gnueabi-, arm-none-linux-gnueabi-) 41*4882a593Smuzhiyunendif 42*4882a593Smuzhiyun 43*4882a593Smuzhiyun# look up KDIR based om CPU selection 44*4882a593SmuzhiyunKDIR ?= $(KDIR-$(CPU)) 45*4882a593Smuzhiyun 46*4882a593Smuzhiyunexport CONFIG 47*4882a593Smuzhiyun 48*4882a593Smuzhiyunexport CONFIG_UMP := m 49*4882a593Smuzhiyunifeq ($(BUILD),debug) 50*4882a593Smuzhiyunexport CONFIG_UMP_DEBUG := y 51*4882a593Smuzhiyunelse 52*4882a593Smuzhiyunexport CONFIG_UMP_DEBUG := n 53*4882a593Smuzhiyunendif 54*4882a593Smuzhiyun 55*4882a593Smuzhiyunifeq ($(KDIR),) 56*4882a593Smuzhiyun$(error No KDIR found for platform $(CPU)) 57*4882a593Smuzhiyunendif 58*4882a593Smuzhiyun 59*4882a593Smuzhiyunall: 60*4882a593Smuzhiyun $(MAKE) -C $(KDIR) M=$(CURDIR) modules 61*4882a593Smuzhiyun 62*4882a593Smuzhiyunkernelrelease: 63*4882a593Smuzhiyun $(MAKE) -C $(KDIR) kernelrelease 64*4882a593Smuzhiyun 65*4882a593Smuzhiyunclean: 66*4882a593Smuzhiyun $(MAKE) -C $(KDIR) M=$(CURDIR) clean 67*4882a593Smuzhiyun $(MAKE) -C $(KDIR) M=$(CURDIR)/../mali clean 68