1# Copyright 2025 The Hafnium Authors. 2# 3# Use of this source code is governed by a BSD-style 4# license that can be found in the LICENSE file or at 5# https://opensource.org/licenses/BSD-3-Clause. 6 7# Resolve Hafnium, TF-A and TF-A-Test directories, from this Makefile's location 8HAFNIUM_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/..) 9TFA_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/../../trusted-firmware-a) 10TFTF_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/../../tf-a-tests) 11 12HAFNIUM_TFTF_CONFIG := hafnium-tftf.yaml 13SHRINKWRAP := shrinkwrap 14 15# Named `test_` rather than `test` because make will not run the target if the 16# `test` directory has not changed. 17.PHONY: test_ 18test_: all 19 ./kokoro/test.sh 20 21.PHONY: test_spmc 22test_spmc: all 23 ./kokoro/test_spmc.sh 24 25.PHONY: test_el3_spmc 26test_el3_spmc: all 27 ./kokoro/test_el3_spmc.sh 28 29.PHONY: test_tftf_clean 30test_tftf_clean: 31 @echo "[+] Cleaning Shrinkwrap build artifacts for $(HAFNIUM_TFTF_CONFIG)" 32 $(SHRINKWRAP) --runtime=null clean $(HAFNIUM_TFTF_CONFIG) \ 33 --overlay=clean.yaml --verbose 34 35.PHONY: test_tftf_build 36test_tftf_build: 37# Check for locally checked-out repos of Hafnium, TF-A, and TFTF. 38# If present, build using local sources and disable Shrinkwrap syncing. 39ifeq ($(strip $(shell \ 40 test -d "$(HAFNIUM_DIR)/.git" && \ 41 test -d "$(TFA_DIR)/.git" && \ 42 test -d "$(TFTF_DIR)/.git" && echo OK)),OK) 43 @echo "[+] Using local sources from $(HAFNIUM_DIR), $(TFA_DIR), $(TFTF_DIR)" 44 $(SHRINKWRAP) --runtime=null build $(HAFNIUM_TFTF_CONFIG) \ 45 --overlay=local-src.yaml \ 46 --btvar=HAFNIUM_SRC=$(HAFNIUM_DIR) \ 47 --btvar=TFA_SRC=$(TFA_DIR) \ 48 --btvar=TFTF_SRC=$(TFTF_DIR) \ 49 --no-sync-all \ 50 --verbose 51else 52 @echo "[!] One or more local repos not found — falling back to remote clone" 53 @echo "[+] Building from Hafnium root: $(HAFNIUM_DIR)" 54 $(SHRINKWRAP) --runtime=null build \ 55 --btvar=HAFNIUM_SRC=$(HAFNIUM_DIR) \ 56 $(HAFNIUM_TFTF_CONFIG) \ 57 --no-sync=hafnium \ 58 --verbose 59endif 60 61.PHONY: test_tftf_run 62test_tftf_run: 63 @echo "[+] Running $(HAFNIUM_TFTF_CONFIG) on FVP..." 64 $(SHRINKWRAP) --runtime=null run $(HAFNIUM_TFTF_CONFIG) 65 66.PHONY: test_tftf 67test_tftf: test_tftf_build test_tftf_run 68