blob: 0f234fee01821a02538ea3fbeb9d7304b8493430 [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
Raghu Krishnamurthyad9005b2021-10-13 13:09:57 -070022hafnium-y += vmlib/aarch64/hvc_call.o
Andrew Walbran196ed0e2020-04-30 11:32:29 +010023hafnium-y += vmlib/ffa.o
Andrew Scull55704232018-08-10 17:19:54 +010024
Andrew Walbran3b4db942019-10-17 19:14:17 +010025ccflags-y = -I$(HAFNIUM_PATH)/inc/vmapi -I$(M)/inc
Wedson Almeida Filho2f62b422018-06-19 06:44:32 +010026
Andrew Scull82257c42018-10-01 10:37:48 +010027else
28
Andrew Scullce08e9e2019-01-03 10:10:33 +000029KERNEL_PATH ?= $(HAFNIUM_PATH)/third_party/linux
Andrew Scull82257c42018-10-01 10:37:48 +010030ARCH ?= arm64
31CROSS_COMPILE ?= aarch64-linux-gnu-
Andrew Scull01778112019-01-14 15:37:53 +000032CHECKPATCH ?= $(KERNEL_PATH)/scripts/checkpatch.pl -q
Andrew Scull82257c42018-10-01 10:37:48 +010033
Wedson Almeida Filho2f62b422018-06-19 06:44:32 +010034all:
Andrew Walbran4cc539b2019-11-07 15:42:48 +000035 cp -r $(HAFNIUM_PATH)/vmlib/ $(CURDIR)
Serban Constantinescu06046ea2019-11-07 13:23:00 +000036 make -C $(KERNEL_PATH) HAFNIUM_PATH=$(HAFNIUM_PATH) M=$(CURDIR) O=$(O) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules
Wedson Almeida Filho2f62b422018-06-19 06:44:32 +010037
38clean:
Serban Constantinescu06046ea2019-11-07 13:23:00 +000039 make -C $(KERNEL_PATH) HAFNIUM_PATH=$(HAFNIUM_PATH) M=$(CURDIR) O=$(O) clean
Andrew Walbran4cc539b2019-11-07 15:42:48 +000040 rm -rf vmlib
Andrew Scull82257c42018-10-01 10:37:48 +010041
Andrew Scull01778112019-01-14 15:37:53 +000042checkpatch:
Andrew Walbran4cc539b2019-11-07 15:42:48 +000043 $(CHECKPATCH) -f main.c
Andrew Scull01778112019-01-14 15:37:53 +000044
Andrew Scull82257c42018-10-01 10:37:48 +010045endif