• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2012, 2016-2017 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# default to building for the host
12ARCH ?= $(shell uname -m)
13
14# linux build system integration
15
16ifneq ($(KERNELRELEASE),)
17# Inside the kernel build system
18
19EXTRA_CFLAGS += -I$(KBUILD_EXTMOD)
20
21SRC =	umplock_driver.c
22
23MODULE:=umplock.ko
24
25obj-m := $(MODULE:.ko=.o)
26$(MODULE:.ko=-y) := $(SRC:.c=.o)
27
28$(MODULE:.ko=-objs) := $(SRC:.c=.o)
29
30else
31# Outside the kernel build system
32#
33#
34
35# Get any user defined KDIR-<names> or maybe even a hardcoded KDIR
36-include KDIR_CONFIGURATION
37
38# Define host system directory
39KDIR-$(shell uname -m):=/lib/modules/$(shell uname -r)/build
40
41ifeq ($(ARCH), arm)
42	# when compiling for ARM we're cross compiling
43	export CROSS_COMPILE ?= arm-none-linux-gnueabi-
44	CONFIG ?= arm
45else
46	# Compiling for the host
47	CONFIG ?= $(shell uname -m)
48endif
49
50# default cpu to select
51CPU ?= $(shell uname -m)
52
53# look up KDIR based om CPU selection
54KDIR ?= $(KDIR-$(CPU))
55
56ifeq ($(KDIR),)
57$(error No KDIR found for platform $(CPU))
58endif
59
60all:
61	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR)
62
63kernelrelease:
64	$(MAKE) -C $(KDIR) kernelrelease
65
66clean:
67	$(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
68
69endif
70