xref: /openbmc/linux/arch/mips/kernel/syscalls/Makefile (revision a9d85efb)
1# SPDX-License-Identifier: GPL-2.0
2kapi := arch/$(SRCARCH)/include/generated/asm
3uapi := arch/$(SRCARCH)/include/generated/uapi/asm
4
5_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')	\
6	  $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
7
8syshdr := $(srctree)/scripts/syscallhdr.sh
9sysnr := $(srctree)/$(src)/syscallnr.sh
10systbl := $(srctree)/scripts/syscalltbl.sh
11
12quiet_cmd_syshdr = SYSHDR  $@
13      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --offset __NR_Linux $< $@
14
15quiet_cmd_sysnr = SYSNR   $@
16      cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@'		\
17		  '$(sysnr_abis_$(basetarget))'			\
18		  '$(sysnr_pfx_$(basetarget))'
19
20quiet_cmd_systbl = SYSTBL  $@
21      cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
22
23$(uapi)/unistd_%.h: $(src)/syscall_%.tbl $(syshdr) FORCE
24	$(call if_changed,syshdr)
25
26sysnr_pfx_unistd_nr_n32 := N32
27sysnr_pfx_unistd_nr_n64 := 64
28sysnr_pfx_unistd_nr_o32 := O32
29
30$(kapi)/unistd_nr_%.h: $(src)/syscall_%.tbl $(sysnr) FORCE
31	$(call if_changed,sysnr)
32
33$(kapi)/syscall_table_%.h: $(src)/syscall_%.tbl $(systbl) FORCE
34	$(call if_changed,systbl)
35
36uapisyshdr-y		+= unistd_n32.h			\
37			   unistd_n64.h			\
38			   unistd_o32.h
39kapisyshdr-y		+= syscall_table_n32.h		\
40			   syscall_table_n64.h		\
41			   syscall_table_o32.h		\
42			   unistd_nr_n32.h		\
43			   unistd_nr_n64.h		\
44			   unistd_nr_o32.h
45
46uapisyshdr-y	:= $(addprefix $(uapi)/, $(uapisyshdr-y))
47kapisyshdr-y	:= $(addprefix $(kapi)/, $(kapisyshdr-y))
48targets		+= $(addprefix ../../../../, $(uapisyshdr-y) $(kapisyshdr-y))
49
50PHONY += all
51all: $(uapisyshdr-y) $(kapisyshdr-y)
52	@:
53