svn commit: r355473 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern

Brooks Davis brooks at FreeBSD.org
Fri Dec 6 23:59:26 UTC 2019


Author: brooks
Date: Fri Dec  6 23:59:23 2019
New Revision: 355473
URL: https://svnweb.freebsd.org/changeset/base/355473

Log:
  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.
  
  Reviewed by:	kevans, emaste
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D22714

Modified:
  head/sys/amd64/linux/Makefile
  head/sys/amd64/linux32/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	Fri Dec  6 23:51:11 2019	(r355472)
+++ head/sys/amd64/linux/Makefile	Fri Dec  6 23:59:23 2019	(r355473)
@@ -7,11 +7,19 @@
 
 .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"
 
-sysent:  linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c
+sysent: ${GENERATED}
 
-linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \
-		../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf
-	${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf
+${GENERATED}: ${MAKESYSCALLS} ${SRCS}
+	${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf

Modified: head/sys/amd64/linux32/Makefile
==============================================================================
--- head/sys/amd64/linux32/Makefile	Fri Dec  6 23:51:11 2019	(r355472)
+++ head/sys/amd64/linux32/Makefile	Fri Dec  6 23:59:23 2019	(r355473)
@@ -7,11 +7,19 @@
 
 .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"
 
-sysent:  linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c
+sysent: ${GENERATED}
 
-linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c: ../../tools/makesyscalls.lua \
-		syscalls.master ${.CURDIR}/syscalls.conf
-	${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf
+${GENERATED}: ${MAKESYSCALLS} ${SRCS}
+	${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf

Modified: head/sys/arm64/linux/Makefile
==============================================================================
--- head/sys/arm64/linux/Makefile	Fri Dec  6 23:51:11 2019	(r355472)
+++ head/sys/arm64/linux/Makefile	Fri Dec  6 23:59:23 2019	(r355473)
@@ -7,11 +7,19 @@
 
 .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"
 
-sysent:  linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c
+sysent: ${GENERATED}
 
-linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \
-		../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf
-	${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf
+${GENERATED}: ${MAKESYSCALLS} ${SRCS}
+	${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf

Modified: head/sys/compat/cloudabi32/Makefile
==============================================================================
--- head/sys/compat/cloudabi32/Makefile	Fri Dec  6 23:51:11 2019	(r355472)
+++ head/sys/compat/cloudabi32/Makefile	Fri Dec  6 23:59:23 2019	(r355473)
@@ -5,15 +5,20 @@
 
 .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"
 
-sysent: cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
-    cloudabi32_syscalls.c cloudabi32_systrace_args.c
+sysent: ${GENERATED}
 
-cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \
-    cloudabi32_syscalls.c cloudabi32_systrace_args.c: \
-    ../../tools/makesyscalls.lua ../../contrib/cloudabi/syscalls32.master \
-    ${.CURDIR}/syscalls.conf
-	${LUA} ../../tools/makesyscalls.lua \
-	    ../../contrib/cloudabi/syscalls32.master ${.CURDIR}/syscalls.conf
+${GENERATED}: ${MAKESYSCALLS} ${SRCS}
+	${LUA} ${MAKESYSCALLS} \
+	    ../../contrib/cloudabi/syscalls32.master syscalls.conf

Modified: head/sys/compat/cloudabi64/Makefile
==============================================================================
--- head/sys/compat/cloudabi64/Makefile	Fri Dec  6 23:51:11 2019	(r355472)
+++ head/sys/compat/cloudabi64/Makefile	Fri Dec  6 23:59:23 2019	(r355473)
@@ -5,15 +5,20 @@
 # 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"
 
-sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
-    cloudabi64_syscalls.c cloudabi64_systrace_args.c
+sysent: ${GENERATED}
 
-cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
-    cloudabi64_syscalls.c cloudabi64_systrace_args.c: \
-    ../../tools/makesyscalls.lua ../../contrib/cloudabi/syscalls64.master \
-    ${.CURDIR}/syscalls.conf
-	${LUA} ../../tools/makesyscalls.lua \
-	    ../../contrib/cloudabi/syscalls64.master ${.CURDIR}/syscalls.conf
+${GENERATED}: ${MAKESYSCALLS} ${SRCS}
+	${LUA} ${MAKESYSCALLS} \
+	    ../../contrib/cloudabi/syscalls64.master syscalls.conf

Modified: head/sys/compat/freebsd32/Makefile
==============================================================================
--- head/sys/compat/freebsd32/Makefile	Fri Dec  6 23:51:11 2019	(r355472)
+++ head/sys/compat/freebsd32/Makefile	Fri Dec  6 23:59:23 2019	(r355473)
@@ -7,15 +7,20 @@
 
 .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"
 
-sysent:  freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c
+sysent: ${GENERATED}
 
-freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c : \
-	    ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf ../../kern/capabilities.conf
-	${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf
-
-clean:
-	rm -f freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h
-	rm -f freebsd32_systrace_args.c 
+${GENERATED}: ${MAKESYSCALLS} ${SRCS}
+	${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf

Modified: head/sys/i386/linux/Makefile
==============================================================================
--- head/sys/i386/linux/Makefile	Fri Dec  6 23:51:11 2019	(r355472)
+++ head/sys/i386/linux/Makefile	Fri Dec  6 23:59:23 2019	(r355473)
@@ -7,11 +7,19 @@
 
 .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"
 
-sysent:  linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c
+sysent: ${GENERATED}
 
-linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \
-		../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf
-	${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf
+${GENERATED}: ${MAKESYSCALLS} ${SRCS}
+	${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf

Modified: head/sys/kern/Makefile
==============================================================================
--- head/sys/kern/Makefile	Fri Dec  6 23:51:11 2019	(r355472)
+++ head/sys/kern/Makefile	Fri Dec  6 23:59:23 2019	(r355473)
@@ -8,13 +8,19 @@
 
 .include <src.lua.mk>
 
+MAKESYSCALLS=	../tools/makesyscalls.lua
+SRCS=		capabilities.conf	\
+		syscalls.master
+GENERATED=	init_sysent.c		\
+		syscalls.c		\
+		../sys/syscall.h	\
+		../sys/syscall.mk	\
+		../sys/sysproto.h
+
 all:
 	@echo "make sysent only"
 
-sysent: init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscall.mk \
-../sys/sysproto.h
+sysent: ${GENERATED}
 
-init_sysent.c syscalls.c systrace_args.c ../sys/syscall.h \
-../sys/syscall.mk ../sys/sysproto.h: ../tools/makesyscalls.lua syscalls.master \
-capabilities.conf
-	${LUA} ../tools/makesyscalls.lua syscalls.master
+${GENERATED}: ${MAKESYSCALLS} ${SRCS}
+	${LUA} ${MAKESYSCALLS} syscalls.master


More information about the svn-src-all mailing list