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