sysent targets: further cleanup and deduplication

r355473 vastly improved the readability and cleanliness of these Makefiles.
Every single one of them follows the same pattern and duplicates the exact
same logic.

Now that we have GENERATED/SRCS, split SRCS up into the two parameters we'll
use for ${MAKESYSCALLS} rather than assuming a specific ordering of SRCS and
include a common sysent.mk to handle the rest. This makes it less tedious to
make sweeping changes.

Some default values are provided for GENERATED/SYSENT_*; almost all of these
just use a 'syscalls.master' and 'syscalls.conf' in cwd, and they all use
effectively the same filenames with an arbitrary prefix. Most ABIs will be
able to get away with just setting GENERATED_PREFIX and including
^/sys/conf/sysent.mk, while others only need light additions. kern/Makefile
is the notable exception, as it doesn't take a SYSENT_CONF and the generated
files are spread out between ^/sys/kern and ^/sys/sys, but it otherwise fits
the pattern enough to use the common version.

Reviewed by:	brooks, imp
Nice!:		emaste
Differential Revision:	https://reviews.freebsd.org/D23197
This commit is contained in:
Kyle Evans 2020-01-18 20:37:45 +00:00
parent 19d4d771fc
commit 05d7dd739c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356868
10 changed files with 61 additions and 211 deletions

View File

@ -2,27 +2,6 @@
#
# $FreeBSD$
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
GENERATED_PREFIX= linux_
.include <src.lua.mk>
MAKESYSCALLS= ../../tools/makesyscalls.lua
SRCS= syscalls.conf \
syscalls.master
GENERATED= linux_proto.h \
linux_syscall.h \
linux_syscalls.c \
linux_sysent.c \
linux_systrace_args.c
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf
.include "../../conf/sysent.mk"

View File

@ -2,27 +2,6 @@
#
# $FreeBSD$
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
GENERATED_PREFIX= linux32_
.include <src.lua.mk>
MAKESYSCALLS= ../../tools/makesyscalls.lua
SRCS= syscalls.conf \
syscalls.master
GENERATED= linux32_proto.h \
linux32_syscall.h \
linux32_syscalls.c \
linux32_sysent.c \
linux32_systrace_args.c
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf
.include "../../conf/sysent.mk"

View File

@ -2,27 +2,6 @@
#
# $FreeBSD$
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
GENERATED_PREFIX= linux_
.include <src.lua.mk>
MAKESYSCALLS= ../../tools/makesyscalls.lua
SRCS= syscalls.conf \
syscalls.master
GENERATED= linux_proto.h \
linux_syscall.h \
linux_syscalls.c \
linux_sysent.c \
linux_systrace_args.c
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf
.include "../../conf/sysent.mk"

View File

@ -2,27 +2,6 @@
#
# $FreeBSD$
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
GENERATED_PREFIX= linux_
.include <src.lua.mk>
MAKESYSCALLS= ../../tools/makesyscalls.lua
SRCS= syscalls.conf \
syscalls.master
GENERATED= linux_proto.h \
linux_syscall.h \
linux_syscalls.c \
linux_sysent.c \
linux_systrace_args.c
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf
.include "../../conf/sysent.mk"

View File

@ -1,27 +1,6 @@
# $FreeBSD$
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
SYSENT_FILE= ${SYSDIR}/contrib/cloudabi/syscalls32.master
GENERATED_PREFIX= cloudabi32_
.include <src.lua.mk>
MAKESYSCALLS= ../../tools/makesyscalls.lua
SRCS= syscalls.conf \
../../contrib/cloudabi/syscalls32.master
GENERATED= cloudabi32_proto.h \
cloudabi32_syscall.h \
cloudabi32_syscalls.c \
cloudabi32_sysent.c \
cloudabi32_systrace_args.c
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} \
../../contrib/cloudabi/syscalls32.master syscalls.conf
.include "../../conf/sysent.mk"

View File

@ -1,27 +1,6 @@
# $FreeBSD$
.include <src.lua.mk>
SYSENT_FILE= ${SYSDIR}/contrib/cloudabi/syscalls64.master
GENERATED_PREFIX= cloudabi64_
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
MAKESYSCALLS= ../../tools/makesyscalls.lua
SRCS= syscalls.conf \
../../contrib/cloudabi/syscalls64.master
GENERATED= cloudabi64_proto.h \
cloudabi64_syscall.h \
cloudabi64_syscalls.c \
cloudabi64_sysent.c \
cloudabi64_systrace_args.c
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} \
../../contrib/cloudabi/syscalls64.master syscalls.conf
.include "../../conf/sysent.mk"

View File

@ -2,28 +2,6 @@
#
# $FreeBSD$
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
GENERATED_PREFIX= freebsd32_
.include <src.lua.mk>
MAKESYSCALLS= ../../tools/makesyscalls.lua
SRCS= ../../kern/capabilities.conf \
syscalls.conf \
syscalls.master
GENERATED= freebsd32_proto.h \
freebsd32_syscall.h \
freebsd32_syscalls.c \
freebsd32_sysent.c \
freebsd32_systrace_args.c
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf
.include "../../conf/sysent.mk"

35
sys/conf/sysent.mk Normal file
View File

@ -0,0 +1,35 @@
# $FreeBSD$
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
.include <bsd.sysdir.mk>
.include <src.lua.mk>
COMMON_GENERATED= proto.h \
syscall.h \
syscalls.c \
sysent.c \
systrace_args.c
GENERATED_PREFIX?=
GENERATED?= ${COMMON_GENERATED:S/^/${GENERATED_PREFIX}/}
SYSENT_FILE?= syscalls.master
SYSENT_CONF?= syscalls.conf
# Including Makefile should override SYSENT_FILE and SYSENT_CONF as needed,
# and set GENERATED.
SRCS+= ${SYSENT_FILE}
SRCS+= ${SYSENT_CONF}
MAKESYSCALLS= ${SYSDIR}/tools/makesyscalls.lua
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} ${SYSENT_FILE} ${SYSENT_CONF}

View File

@ -2,27 +2,6 @@
#
# $FreeBSD$
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
GENERATED_PREFIX= linux_
.include <src.lua.mk>
MAKESYSCALLS= ../../tools/makesyscalls.lua
SRCS= syscalls.conf \
syscalls.master
GENERATED= linux_proto.h \
linux_syscall.h \
linux_syscalls.c \
linux_sysent.c \
linux_systrace_args.c
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf
.include "../../conf/sysent.mk"

View File

@ -3,28 +3,12 @@
#
# Makefile for init_sysent
# Don't use an OBJDIR
.OBJDIR: ${.CURDIR}
SYSENT_CONF=
GENERATED= init_sysent.c \
syscalls.c \
systrace_args.c \
${SYSDIR}/sys/syscall.h \
${SYSDIR}/sys/syscall.mk \
${SYSDIR}/sys/sysproto.h
.include <src.lua.mk>
MAKESYSCALLS= ../tools/makesyscalls.lua
SRCS= capabilities.conf \
syscalls.master
GENERATED= init_sysent.c \
syscalls.c \
systrace_args.c \
../sys/syscall.h \
../sys/syscall.mk \
../sys/sysproto.h
all:
@echo "make sysent only"
# We .ORDER these explicitly so that we only run MAKESYSCALLS once, rather than
# potentially once for each ${GENERATED} file.
.ORDER: ${GENERATED}
sysent: ${GENERATED}
${GENERATED}: ${MAKESYSCALLS} ${SRCS}
${LUA} ${MAKESYSCALLS} syscalls.master
.include "../conf/sysent.mk"