xref: /openbmc/linux/arch/mips/kernel/syscalls/Makefile (revision 5f66f73b)
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
8syscalln32 := $(src)/syscall_n32.tbl
9syscalln64 := $(src)/syscall_n64.tbl
10syscallo32 := $(src)/syscall_o32.tbl
11syshdr := $(srctree)/scripts/syscallhdr.sh
12sysnr := $(srctree)/$(src)/syscallnr.sh
13systbl := $(srctree)/scripts/syscalltbl.sh
14
15quiet_cmd_syshdr = SYSHDR  $@
16      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --offset __NR_Linux $< $@
17
18quiet_cmd_sysnr = SYSNR   $@
19      cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@'		\
20		  '$(sysnr_abis_$(basetarget))'			\
21		  '$(sysnr_pfx_$(basetarget))'			\
22		  '$(sysnr_offset_$(basetarget))'
23
24quiet_cmd_systbl = SYSTBL  $@
25      cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
26
27$(uapi)/unistd_n32.h: $(syscalln32) $(syshdr) FORCE
28	$(call if_changed,syshdr)
29
30$(uapi)/unistd_n64.h: $(syscalln64) $(syshdr) FORCE
31	$(call if_changed,syshdr)
32
33$(uapi)/unistd_o32.h: $(syscallo32) $(syshdr) FORCE
34	$(call if_changed,syshdr)
35
36sysnr_pfx_unistd_nr_n32 := N32
37sysnr_offset_unistd_nr_n32 := 6000
38$(kapi)/unistd_nr_n32.h: $(syscalln32) $(sysnr) FORCE
39	$(call if_changed,sysnr)
40
41sysnr_pfx_unistd_nr_n64 := 64
42sysnr_offset_unistd_nr_n64 := 5000
43$(kapi)/unistd_nr_n64.h: $(syscalln64) $(sysnr) FORCE
44	$(call if_changed,sysnr)
45
46sysnr_pfx_unistd_nr_o32 := O32
47sysnr_offset_unistd_nr_o32 := 4000
48$(kapi)/unistd_nr_o32.h: $(syscallo32) $(sysnr) FORCE
49	$(call if_changed,sysnr)
50
51$(kapi)/syscall_table_n32.h: $(syscalln32) $(systbl) FORCE
52	$(call if_changed,systbl)
53
54$(kapi)/syscall_table_n64.h: $(syscalln64) $(systbl) FORCE
55	$(call if_changed,systbl)
56
57$(kapi)/syscall_table_o32.h: $(syscallo32) $(systbl) FORCE
58	$(call if_changed,systbl)
59
60uapisyshdr-y		+= unistd_n32.h			\
61			   unistd_n64.h			\
62			   unistd_o32.h
63kapisyshdr-y		+= syscall_table_n32.h		\
64			   syscall_table_n64.h		\
65			   syscall_table_o32.h		\
66			   unistd_nr_n32.h		\
67			   unistd_nr_n64.h		\
68			   unistd_nr_o32.h
69
70uapisyshdr-y	:= $(addprefix $(uapi)/, $(uapisyshdr-y))
71kapisyshdr-y	:= $(addprefix $(kapi)/, $(kapisyshdr-y))
72targets		+= $(addprefix ../../../../, $(uapisyshdr-y) $(kapisyshdr-y))
73
74PHONY += all
75all: $(uapisyshdr-y) $(kapisyshdr-y)
76	@:
77