Date: Sat, 18 Jan 2020 20:37:45 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356868 - in head/sys: amd64/linux amd64/linux32 arm/linux arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 conf i386/linux kern Message-ID: <202001182037.00IKbjqs066347@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Sat Jan 18 20:37:45 2020 New Revision: 356868 URL: https://svnweb.freebsd.org/changeset/base/356868 Log: 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 Added: head/sys/conf/sysent.mk - copied, changed from r356867, head/sys/kern/Makefile Modified: head/sys/amd64/linux/Makefile head/sys/amd64/linux32/Makefile head/sys/arm/linux/Makefile head/sys/arm64/linux/Makefile head/sys/compat/cloudabi32/Makefile head/sys/compat/cloudabi64/Makefile head/sys/compat/freebsd32/Makefile head/sys/i386/linux/Makefile head/sys/kern/Makefile Modified: head/sys/amd64/linux/Makefile ============================================================================== --- head/sys/amd64/linux/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/amd64/linux/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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" Modified: head/sys/amd64/linux32/Makefile ============================================================================== --- head/sys/amd64/linux32/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/amd64/linux32/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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" Modified: head/sys/arm/linux/Makefile ============================================================================== --- head/sys/arm/linux/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/arm/linux/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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" Modified: head/sys/arm64/linux/Makefile ============================================================================== --- head/sys/arm64/linux/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/arm64/linux/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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" Modified: head/sys/compat/cloudabi32/Makefile ============================================================================== --- head/sys/compat/cloudabi32/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/compat/cloudabi32/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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" Modified: head/sys/compat/cloudabi64/Makefile ============================================================================== --- head/sys/compat/cloudabi64/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/compat/cloudabi64/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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" Modified: head/sys/compat/freebsd32/Makefile ============================================================================== --- head/sys/compat/freebsd32/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/compat/freebsd32/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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" Copied and modified: head/sys/conf/sysent.mk (from r356867, head/sys/kern/Makefile) ============================================================================== --- head/sys/kern/Makefile Sat Jan 18 20:19:07 2020 (r356867, copy source) +++ head/sys/conf/sysent.mk Sat Jan 18 20:37:45 2020 (r356868) @@ -1,23 +1,28 @@ -# @(#)Makefile 8.2 (Berkeley) 3/21/94 # $FreeBSD$ -# -# Makefile for init_sysent # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +.include <bsd.sysdir.mk> .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 +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" @@ -27,4 +32,4 @@ all: sysent: ${GENERATED} ${GENERATED}: ${MAKESYSCALLS} ${SRCS} - ${LUA} ${MAKESYSCALLS} syscalls.master + ${LUA} ${MAKESYSCALLS} ${SYSENT_FILE} ${SYSENT_CONF} Modified: head/sys/i386/linux/Makefile ============================================================================== --- head/sys/i386/linux/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/i386/linux/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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" Modified: head/sys/kern/Makefile ============================================================================== --- head/sys/kern/Makefile Sat Jan 18 20:19:07 2020 (r356867) +++ head/sys/kern/Makefile Sat Jan 18 20:37:45 2020 (r356868) @@ -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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001182037.00IKbjqs066347>