summaryrefslogtreecommitdiff
path: root/arch/s390/tools/Makefile.arm64h
blob: f3f8e9d9bdd8711ada725f96463203aac06228fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# SPDX-License-Identifier: GPL-2.0
#
# Share ARM64 headers with s390 KVM
#

arm64api := $(objtree)/arch/$(ARCH)/include/generated/arm64
arm64uapi := $(objtree)/arch/$(ARCH)/include/generated/uapi/arm64

# List of ARM64 headers to share with s390 KVM
# Format: [uapi:]header.h or header-gen.h
#
# * header.h - from arch/arm64/include/asm/ to arm64/
# * uapi:header.h - from arch/arm64/include/uapi/asm/ to uapi/arm64/
# * header-gen.h - generated as header-gen.h from ARM64 header header.h
# If a header contains partial markers (#if ARM64_S390_COMMON == 1) only this part will be copied.
# If the file does not contain any markers the whole file will be copied.
ARM64_SHARED_HEADERS := \
	brk-imm.h \
	esr.h \
	kvm_arm.h \
	kvm_emulate-gen.h \
	kvm_host.h \
	ptrace-gen.h \
	sysreg-gen.h \
	uapi:hwcap.h \
	uapi:kvm.h \
	uapi:ptrace.h \
	uapi:sve_context.h

filechk_gen_arm_hdr = \
	$(AWK) -f $(src)/copy-arm64h.awk $< || \
	$(AWK) -f $(src)/copy-arm64h-full.awk $< || \
	{ echo "Error: Unbalanced ARM64_S390_COMMON markers in $<" >&2; exit 1; }

arm64-type = $(firstword $(subst :, ,$(1)))
arm64-base = $(or $(word 2,$(subst :, ,$(1))),$(1))
arm64-src-base = $(patsubst %-gen.h,%.h,$(call arm64-base,$(1)))

arm64-src = $(srctree)/arch/arm64/include/$(if $(filter uapi,$(call arm64-type,$(1))),uapi/)asm/$(call arm64-src-base,$(1))
arm64-dst = $(if $(filter uapi,$(call arm64-type,$(1))),$(arm64uapi),$(arm64api))/$(call arm64-base,$(1))

$(foreach hdr,$(ARM64_SHARED_HEADERS),\
	$(eval $(call arm64-dst,$(hdr)): $(call arm64-src,$(hdr)) $(src)/copy-arm64h.awk $(src)/copy-arm64h-full.awk FORCE))

ARM64_TARGETS := $(sort $(foreach hdr,$(ARM64_SHARED_HEADERS),$(call arm64-dst,$(hdr))))
$(ARM64_TARGETS):
	$(call filechk,gen_arm_hdr)

filechk_gen_sysreg_arm64 = \
	$(AWK) -f $(srctree)/arch/arm64/tools/gen-sysreg.awk $(srctree)/arch/arm64/tools/sysreg

$(arm64api)/sysreg-defs.h: $(srctree)/arch/arm64/tools/gen-sysreg.awk $(srctree)/arch/arm64/tools/sysreg FORCE
	$(call filechk,gen_sysreg_arm64)

ARM64_TARGETS += $(arm64api)/sysreg-defs.h