blob: e3d9b076732b71dd8102d968052722fd1f70a01c [file] [log] [blame]
Andrew Walbran2bc0a322019-03-07 15:48:06 +00001# Copyright 2018 The Hafnium Authors.
Andrew Walbran13c3a0b2018-11-30 11:51:53 +00002#
3# This program is free software; you can redistribute it and/or
4# modify it under the terms of the GNU General Public License
5# version 2 as published by the Free Software Foundation.
6#
7# This program is distributed in the hope that it will be useful,
8# but WITHOUT ANY WARRANTY; without even the implied warranty of
9# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10# GNU General Public License for more details.
Andrew Walbran13c3a0b2018-11-30 11:51:53 +000011
Andrew Scull55704232018-08-10 17:19:54 +010012# By default, assume this was checked out as a submodule of the Hafnium repo
13# and that Linux was checked out along side that checkout. These paths can be
14# overridden if that assumption is incorrect.
Andrew Walbran3b4db942019-10-17 19:14:17 +010015HAFNIUM_PATH ?= $(CURDIR)/../..
Andrew Scull82257c42018-10-01 10:37:48 +010016
17ifneq ($(KERNELRELEASE),)
Wedson Almeida Filho2f62b422018-06-19 06:44:32 +010018
19obj-m += hafnium.o
20
21hafnium-y += main.o
Andrew Scull55704232018-08-10 17:19:54 +010022hafnium-y += hf_call.o
23
Andrew Walbran3b4db942019-10-17 19:14:17 +010024ccflags-y = -I$(HAFNIUM_PATH)/inc/vmapi -I$(M)/inc
Wedson Almeida Filho2f62b422018-06-19 06:44:32 +010025
Andrew Scull82257c42018-10-01 10:37:48 +010026else
27
Andrew Scullce08e9e2019-01-03 10:10:33 +000028KERNEL_PATH ?= $(HAFNIUM_PATH)/third_party/linux
Andrew Scull82257c42018-10-01 10:37:48 +010029ARCH ?= arm64
30CROSS_COMPILE ?= aarch64-linux-gnu-
Andrew Scull01778112019-01-14 15:37:53 +000031CHECKPATCH ?= $(KERNEL_PATH)/scripts/checkpatch.pl -q
Andrew Scull82257c42018-10-01 10:37:48 +010032
Wedson Almeida Filho2f62b422018-06-19 06:44:32 +010033all:
Andrew Walbran3b4db942019-10-17 19:14:17 +010034 make -C $(KERNEL_PATH) M=$(CURDIR) O=$(O) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules
Wedson Almeida Filho2f62b422018-06-19 06:44:32 +010035
36clean:
Andrew Walbran3b4db942019-10-17 19:14:17 +010037 make -C $(KERNEL_PATH) M=$(CURDIR) O=$(O) clean
Andrew Scull82257c42018-10-01 10:37:48 +010038
Andrew Scull01778112019-01-14 15:37:53 +000039checkpatch:
Andrew Walbran474c4392019-09-11 13:57:17 +010040 $(CHECKPATCH) -f main.c hf_call.c
Andrew Scull01778112019-01-14 15:37:53 +000041
Andrew Scull82257c42018-10-01 10:37:48 +010042endif