xref: /freebsd/cddl/lib/libdtrace/Makefile (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1# $FreeBSD$
2
3.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common
4.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libgen/common
5
6LIB=		dtrace
7SRCS=		dt_aggregate.c \
8		dt_as.c \
9		dt_buf.c \
10		dt_cc.c \
11		dt_cg.c \
12		dt_consume.c \
13		dt_decl.c \
14		dt_dis.c \
15		dt_dof.c \
16		dt_error.c \
17		dt_errtags.c \
18		dt_grammar.y \
19		dt_handle.c \
20		dt_ident.c \
21		dt_isadep.c \
22		dt_inttab.c \
23		dt_lex.l \
24		dt_link.c \
25		dt_list.c \
26		dt_map.c \
27		dt_module.c \
28		dt_names.c \
29		dt_open.c \
30		dt_options.c \
31		dt_parser.c \
32		dt_pcb.c \
33		dt_pid.c \
34		dt_pq.c \
35		dt_pragma.c \
36		dt_print.c \
37		dt_printf.c \
38		dt_proc.c \
39		dt_program.c \
40		dt_provider.c \
41		dt_regset.c \
42		dt_string.c \
43		dt_strtab.c \
44		dt_subr.c \
45		dt_sugar.c \
46		dt_work.c \
47		dt_xlator.c \
48		gmatch.c
49
50DSRCS=		errno.d			\
51		io.d			\
52		ip.d			\
53		psinfo.d		\
54		sctp.d			\
55		siftr.d			\
56		signal.d		\
57		tcp.d			\
58		socket.d		\
59		udp.d			\
60		udplite.d		\
61		unistd.d
62
63FILES=		${DSRCS}
64FILESDIR=	/usr/lib/dtrace
65FILESMODE=	${NOBINMODE}
66
67INCSGROUPS=	INCS SYSINCS
68SYSINCSDIR=	${INCLUDEDIR}/sys
69INCS+=		${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
70SYSINCS+=	${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
71SYSINCS+=	${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
72SYSINCS+=	${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf.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/compat/opensolaris \
88		-I${SRCTOP}/cddl/compat/opensolaris/include \
89		-I${OPENSOLARIS_USR_DISTDIR}/head \
90		-I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \
91		-I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \
92		-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
93
94#CFLAGS+=	-DYYDEBUG
95
96.if ${MACHINE_CPUARCH} == "aarch64"
97CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/aarch64
98.PATH:		${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/aarch64
99.PATH:		${SRCTOP}/sys/cddl/dev/dtrace/aarch64
100.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
101CFLAGS+=	-I${SRCTOP}/sys/cddl/dev/dtrace/x86
102CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/intel -DDIS_MEM
103.PATH:		${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/i386
104.PATH:		${SRCTOP}/sys/cddl/dev/dtrace/${MACHINE_ARCH}
105.PATH:		${SRCTOP}/sys/cddl/dev/dtrace/x86
106.elif ${MACHINE_CPUARCH} == "arm"
107CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/arm
108.PATH:		${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/arm
109.PATH:		${SRCTOP}/sys/cddl/dev/dtrace/arm
110.elif ${MACHINE_CPUARCH} == "mips"
111CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
112.PATH:		${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/mips
113.PATH:		${SRCTOP}/sys/cddl/dev/dtrace/mips
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
129DSRCS+=		regs_x86.d
130.endif
131
132LFLAGS+=-l
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