Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jan 2020 05:47:56 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r357108 - in stable: 11/sys/amd64/linux 11/sys/amd64/linux32 11/sys/compat/cloudabi32 11/sys/compat/cloudabi64 11/sys/compat/freebsd32 11/sys/compat/svr4 11/sys/conf 11/sys/i386/ibcs2 1...
Message-ID:  <202001250547.00P5luHL011137@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Sat Jan 25 05:47:56 2020
New Revision: 357108
URL: https://svnweb.freebsd.org/changeset/base/357108

Log:
  MFC r355473, r356540, r356604, r356868, r356937: sysent improvements
  
  The main motivation here being .ORDER to render -jN > 1 harmless; svr4/ibcs2
  targets were also refactored a bit, but both are irregular and cannot use
  sysent.mk as-is due to differences in files generated. I have no interest in
  refactoring, since these are gone in head anyways.
  
  r355473: sysent: Reduce duplication and improve readability.
  
  Use the power of variable to avoid spelling out source and generated
  files too many times.  The previous Makefiles were hard to read, hard to
  edit, and badly formatted.
  
  r356540:
  kern/Makefile: systrace_args.c is also generated
  
  r356604:
  Set .ORDER for makesyscalls generated files
  
  When either makesyscalls.lua or syscalls.master changes, all of the
  ${GENERATED} targets are now out-of-date. With make jobs > 1, this means we
  will run the makesyscalls script in parallel for the same ABI, generating
  the same set of output files.
  
  Prior to r356603 , there is a large window for interlacing output for some
  of the generated files that we were generating in-place rather than staging
  in a temp dir. After that, we still should't need to run the script more
  than once per-ABI as the first invocation should update all of them. Add
  .ORDER to do so cleanly.
  
  r356868:
  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.
  
  r356937:
  sysent.mk: split interpreter out of target command
  
  The main objective here is to make it easy to identify what needs to change
  in order to use a different sysent generator than the current Lua-based one,
  which may be used to MFC some of the changes that have happened so we can
  avoid parallel accidents in stable branches, for instance.
  
  As a secondary objective, it's now feasible to override the generator on a
  per-Makefile basis if needed, so that one could refactor their Makefile to
  use this while pinning generation to the legacy makesyscalls.sh. I don't
  anticipate any consistent need for such a thing, but it's low-effort to
  achieve.

Added:
  stable/11/sys/conf/sysent.mk
     - copied, changed from r356868, head/sys/conf/sysent.mk
Modified:
  stable/11/sys/amd64/linux/Makefile
  stable/11/sys/amd64/linux32/Makefile
  stable/11/sys/compat/cloudabi32/Makefile
  stable/11/sys/compat/cloudabi64/Makefile
  stable/11/sys/compat/freebsd32/Makefile
  stable/11/sys/compat/svr4/Makefile
  stable/11/sys/i386/ibcs2/Makefile
  stable/11/sys/i386/linux/Makefile
  stable/11/sys/kern/Makefile
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Added:
  stable/12/sys/conf/sysent.mk
     - copied, changed from r356868, head/sys/conf/sysent.mk
Modified:
  stable/12/sys/amd64/linux/Makefile
  stable/12/sys/amd64/linux32/Makefile
  stable/12/sys/arm64/linux/Makefile
  stable/12/sys/compat/cloudabi32/Makefile
  stable/12/sys/compat/cloudabi64/Makefile
  stable/12/sys/compat/freebsd32/Makefile
  stable/12/sys/i386/ibcs2/Makefile
  stable/12/sys/i386/linux/Makefile
  stable/12/sys/kern/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/amd64/linux/Makefile
==============================================================================
--- stable/11/sys/amd64/linux/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/amd64/linux/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -2,14 +2,6 @@
 #
 # $FreeBSD$
 
-# Don't use an OBJDIR
-.OBJDIR: ${.CURDIR}
+GENERATED_PREFIX=	linux_
 
-all:
-	@echo "make sysent only"
-
-sysent:  linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c
-
-linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \
-		../../kern/makesyscalls.sh syscalls.master syscalls.conf
-	sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+.include "../../conf/sysent.mk"

Modified: stable/11/sys/amd64/linux32/Makefile
==============================================================================
--- stable/11/sys/amd64/linux32/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/amd64/linux32/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -2,14 +2,6 @@
 #
 # $FreeBSD$
 
-# Don't use an OBJDIR
-.OBJDIR: ${.CURDIR}
+GENERATED_PREFIX=	linux32_
 
-all:
-	@echo "make sysent only"
-
-sysent:  linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c
-
-linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c: ../../kern/makesyscalls.sh \
-		syscalls.master syscalls.conf
-	sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+.include "../../conf/sysent.mk"

Modified: stable/11/sys/compat/cloudabi32/Makefile
==============================================================================
--- stable/11/sys/compat/cloudabi32/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/compat/cloudabi32/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -1,17 +1,6 @@
 # $FreeBSD$
 
-# Don't use an OBJDIR
-.OBJDIR: ${.CURDIR}
+SYSENT_FILE=	${SYSDIR}/contrib/cloudabi/syscalls32.master
+GENERATED_PREFIX=	cloudabi32_
 
-all:
-	@echo "make sysent only"
-
-sysent: cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
-    cloudabi32_syscalls.c cloudabi32_systrace_args.c
-
-cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
-    cloudabi32_syscalls.c cloudabi32_systrace_args.c: \
-    ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \
-    syscalls.conf
-	sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls32.master \
-	    syscalls.conf
+.include "../../conf/sysent.mk"

Modified: stable/11/sys/compat/cloudabi64/Makefile
==============================================================================
--- stable/11/sys/compat/cloudabi64/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/compat/cloudabi64/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -1,17 +1,6 @@
 # $FreeBSD$
 
-# Don't use an OBJDIR
-.OBJDIR: ${.CURDIR}
+SYSENT_FILE=	${SYSDIR}/contrib/cloudabi/syscalls64.master
+GENERATED_PREFIX=	cloudabi64_
 
-all:
-	@echo "make sysent only"
-
-sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
-    cloudabi64_syscalls.c cloudabi64_systrace_args.c
-
-cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
-    cloudabi64_syscalls.c cloudabi64_systrace_args.c: \
-    ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \
-    syscalls.conf
-	sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \
-	    syscalls.conf
+.include "../../conf/sysent.mk"

Modified: stable/11/sys/compat/freebsd32/Makefile
==============================================================================
--- stable/11/sys/compat/freebsd32/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/compat/freebsd32/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -2,18 +2,6 @@
 #
 # $FreeBSD$
 
-# Don't use an OBJDIR
-.OBJDIR: ${.CURDIR}
+GENERATED_PREFIX=	freebsd32_
 
-all:
-	@echo "make sysent only"
-
-sysent:  freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c
-
-freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c : \
-	    ../../kern/makesyscalls.sh syscalls.master syscalls.conf capabilities.conf
-	sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
-
-clean:
-	rm -f freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h
-	rm -f freebsd32_systrace_args.c 
+.include "../../conf/sysent.mk"

Modified: stable/11/sys/compat/svr4/Makefile
==============================================================================
--- stable/11/sys/compat/svr4/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/compat/svr4/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -5,12 +5,18 @@
 # Don't use an OBJDIR
 .OBJDIR: ${.CURDIR}
 
+MAKESYSCALLS=	../../kern/makesyscalls.sh
+GENERATED=	svr4_sysent.c		\
+		svr4_syscall.h		\
+		svr4_syscallnames.c	\
+		svr4_proto.h
+
 all:
 	@echo "make sysent only"
 
-sysent:  svr4_sysent.c svr4_syscall.h svr4_proto.h
+.ORDER: ${GENERATED}
+sysent:  ${GENERATED}
 
-svr4_syscallnames.c svr4_sysent.c svr4_syscall.h svr4_proto.h: \
-		../../kern/makesyscalls.sh syscalls.master syscalls.conf
-	sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+${GENERATED}: ${MAKESYSCALLS} syscalls.master syscalls.conf
+	sh ${MAKESYSCALLS} syscalls.master syscalls.conf
 

Copied and modified: stable/11/sys/conf/sysent.mk (from r356868, head/sys/conf/sysent.mk)
==============================================================================
--- head/sys/conf/sysent.mk	Sat Jan 18 20:37:45 2020	(r356868, copy source)
+++ stable/11/sys/conf/sysent.mk	Sat Jan 25 05:47:56 2020	(r357108)
@@ -21,8 +21,11 @@ SYSENT_CONF?=	syscalls.conf
 # and set GENERATED.
 SRCS+=	${SYSENT_FILE}
 SRCS+=	${SYSENT_CONF}
-MAKESYSCALLS=	${SYSDIR}/tools/makesyscalls.lua
 
+MAKESYSCALLS_INTERP?=	sh
+MAKESYSCALLS_SCRIPT?=	${SYSDIR}/kern/makesyscalls.sh
+MAKESYSCALLS=	${MAKESYSCALLS_INTERP} ${MAKESYSCALLS_SCRIPT}
+
 all:
 	@echo "make sysent only"
 
@@ -31,5 +34,5 @@ all:
 .ORDER: ${GENERATED}
 sysent: ${GENERATED}
 
-${GENERATED}: ${MAKESYSCALLS} ${SRCS}
-	${LUA} ${MAKESYSCALLS} ${SYSENT_FILE} ${SYSENT_CONF}
+${GENERATED}: ${MAKESYSCALLS_SCRIPT} ${SRCS}
+	${MAKESYSCALLS} ${SYSENT_FILE} ${SYSENT_CONF}

Modified: stable/11/sys/i386/ibcs2/Makefile
==============================================================================
--- stable/11/sys/i386/ibcs2/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/i386/ibcs2/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -5,23 +5,32 @@
 # Don't use an OBJDIR
 .OBJDIR: ${.CURDIR}
 
+MAKESYSCALLS=		../../kern/makesyscalls.sh
+BASE_GENERATED=		ibcs2_syscall.h		\
+			ibcs2_sysent.c		\
+			ibcs2_proto.h
+ISC_GENERATED=		ibcs2_isc_syscall.h	\
+			ibcs2_isc_sysent.c
+XENIX_GENERATED=	ibcs2_xenix_syscall.h	\
+			ibcs2_xenix_sysent.c	\
+			ibcs2_xenix_proto.h
+
 all:
 	@echo "make sysent, isc_sysent or xenix_sysent only"
 
-sysent:  ibcs2_sysent.c ibcs2_syscall.h ibcs2_proto.h
+.ORDER: ${BASE_GENERATED}
+.ORDER: ${ISC_GENERATED}
+.ORDER: ${XENIX_GENERATED}
 
-ibcs2_sysent.c ibcs2_syscall.h ibcs2_proto.h: ../../kern/makesyscalls.sh \
-		syscalls.master syscalls.conf
-	sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+sysent:  ${BASE_GENERATED}
+isc_sysent: ${ISC_GENERATED}
+xenix_sysent: ${XENIX_GENERATED}
 
-isc_sysent:  ibcs2_isc_sysent.c ibcs2_isc_syscall.h
+${BASE_GENERATED}: ${MAKESYSCALLS} syscalls.master syscalls.conf
+	sh ${MAKESYSCALLS} syscalls.master syscalls.conf
 
-ibcs2_isc_sysent.c ibcs2_isc_syscall.h : ../../kern/makesyscalls.sh \
-		syscalls.isc syscalls.isc.conf
-	sh ../../kern/makesyscalls.sh syscalls.isc syscalls.isc.conf
+${ISC_GENERATED}: ${MAKESYSCALLS} syscalls.isc syscalls.isc.conf
+	sh ${MAKESYSCALLS} syscalls.isc syscalls.isc.conf
 
-xenix_sysent:  ibcs2_xenix_sysent.c ibcs2_xenix_syscall.h ibcs2_xenix.h
-
-ibcs2_xenix_sysent.c ibcs2_xenix_syscall.h ibcs2_xenix.h: \
-		../../kern/makesyscalls.sh syscalls.xenix syscalls.xenix.conf
-	sh ../../kern/makesyscalls.sh syscalls.xenix syscalls.xenix.conf
+${XENIX_GENERATED}: ${MAKESYSCALLS} syscalls.xenix syscalls.xenix.conf
+	sh ${MAKESYSCALLS} syscalls.xenix syscalls.xenix.conf

Modified: stable/11/sys/i386/linux/Makefile
==============================================================================
--- stable/11/sys/i386/linux/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/i386/linux/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -2,14 +2,6 @@
 #
 # $FreeBSD$
 
-# Don't use an OBJDIR
-.OBJDIR: ${.CURDIR}
+GENERATED_PREFIX=	linux_
 
-all:
-	@echo "make sysent only"
-
-sysent:  linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c
-
-linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \
-		../../kern/makesyscalls.sh syscalls.master syscalls.conf
-	sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+.include "../../conf/sysent.mk"

Modified: stable/11/sys/kern/Makefile
==============================================================================
--- stable/11/sys/kern/Makefile	Sat Jan 25 05:17:44 2020	(r357107)
+++ stable/11/sys/kern/Makefile	Sat Jan 25 05:47:56 2020	(r357108)
@@ -3,16 +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
 
-all:
-	@echo "make sysent only"
-
-sysent: init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscall.mk \
-../sys/sysproto.h
-
-init_sysent.c syscalls.c systrace_args.c ../sys/syscall.h \
-../sys/syscall.mk ../sys/sysproto.h: makesyscalls.sh syscalls.master \
-capabilities.conf
-	sh makesyscalls.sh syscalls.master
+.include "../conf/sysent.mk"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001250547.00P5luHL011137>