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