summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss/Makefile
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-10-13 18:23:51 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-10-13 18:23:51 +0000
commit4512feb33fd6a89f2cfa84287fa4de5e5c3db4b6 (patch)
treeeaafd2272e8622e2d62d7abfe92257e23f6e6860 /usr.bin/truss/Makefile
parent384c892651c52e57063356328dfcd28914bc4b15 (diff)
downloadFreeBSD-src-4512feb33fd6a89f2cfa84287fa4de5e5c3db4b6.zip
FreeBSD-src-4512feb33fd6a89f2cfa84287fa4de5e5c3db4b6.tar.gz
Simplify syscall generation and ABI source file handling for the build.
This is to make the Makefile more easily extendable for new ABIs. This also makes several other subtle changes: - The build now is given a list of ABIs to use based on the MACHINE_ARCH or MACHINE_CPUARCH. These ABIs have a related path in sys/ that is used to generate their syscalls. For each ABI to build check for a ABI.c, MACHINE_ARCH-ABI.c, or a MACHINE_CPUARCH-ABI.c. This matches the old behavior needed for archs such as powerpc* and mips*. - The ABI source file selection allows for simpler assignment of common ABIs such as "fbsd32" from sys/compat/freebsd32, or cloudabi64. - Expand 'fbsd' to 'freebsd' everywhere for consistency. - Split out the powerpc-fbsd.c file into a powerpc64-freebsd32.c to be more like the amd64-freebsd32.c file and to more easily allow the auto-generation of ABI handling to work. - Rename 'syscalls.h' to 'fbsd_syscalls.h' to lessen the ambiguity and avoid confusion with syscall.h (such as in r288997). - For non-native syscall header files, they are now renamed to be ABI_syscalls.h, where ABI is what ABI the Makefile is building. - Remove all of the makesyscalls config files. The "native" one being name i386.conf was a long outstanding bug. They were all the same except for the data they generated, so now it is just auto-generated as a build artifact. - The syscalls array is now fixed to be static in the syscalls header to remove the compiler warning about non-extern. This was worked around in the aarch64-fbsd.c file but not the others. - All syscall table names are now just 'syscallnames' since they don't need to be different as they are all static in their own ABI files. The alternative is to name them ABI_syscallnames which does not seem necessary. Reviewed by: ed, jhb MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D3851
Diffstat (limited to 'usr.bin/truss/Makefile')
-rw-r--r--usr.bin/truss/Makefile107
1 files changed, 42 insertions, 65 deletions
diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile
index 869d479..c25f928 100644
--- a/usr.bin/truss/Makefile
+++ b/usr.bin/truss/Makefile
@@ -2,87 +2,64 @@
NO_WERROR=
PROG= truss
-SRCS= main.c setup.c syscalls.c syscalls.h ioctl.c
-
-.if exists(${.CURDIR}/${MACHINE_ARCH}-fbsd.c)
-SRCS+= ${MACHINE_ARCH}-fbsd.c
-.else
-SRCS+= ${MACHINE_CPUARCH}-fbsd.c
-.endif
+SRCS= main.c setup.c syscalls.c ioctl.c
.PATH: ${.CURDIR:H}/kdump
SRCS+= utrace.c
CFLAGS+= -I${.CURDIR} -I. -I${.CURDIR}/../../sys
-CLEANFILES= syscalls.master syscalls.h ioctl.c
-
-.SUFFIXES: .master
-
-syscalls.master: ${.CURDIR}/../../sys/kern/syscalls.master
- cat ${.ALLSRC} > syscalls.master
-
-syscalls.h: syscalls.master
- /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh syscalls.master \
- ${.CURDIR}/i386.conf
+CLEANFILES= ioctl.c
ioctl.c: ${.CURDIR}/../kdump/mkioctls
env MACHINE=${MACHINE} CPP="${CPP}" \
/bin/sh ${.CURDIR}/../kdump/mkioctls return ${DESTDIR}${INCLUDEDIR} > ${.TARGET}
-.if ${MACHINE_CPUARCH} == "i386"
-SRCS+= i386-linux.c linux_syscalls.h
-CLEANFILES+=i386l-syscalls.master linux_syscalls.h
-
-i386l-syscalls.master: ${.CURDIR}/../../sys/i386/linux/syscalls.master
- cat ${.ALLSRC} > ${.TARGET}
+# Define where to generate syscalls for each ABI.
+ABI_SYSPATH.freebsd= sys/kern
+ABI_SYSPATH.freebsd32= sys/compat/freebsd32
+ABI_SYSPATH.cloudabi64= sys/compat/cloudabi64
+ABI_SYSPATH.i386-linux= sys/i386/linux
+ABI_SYSPATH.amd64-linux32= sys/amd64/linux32
-linux_syscalls.h: i386l-syscalls.master
- /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \
- ${.CURDIR}/i386linux.conf
+ABIS+= freebsd
+# Each ABI is expected to have an ABI.c, MACHINE_ARCH-ABI.c or
+# MACHINE_CPUARCH-ABI.c file that will be used to map the syscall arguments.
+.if ${MACHINE_CPUARCH} == "i386"
+ABIS+= i386-linux
.endif
-
.if ${MACHINE_CPUARCH} == "amd64"
-SRCS+= amd64-linux32.c linux32_syscalls.h
-CLEANFILES+=amd64l32-syscalls.master linux32_syscalls.h
-
-amd64l32-syscalls.master: ${.CURDIR}/../../sys/amd64/linux32/syscalls.master
- cat ${.ALLSRC} > ${.TARGET}
-
-linux32_syscalls.h: amd64l32-syscalls.master
- /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \
- ${.CURDIR}/amd64linux32.conf
-
-SRCS+= amd64-fbsd32.c freebsd32_syscalls.h
-CLEANFILES+=fbsd32-syscalls.master freebsd32_syscalls.h
-
-fbsd32-syscalls.master: ${.CURDIR}/../../sys/compat/freebsd32/syscalls.master
- cat ${.ALLSRC} > ${.TARGET}
-
-freebsd32_syscalls.h: fbsd32-syscalls.master
- /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \
- ${.CURDIR}/fbsd32.conf
-
-SRCS+= amd64-cloudabi64.c cloudabi64_syscalls.h
-CLEANFILES+=amd64cloudabi64-syscalls.master cloudabi64_syscalls.h
-
-amd64cloudabi64-syscalls.master: ${.CURDIR}/../../sys/compat/cloudabi64/syscalls.master
- cat ${.ALLSRC} > ${.TARGET}
-
-cloudabi64_syscalls.h: amd64cloudabi64-syscalls.master
- /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \
- ${.CURDIR}/amd64cloudabi64.conf
+ABIS+= amd64-linux32
+ABIS+= freebsd32
+ABIS+= cloudabi64
.endif
-
.if ${MACHINE_ARCH} == "powerpc64"
-SRCS+= powerpc-fbsd.c freebsd32_syscalls.h
-CLEANFILES+=fbsd32-syscalls.master freebsd32_syscalls.h
-
-fbsd32-syscalls.master: ${.CURDIR}/../../sys/compat/freebsd32/syscalls.master
- cat ${.ALLSRC} > ${.TARGET}
+ABIS+= freebsd32
+.endif
-freebsd32_syscalls.h: fbsd32-syscalls.master
- /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \
- ${.CURDIR}/fbsd32.conf
+.for abi in ${ABIS}
+# Find the right file to handle this ABI.
+abi_src=
+ABI_SRCS= ${abi}.c ${MACHINE_ARCH}-${abi}.c ${MACHINE_CPUARCH}-${abi}.c
+.for f in ${ABI_SRCS}
+.if exists(${.CURDIR}/${f}) && empty(abi_src)
+abi_src= ${f}
.endif
+.endfor
+SRCS:= ${SRCS} ${abi_src} ${abi}_syscalls.h
+CLEANFILES+= ${abi}_syscalls.conf ${abi}_syscalls.master ${abi}_syscalls.h
+${abi}_syscalls.conf: ${.CURDIR}/makesyscallsconf.sh
+ /bin/sh ${.CURDIR}/makesyscallsconf.sh ${abi} ${.TARGET}
+
+${abi}_syscalls.master: ${.CURDIR:H:H}/${ABI_SYSPATH.${abi}}/syscalls.master
+ cp -f ${.ALLSRC} ${.TARGET}
+
+${abi}_syscalls.h: ${abi}_syscalls.master ${abi}_syscalls.conf \
+ ${.CURDIR:H:H}/sys/kern/makesyscalls.sh
+ /bin/sh ${.CURDIR:H:H}/sys/kern/makesyscalls.sh \
+ ${abi}_syscalls.master ${abi}_syscalls.conf
+# Eliminate compiler warning about non-static global.
+ sed -i '' '/^const char \*/s/^/static /' ${.TARGET}.tmp
+ mv ${.TARGET}.tmp ${.TARGET}
+.endfor
.include <bsd.prog.mk>
OpenPOWER on IntegriCloud