xref: /linux/arch/x86/entry/syscalls/Makefile (revision 1f57d5d85ba7f1f467173ff33f51d01a91f9aaf1)
1*1f57d5d8SIngo Molnarout := $(obj)/../../include/generated/asm
2*1f57d5d8SIngo Molnaruapi := $(obj)/../../include/generated/uapi/asm
3*1f57d5d8SIngo Molnar
4*1f57d5d8SIngo Molnar# Create output directory if not already present
5*1f57d5d8SIngo Molnar_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)') \
6*1f57d5d8SIngo Molnar	  $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')
7*1f57d5d8SIngo Molnar
8*1f57d5d8SIngo Molnarsyscall32 := $(srctree)/$(src)/syscall_32.tbl
9*1f57d5d8SIngo Molnarsyscall64 := $(srctree)/$(src)/syscall_64.tbl
10*1f57d5d8SIngo Molnar
11*1f57d5d8SIngo Molnarsyshdr := $(srctree)/$(src)/syscallhdr.sh
12*1f57d5d8SIngo Molnarsystbl := $(srctree)/$(src)/syscalltbl.sh
13*1f57d5d8SIngo Molnar
14*1f57d5d8SIngo Molnarquiet_cmd_syshdr = SYSHDR  $@
15*1f57d5d8SIngo Molnar      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
16*1f57d5d8SIngo Molnar		   '$(syshdr_abi_$(basetarget))' \
17*1f57d5d8SIngo Molnar		   '$(syshdr_pfx_$(basetarget))' \
18*1f57d5d8SIngo Molnar		   '$(syshdr_offset_$(basetarget))'
19*1f57d5d8SIngo Molnarquiet_cmd_systbl = SYSTBL  $@
20*1f57d5d8SIngo Molnar      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
21*1f57d5d8SIngo Molnar
22*1f57d5d8SIngo Molnarquiet_cmd_hypercalls = HYPERCALLS $@
23*1f57d5d8SIngo Molnar      cmd_hypercalls = $(CONFIG_SHELL) '$<' $@ $(filter-out $<,$^)
24*1f57d5d8SIngo Molnar
25*1f57d5d8SIngo Molnarsyshdr_abi_unistd_32 := i386
26*1f57d5d8SIngo Molnar$(uapi)/unistd_32.h: $(syscall32) $(syshdr)
27*1f57d5d8SIngo Molnar	$(call if_changed,syshdr)
28*1f57d5d8SIngo Molnar
29*1f57d5d8SIngo Molnarsyshdr_abi_unistd_32_ia32 := i386
30*1f57d5d8SIngo Molnarsyshdr_pfx_unistd_32_ia32 := ia32_
31*1f57d5d8SIngo Molnar$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr)
32*1f57d5d8SIngo Molnar	$(call if_changed,syshdr)
33*1f57d5d8SIngo Molnar
34*1f57d5d8SIngo Molnarsyshdr_abi_unistd_x32 := common,x32
35*1f57d5d8SIngo Molnarsyshdr_offset_unistd_x32 := __X32_SYSCALL_BIT
36*1f57d5d8SIngo Molnar$(uapi)/unistd_x32.h: $(syscall64) $(syshdr)
37*1f57d5d8SIngo Molnar	$(call if_changed,syshdr)
38*1f57d5d8SIngo Molnar
39*1f57d5d8SIngo Molnarsyshdr_abi_unistd_64 := common,64
40*1f57d5d8SIngo Molnar$(uapi)/unistd_64.h: $(syscall64) $(syshdr)
41*1f57d5d8SIngo Molnar	$(call if_changed,syshdr)
42*1f57d5d8SIngo Molnar
43*1f57d5d8SIngo Molnarsyshdr_abi_unistd_64_x32 := x32
44*1f57d5d8SIngo Molnarsyshdr_pfx_unistd_64_x32 := x32_
45*1f57d5d8SIngo Molnar$(out)/unistd_64_x32.h: $(syscall64) $(syshdr)
46*1f57d5d8SIngo Molnar	$(call if_changed,syshdr)
47*1f57d5d8SIngo Molnar
48*1f57d5d8SIngo Molnar$(out)/syscalls_32.h: $(syscall32) $(systbl)
49*1f57d5d8SIngo Molnar	$(call if_changed,systbl)
50*1f57d5d8SIngo Molnar$(out)/syscalls_64.h: $(syscall64) $(systbl)
51*1f57d5d8SIngo Molnar	$(call if_changed,systbl)
52*1f57d5d8SIngo Molnar
53*1f57d5d8SIngo Molnar$(out)/xen-hypercalls.h: $(srctree)/scripts/xen-hypercalls.sh
54*1f57d5d8SIngo Molnar	$(call if_changed,hypercalls)
55*1f57d5d8SIngo Molnar
56*1f57d5d8SIngo Molnar$(out)/xen-hypercalls.h: $(srctree)/include/xen/interface/xen*.h
57*1f57d5d8SIngo Molnar
58*1f57d5d8SIngo Molnaruapisyshdr-y			+= unistd_32.h unistd_64.h unistd_x32.h
59*1f57d5d8SIngo Molnarsyshdr-y			+= syscalls_32.h
60*1f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= unistd_32_ia32.h unistd_64_x32.h
61*1f57d5d8SIngo Molnarsyshdr-$(CONFIG_X86_64)		+= syscalls_64.h
62*1f57d5d8SIngo Molnarsyshdr-$(CONFIG_XEN)		+= xen-hypercalls.h
63*1f57d5d8SIngo Molnar
64*1f57d5d8SIngo Molnartargets	+= $(uapisyshdr-y) $(syshdr-y)
65*1f57d5d8SIngo Molnar
66*1f57d5d8SIngo MolnarPHONY += all
67*1f57d5d8SIngo Molnarall: $(addprefix $(uapi)/,$(uapisyshdr-y))
68*1f57d5d8SIngo Molnarall: $(addprefix $(out)/,$(syshdr-y))
69*1f57d5d8SIngo Molnar	@:
70