1# $FreeBSD$ 2 3NO_WERROR= 4PROG= truss 5SRCS= cloudabi.c main.c setup.c syscalls.c 6 7LIBADD= sysdecode 8 9CFLAGS+= -I${.CURDIR} -I. -I${.CURDIR}/../../sys 10 11# Define where to generate syscalls for each ABI. 12ABI_SYSPATH.freebsd= sys/kern 13ABI_SYSPATH.freebsd32= sys/compat/freebsd32 14ABI_SYSPATH.cloudabi64= sys/compat/cloudabi64 15ABI_SYSPATH.i386-linux= sys/i386/linux 16ABI_SYSPATH.amd64-linux32= sys/amd64/linux32 17 18ABIS+= freebsd 19# Each ABI is expected to have an ABI.c, MACHINE_ARCH-ABI.c or 20# MACHINE_CPUARCH-ABI.c file that will be used to map the syscall arguments. 21.if ${MACHINE_ARCH} == "aarch64" 22ABIS+= cloudabi64 23.endif 24.if ${MACHINE_CPUARCH} == "i386" 25ABIS+= i386-linux 26.endif 27.if ${MACHINE_CPUARCH} == "amd64" 28ABIS+= amd64-linux32 29ABIS+= freebsd32 30ABIS+= cloudabi64 31.endif 32.if ${MACHINE_ARCH} == "powerpc64" 33ABIS+= freebsd32 34.endif 35 36.for abi in ${ABIS} 37# Find the right file to handle this ABI. 38abi_src= 39ABI_SRCS= ${abi}.c ${MACHINE_ARCH}-${abi}.c ${MACHINE_CPUARCH}-${abi}.c 40.for f in ${ABI_SRCS} 41.if exists(${.CURDIR}/${f}) && empty(abi_src) 42abi_src= ${f} 43.endif 44.endfor 45SRCS:= ${SRCS} ${abi_src} ${abi}_syscalls.h 46CLEANFILES+= ${abi}_syscalls.conf ${abi}_syscalls.master ${abi}_syscalls.h 47${abi}_syscalls.conf: ${.CURDIR}/makesyscallsconf.sh 48 /bin/sh ${.CURDIR}/makesyscallsconf.sh ${abi} ${.TARGET} 49 50${abi}_syscalls.master: ${.CURDIR:H:H}/${ABI_SYSPATH.${abi}}/syscalls.master 51 cp -f ${.ALLSRC} ${.TARGET} 52 53${abi}_syscalls.h: ${abi}_syscalls.master ${abi}_syscalls.conf \ 54 ${.CURDIR:H:H}/sys/kern/makesyscalls.sh 55 /bin/sh ${.CURDIR:H:H}/sys/kern/makesyscalls.sh \ 56 ${abi}_syscalls.master ${abi}_syscalls.conf 57# Eliminate compiler warning about non-static global. 58 sed -i '' '/^const char \*/s/^/static /' ${.TARGET}.tmp 59 mv ${.TARGET}.tmp ${.TARGET} 60.endfor 61 62.include <bsd.prog.mk> 63