xref: /freebsd/cddl/lib/libdtrace/Makefile (revision fe6060f10f634930ff71b7c50291ddc610da2475)
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
73SYSINCS+=	${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf.h
74
75WARNS?=		1
76
77CFLAGS+= -DIN_BASE
78CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/include
79CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/
80CFLAGS+= -I${SRCTOP}/sys/contrib/openzfs/lib/libspl/include/os/freebsd
81CFLAGS+= -I${SRCTOP}/sys
82CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
83CFLAGS+= -DHAVE_ISSETUGID
84
85
86CFLAGS+=	-I${.OBJDIR} -I${.CURDIR} \
87		-I${SRCTOP}/sys/cddl/dev/dtrace/${MACHINE_ARCH} \
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} == "mips"
112CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
113.PATH:		${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/mips
114.PATH:		${SRCTOP}/sys/cddl/dev/dtrace/mips
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
130DSRCS+=		regs_x86.d
131.endif
132
133YFLAGS+=-d
134
135LIBADD=	ctf elf proc pthread rtld_db
136
137CLEANFILES=	dt_errtags.c dt_names.c
138
139.include <bsd.lib.mk>
140
141dt_errtags.c: ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h
142	sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${.ALLSRC} > ${.TARGET}
143
144dt_names.c: ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h
145	sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${.ALLSRC} > ${.TARGET}
146