xref: /freebsd/cddl/lib/libdtrace/Makefile (revision bd81e07d2761cf1c13063eb49a5c0cb4a6951318)
1# $FreeBSD$
2
3.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/common
4.PATH: ${.CURDIR}/../../../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_work.c \
46		dt_xlator.c \
47		gmatch.c
48
49DSRCS=		errno.d			\
50		io.d			\
51		ip.d			\
52		psinfo.d		\
53		siftr.d			\
54		signal.d		\
55		tcp.d			\
56		udp.d			\
57		unistd.d
58
59WARNS?=		1
60
61CFLAGS+=	-I${.OBJDIR} -I${.CURDIR} \
62		-I${.CURDIR}/../../../sys/cddl/dev/dtrace/${MACHINE_ARCH} \
63		-I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
64		-I${.CURDIR}/../../../cddl/compat/opensolaris/include \
65		-I${OPENSOLARIS_USR_DISTDIR}/head \
66		-I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \
67		-I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \
68		-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
69
70#CFLAGS+=	-DYYDEBUG
71
72.if ${MACHINE_CPUARCH} == "aarch64"
73CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/aarch64
74.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/aarch64
75.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/aarch64
76.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
77CFLAGS+=	-I${.CURDIR}/../../../sys/cddl/dev/dtrace/x86
78CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/intel -DDIS_MEM
79.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/i386
80.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/${MACHINE_ARCH}
81.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/x86
82.elif ${MACHINE_CPUARCH} == "arm"
83CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/arm
84.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/arm
85.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/arm
86.elif ${MACHINE_CPUARCH} == "mips"
87CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
88.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/mips
89.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/mips
90.elif ${MACHINE_CPUARCH} == "powerpc"
91CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/powerpc
92.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/powerpc
93.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/powerpc
94.elif ${MACHINE_CPUARCH} == "sparc64"
95CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc
96.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/sparc
97.else
98# temporary hack
99CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/intel
100.endif
101
102.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
103SRCS+=		dis_tables.c
104DSRCS+=		regs_x86.d
105.endif
106
107LFLAGS+=-l
108
109YFLAGS+=-d
110
111LIBADD=	ctf elf proc pthread rtld_db
112
113CLEANFILES=	dt_errtags.c dt_names.c
114
115dt_errtags.c:
116	sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h > dt_errtags.c
117
118dt_names.c:
119	sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h > dt_names.c
120
121beforedepend:	dt_errtags.c dt_names.c
122
123beforeinstall:
124.if !defined(LIBRARIES_ONLY) && exists(${DESTDIR}/usr/lib/dtrace)
125.for file in ${DSRCS}
126	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} ${.CURDIR}/${file} ${DESTDIR}/usr/lib/dtrace
127.endfor
128.endif
129
130.include <bsd.lib.mk>
131