xref: /freebsd/cddl/lib/libdtrace/Makefile (revision 03836978bec158bdc0ecee7a4198962f91ce8298)
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_pragma.c \
35		dt_print.c \
36		dt_printf.c \
37		dt_proc.c \
38		dt_program.c \
39		dt_provider.c \
40		dt_regset.c \
41		dt_string.c \
42		dt_strtab.c \
43		dt_subr.c \
44		dt_work.c \
45		dt_xlator.c \
46		gmatch.c
47
48DSRCS=		errno.d			\
49		io.d			\
50		psinfo.d		\
51		signal.d		\
52		unistd.d
53
54WARNS?=		1
55
56CFLAGS+=	-I${.OBJDIR} -I${.CURDIR} \
57		-I${.CURDIR}/../../../sys/cddl/dev/dtrace/${MACHINE_ARCH} \
58		-I${.CURDIR}/../../../sys/cddl/compat/opensolaris \
59		-I${.CURDIR}/../../../cddl/compat/opensolaris/include \
60		-I${OPENSOLARIS_USR_DISTDIR}/head \
61		-I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \
62		-I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \
63		-I${OPENSOLARIS_SYS_DISTDIR}/uts/common
64
65#CFLAGS+=	-DYYDEBUG
66
67.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
68CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/intel -DDIS_MEM
69.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/i386
70.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/${MACHINE_ARCH}
71.elif ${MACHINE_CPUARCH} == "sparc64"
72CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc
73.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/sparc
74.elif ${MACHINE_CPUARCH} == "mips"
75CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
76.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/mips
77.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/mips
78.elif ${MACHINE_CPUARCH} == "powerpc"
79CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/powerpc
80.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/powerpc
81.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/powerpc
82.else
83# temporary hack
84CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/intel
85.endif
86
87.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
88SRCS+=		dis_tables.c
89DSRCS+=		regs_x86.d
90.endif
91
92LFLAGS+=-l
93
94YFLAGS+=-d
95
96CLEANFILES=	dt_errtags.c dt_names.c
97
98dt_errtags.c:
99	sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h > dt_errtags.c
100
101dt_names.c:
102	sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h > dt_names.c
103
104beforedepend:	dt_errtags.c dt_names.c
105
106beforeinstall:
107.if !defined(LIBRARIES_ONLY) && exists(${DESTDIR}/usr/lib/dtrace)
108.for file in ${DSRCS}
109	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} ${.CURDIR}/${file} ${DESTDIR}/usr/lib/dtrace
110.endfor
111.endif
112
113.include <bsd.lib.mk>
114