1
2# Don't use an OBJDIR
3.OBJDIR: ${.CURDIR}
4
5.include <bsd.sysdir.mk>
6.include <src.lua.mk>
7
8COMMON_GENERATED=	proto.h		\
9			syscall.h	\
10			syscalls.c	\
11			sysent.c	\
12			systrace_args.c
13
14GENERATED_PREFIX?=
15GENERATED?=	${COMMON_GENERATED:S/^/${GENERATED_PREFIX}/}
16SYSENT_FILE?=	syscalls.master
17SYSENT_CONF?=	syscalls.conf
18
19# Including Makefile should override SYSENT_FILE and SYSENT_CONF as needed,
20# and set GENERATED.
21SRCS+=	${SYSENT_FILE}
22SRCS+=	${SYSENT_CONF}
23
24# Ensure that the target gets updated if the capabilities file is modified,
25# even though it is not an explicit input to makesyscalls.lua.  For some
26# targets, like Linux system calls, this is unnecessary, but a spurious rebuild
27# is both rare and harmless.
28SRCS+=	${CAPABILITIES_CONF}
29
30MAKESYSCALLS_INTERP?=	${LUA}
31MAKESYSCALLS_SCRIPT?=	${SYSDIR}/tools/makesyscalls.lua
32MAKESYSCALLS=	${MAKESYSCALLS_INTERP} ${MAKESYSCALLS_SCRIPT}
33
34all:
35	@echo "make sysent only"
36
37# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
38# potentially once for each ${GENERATED} file.
39.ORDER: ${GENERATED}
40sysent: ${GENERATED}
41
42# We slap a .PHONY on makesyscalls.lua so that we regenerate every single time,
43# for now, which can be less painful across rebases or other things that may
44# have odd effects on mtimes.
45${MAKESYSCALLS_SCRIPT}: .PHONY
46
47${GENERATED}: ${MAKESYSCALLS_SCRIPT} ${SRCS}
48	${MAKESYSCALLS} ${SYSENT_FILE} ${SYSENT_CONF}
49