2 # Copyright (C) 2012, 2016 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.
11 # default to building for the host
12 ARCH ?= $(shell uname -m)
14 # linux build system integration
16 ifneq ($(KERNELRELEASE),)
17 # Inside the kernel build system
19 EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)
21 SRC = umplock_driver.c
25 obj-m := $(MODULE:.ko=.o)
26 $(MODULE:.ko=-y) := $(SRC:.c=.o)
28 $(MODULE:.ko=-objs) := $(SRC:.c=.o)
31 # Outside the kernel build system
35 # Get any user defined KDIR-<names> or maybe even a hardcoded KDIR
36 -include KDIR_CONFIGURATION
38 # Define host system directory
39 KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
42 # when compiling for ARM we're cross compiling
43 export CROSS_COMPILE ?= arm-none-linux-gnueabi-
46 # Compiling for the host
47 CONFIG ?= $(shell uname -m)
50 # default cpu to select
51 CPU ?= $(shell uname -m)
53 # look up KDIR based om CPU selection
54 KDIR ?= $(KDIR-$(CPU))
57 $(error No KDIR found for platform $(CPU))
61 $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR)
64 $(MAKE) -C $(KDIR) kernelrelease
67 $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean