xref: /titanic_52/usr/src/lib/libdtrace/Makefile.com (revision f05d7fc81533be643136e12ce92516d1d4292921)
1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23# Copyright (c) 2011 by Delphix. All rights reserved.
24#
25
26LIBRARY = libdtrace.a
27VERS = .1
28
29LIBSRCS = \
30	dt_aggregate.c \
31	dt_as.c \
32	dt_buf.c \
33	dt_cc.c \
34	dt_cg.c \
35	dt_consume.c \
36	dt_decl.c \
37	dt_dis.c \
38	dt_dof.c \
39	dt_error.c \
40	dt_errtags.c \
41	dt_handle.c \
42	dt_ident.c \
43	dt_inttab.c \
44	dt_link.c \
45	dt_list.c \
46	dt_open.c \
47	dt_options.c \
48	dt_program.c \
49	dt_map.c \
50	dt_module.c \
51	dt_names.c \
52	dt_parser.c \
53	dt_pcb.c \
54	dt_pid.c \
55	dt_pragma.c \
56	dt_print.c \
57	dt_printf.c \
58	dt_proc.c \
59	dt_provider.c \
60	dt_regset.c \
61        dt_string.c \
62	dt_strtab.c \
63	dt_subr.c \
64	dt_work.c \
65	dt_xlator.c
66
67LIBISASRCS = \
68	dt_isadep.c
69
70OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
71
72DRTISRC = drti.c
73DRTIOBJ = $(DRTISRC:%.c=%.o)
74
75DLIBSRCS += \
76	errno.d \
77	fc.d \
78	io.d \
79	ip.d \
80	iscsit.d \
81	net.d \
82	nfs.d \
83	procfs.d \
84	regs.d \
85	sched.d \
86	signal.d \
87	scsi.d \
88	srp.d \
89	sysevent.d \
90	tcp.d \
91	udp.d \
92	unistd.d
93
94include ../../Makefile.lib
95
96SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
97LIBS = $(DYNLIB) $(LINTLIB)
98
99SRCDIR = ../common
100
101CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
102CLEANFILES += ../common/procfs.sed ../common/procfs.d
103CLEANFILES += ../common/io.sed ../common/io.d
104CLEANFILES += ../common/ip.sed ../common/ip.d
105CLEANFILES += ../common/net.sed ../common/net.d
106CLEANFILES += ../common/errno.d ../common/signal.d
107CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
108CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
109CLEANFILES += ../common/tcp.sed ../common/tcp.d
110CLEANFILES += ../common/udp.sed ../common/udp.d
111
112CLOBBERFILES += drti.o
113
114CPPFLAGS += -I../common -I.
115CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
116CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
117YYCFLAGS =
118LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc
119DRTILDLIBS = $(LDLIBS.lib) -lc
120
121yydebug := YYCFLAGS += -DYYDEBUG
122
123$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
124
125LFLAGS = -t -v
126YFLAGS = -d -v
127
128ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
129ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
130
131ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
132ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
133ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
134
135.KEEP_STATE:
136
137all: $(LIBS) $(DRTIOBJ)
138
139lint: lintdrti lintcheck
140
141lintdrti: ../common/$(DRTISRC)
142	$(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
143
144dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
145	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
146
147dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
148	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
149	@mv y.tab.h dt_grammar.h
150	@mv y.tab.c dt_grammar.c
151
152pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
153pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
154
155pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
156pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
157
158../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
159	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
160
161../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
162	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
163
164../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
165	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
166
167../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
168	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
169
170../common/%.sed: ../common/%.sed.in
171	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
172	    sed 's/\&/\\\&/g' | grep '^s/' > $@
173
174../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
175	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
176
177../common/io.d: ../common/io.sed ../common/io.d.in
178	sed -f ../common/io.sed < ../common/io.d.in > $@
179
180../common/ip.d: ../common/ip.sed ../common/ip.d.in
181	sed -f ../common/ip.sed < ../common/ip.d.in > $@
182
183../common/net.d: ../common/net.sed ../common/net.d.in
184	sed -f ../common/net.sed < ../common/net.d.in > $@
185
186../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
187	sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
188
189../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in
190	sed -f ../common/tcp.sed < ../common/tcp.d.in > $@
191
192../common/udp.d: ../common/udp.sed ../common/udp.d.in
193	sed -f ../common/udp.sed < ../common/udp.d.in > $@
194
195pics/%.o: ../$(MACH)/%.c
196	$(COMPILE.c) -o $@ $<
197	$(POST_PROCESS_O)
198
199pics/%.o: ../$(MACH)/%.s
200	$(COMPILE.s) -o $@ $<
201	$(POST_PROCESS_O)
202
203%.o: ../common/%.c
204	$(COMPILE.c) -o $@ $<
205	$(POST_PROCESS_O)
206
207$(ROOTDLIBDIR):
208	$(INS.dir)
209
210$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
211	$(INS.dir)
212
213$(ROOTDLIBDIR)/%.d: ../common/%.d
214	$(INS.file)
215
216$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
217	$(INS.file)
218
219$(ROOTDLIBDIR)/%.d: %.d
220	$(INS.file)
221
222$(ROOTDLIBDIR)/%.o: %.o
223	$(INS.file)
224
225$(ROOTDLIBDIR64)/%.o: %.o
226	$(INS.file)
227
228$(ROOTDLIBS): $(ROOTDLIBDIR)
229
230$(ROOTDOBJS): $(ROOTDLIBDIR)
231
232$(ROOTDOBJS64): $(ROOTDLIBDIR64)
233
234include ../../Makefile.targ
235