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