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