From af796bfa71c709fef199dcb73bfabdc8dbe94c8f Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Fri, 6 Dec 2019 23:59:23 +0000 Subject: [PATCH] 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 --- sys/amd64/linux/Makefile | 16 ++++++++++++---- sys/amd64/linux32/Makefile | 16 ++++++++++++---- sys/arm64/linux/Makefile | 16 ++++++++++++---- sys/compat/cloudabi32/Makefile | 21 +++++++++++++-------- sys/compat/cloudabi64/Makefile | 21 +++++++++++++-------- sys/compat/freebsd32/Makefile | 21 +++++++++++++-------- sys/i386/linux/Makefile | 16 ++++++++++++---- sys/kern/Makefile | 18 ++++++++++++------ 8 files changed, 99 insertions(+), 46 deletions(-) diff --git a/sys/amd64/linux/Makefile b/sys/amd64/linux/Makefile index f81a30e549d..66bd3d08d1e 100644 --- a/sys/amd64/linux/Makefile +++ b/sys/amd64/linux/Makefile @@ -7,11 +7,19 @@ .include +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 diff --git a/sys/amd64/linux32/Makefile b/sys/amd64/linux32/Makefile index 1fff6728fec..8de130c6dff 100644 --- a/sys/amd64/linux32/Makefile +++ b/sys/amd64/linux32/Makefile @@ -7,11 +7,19 @@ .include +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 diff --git a/sys/arm64/linux/Makefile b/sys/arm64/linux/Makefile index f81a30e549d..66bd3d08d1e 100644 --- a/sys/arm64/linux/Makefile +++ b/sys/arm64/linux/Makefile @@ -7,11 +7,19 @@ .include +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 diff --git a/sys/compat/cloudabi32/Makefile b/sys/compat/cloudabi32/Makefile index d7b46f11264..bbe7cc1fcd5 100644 --- a/sys/compat/cloudabi32/Makefile +++ b/sys/compat/cloudabi32/Makefile @@ -5,15 +5,20 @@ .include +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 diff --git a/sys/compat/cloudabi64/Makefile b/sys/compat/cloudabi64/Makefile index fc9ed38b269..90b671ce195 100644 --- a/sys/compat/cloudabi64/Makefile +++ b/sys/compat/cloudabi64/Makefile @@ -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 diff --git a/sys/compat/freebsd32/Makefile b/sys/compat/freebsd32/Makefile index 2f679c11167..2a0285d6ea2 100644 --- a/sys/compat/freebsd32/Makefile +++ b/sys/compat/freebsd32/Makefile @@ -7,15 +7,20 @@ .include +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 diff --git a/sys/i386/linux/Makefile b/sys/i386/linux/Makefile index f81a30e549d..66bd3d08d1e 100644 --- a/sys/i386/linux/Makefile +++ b/sys/i386/linux/Makefile @@ -7,11 +7,19 @@ .include +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 diff --git a/sys/kern/Makefile b/sys/kern/Makefile index c5bc9f2715f..bc4fe1aafc0 100644 --- a/sys/kern/Makefile +++ b/sys/kern/Makefile @@ -8,13 +8,19 @@ .include +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