1# $FreeBSD$ 2 3SHLIBDIR?= /lib 4 5.include <src.opts.mk> 6 7.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common 8.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libgen/common 9 10PACKAGE= dtrace 11LIB= dtrace 12 13SRCS= dt_aggregate.c \ 14 dt_as.c \ 15 dt_buf.c \ 16 dt_cc.c \ 17 dt_cg.c \ 18 dt_consume.c \ 19 dt_decl.c \ 20 dt_dis.c \ 21 dt_dof.c \ 22 dt_error.c \ 23 dt_errtags.c \ 24 dt_grammar.y \ 25 dt_handle.c \ 26 dt_ident.c \ 27 dt_isadep.c \ 28 dt_inttab.c \ 29 dt_lex.l \ 30 dt_link.c \ 31 dt_list.c \ 32 dt_map.c \ 33 dt_module.c \ 34 dt_names.c \ 35 dt_open.c \ 36 dt_options.c \ 37 dt_parser.c \ 38 dt_pcb.c \ 39 dt_pid.c \ 40 dt_pq.c \ 41 dt_pragma.c \ 42 dt_print.c \ 43 dt_printf.c \ 44 dt_proc.c \ 45 dt_program.c \ 46 dt_provider.c \ 47 dt_regset.c \ 48 dt_string.c \ 49 dt_strtab.c \ 50 dt_subr.c \ 51 dt_sugar.c \ 52 dt_work.c \ 53 dt_xlator.c \ 54 gmatch.c 55 56DSRCS= errno.d \ 57 io.d \ 58 ip.d \ 59 psinfo.d \ 60 sctp.d \ 61 siftr.d \ 62 signal.d \ 63 tcp.d \ 64 socket.d \ 65 udp.d \ 66 udplite.d \ 67 unistd.d 68 69FILES= ${DSRCS} 70FILESDIR= /usr/lib/dtrace 71FILESMODE= ${NOBINMODE} 72 73INCSGROUPS= INCS SYSINCS 74SYSINCSDIR= ${INCLUDEDIR}/sys 75INCS+= ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h 76SYSINCS+= ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h 77SYSINCS+= ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h 78 79WARNS?= 1 80 81CFLAGS+= -DIN_BASE 82CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include 83CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/ 84CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd 85CFLAGS+= -I${SRCTOP}/sys 86CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h 87CFLAGS+= -DHAVE_ISSETUGID 88 89 90CFLAGS+= -I${.OBJDIR} -I${.CURDIR} \ 91 -I${SRCTOP}/sys/cddl/dev/dtrace/${MACHINE_ARCH} \ 92 -I${SRCTOP}/sys/cddl/dev/kinst \ 93 -I${SRCTOP}/sys/cddl/compat/opensolaris \ 94 -I${SRCTOP}/cddl/compat/opensolaris/include \ 95 -I${OPENSOLARIS_USR_DISTDIR}/head \ 96 -I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \ 97 -I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \ 98 -I${OPENSOLARIS_SYS_DISTDIR}/uts/common 99 100#CFLAGS+= -DYYDEBUG 101 102.if ${MACHINE_CPUARCH} == "aarch64" 103CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/aarch64 104.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/aarch64 105.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/aarch64 106.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 107CFLAGS+= -I${SRCTOP}/sys/cddl/dev/dtrace/x86 108CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel -DDIS_MEM 109.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/i386 110.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/${MACHINE_ARCH} 111.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/x86 112.elif ${MACHINE_CPUARCH} == "arm" 113CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/arm 114.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/arm 115.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/arm 116.elif ${MACHINE_CPUARCH} == "powerpc" 117CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/powerpc 118.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/powerpc 119.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/powerpc 120.elif ${MACHINE_CPUARCH} == "riscv" 121CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/riscv 122.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/riscv 123.PATH: ${SRCTOP}/sys/cddl/dev/dtrace/riscv 124.else 125# temporary hack 126CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel 127.endif 128 129.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" 130SRCS+= dis_tables.c instr_size.c 131DSRCS+= regs_x86.d 132.endif 133 134.if ${MACHINE_CPUARCH} == "riscv" 135SRCS+= instr_size.c 136DSRCS+= regs_riscv.d 137.endif 138 139.if ${MACHINE_CPUARCH} == "aarch64" 140SRCS+= instr_size.c 141DSRCS+= regs_aarch64.d 142.endif 143 144YFLAGS+=-d 145 146.if ${MK_DTRACE_ASAN} != "no" 147CFLAGS+= -fsanitize=address -fsanitize=undefined 148LDFLAGS+= -fsanitize=address -fsanitize=undefined 149.endif 150 151LIBADD= ctf elf proc pthread rtld_db 152 153CLEANFILES= dt_errtags.c dt_names.c 154 155.include <bsd.lib.mk> 156 157dt_errtags.c: ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h 158 sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${.ALLSRC} > ${.TARGET} 159 160dt_names.c: ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h 161 sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${.ALLSRC} > ${.TARGET} 162