Skip to content

Commit

Permalink
s390/syscalls: add Makefile to generate system call header files
Browse files Browse the repository at this point in the history
Generate the system call specific files from the archheaders
and archprepare make targets.

Signed-off-by: Hendrik Brueckner <[email protected]>
Acked-by: Heiko Carstens <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
hbrueckner authored and Martin Schwidefsky committed Jan 23, 2018
1 parent fd834e0 commit 5c75824
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/s390/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ drivers-y += drivers/s390/
drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/

boot := arch/s390/boot
syscalls := arch/s390/kernel/syscalls
tools := arch/s390/tools

all: image bzImage
Expand All @@ -132,7 +133,11 @@ archclean:
$(Q)$(MAKE) $(clean)=$(boot)
$(Q)$(MAKE) $(clean)=$(tools)

archheaders:
$(Q)$(MAKE) $(build)=$(syscalls) uapi

archprepare:
$(Q)$(MAKE) $(build)=$(syscalls) kapi
$(Q)$(MAKE) $(build)=$(tools) include/generated/facilities.h
$(Q)$(MAKE) $(build)=$(tools) include/generated/dis.h

Expand Down
52 changes: 52 additions & 0 deletions arch/s390/kernel/syscalls/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-License-Identifier: GPL-2.0

gen := arch/$(ARCH)/include/generated
kapi := $(gen)/asm
uapi := $(gen)/uapi/asm

syscall := $(srctree)/$(src)/syscall.tbl
systbl := $(srctree)/$(src)/syscalltbl

gen-y := $(kapi)/syscall_table.h
kapi-hdrs-y := $(kapi)/unistd_nr.h
uapi-hdrs-y := $(uapi)/unistd_32.h
uapi-hdrs-y += $(uapi)/unistd_64.h

targets += $(addprefix ../../../,$(gen-y) $(kapi-hdrs-y) $(uapi-hdrs-y))

PHONY += kapi uapi

kapi: $(gen-y) $(kapi-hdrs-y)
uapi: $(uapi-hdrs-y)


# Create output directory if not already present
_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')

define filechk_syshdr
$(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2"
endef

define filechk_sysnr
$(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget))
endef

define filechk_syscalls
$(CONFIG_SHELL) '$(systbl)' -S
endef

syshdr_abi_unistd_32 := common,32
$(uapi)/unistd_32.h: $(syscall) FORCE
$(call filechk,syshdr,$@)

syshdr_abi_unistd_64 := common,64
$(uapi)/unistd_64.h: $(syscall) FORCE
$(call filechk,syshdr,$@)

$(kapi)/syscall_table.h: $(syscall) FORCE
$(call filechk,syscalls)

sysnr_abi_unistd_nr := common,32,64
$(kapi)/unistd_nr.h: $(syscall) FORCE
$(call filechk,sysnr)

0 comments on commit 5c75824

Please sign in to comment.