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