xref: /titanic_44/usr/src/lib/libdtrace/Makefile.com (revision f4c46b1eda9212fd32ba197043d52239ef5c0a7f)
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) 2012 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_pq.c \
56	dt_pragma.c \
57	dt_print.c \
58	dt_printf.c \
59	dt_proc.c \
60	dt_provider.c \
61	dt_regset.c \
62        dt_string.c \
63	dt_strtab.c \
64	dt_subr.c \
65	dt_work.c \
66	dt_xlator.c
67
68LIBISASRCS = \
69	dt_isadep.c
70
71OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
72
73DRTISRC = drti.c
74DRTIOBJ = $(DRTISRC:%.c=%.o)
75
76DLIBSRCS += \
77	errno.d \
78	fc.d \
79	io.d \
80	ip.d \
81	iscsit.d \
82	net.d \
83	nfs.d \
84	nfssrv.d \
85	procfs.d \
86	regs.d \
87	sched.d \
88	signal.d \
89	scsi.d \
90	srp.d \
91	sysevent.d \
92	tcp.d \
93	udp.d \
94	unistd.d
95
96include ../../Makefile.lib
97
98SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
99LIBS = $(DYNLIB) $(LINTLIB)
100
101SRCDIR = ../common
102
103CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
104CLEANFILES += ../common/procfs.sed ../common/procfs.d
105CLEANFILES += ../common/io.sed ../common/io.d
106CLEANFILES += ../common/ip.sed ../common/ip.d
107CLEANFILES += ../common/net.sed ../common/net.d
108CLEANFILES += ../common/errno.d ../common/signal.d
109CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
110CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
111CLEANFILES += ../common/tcp.sed ../common/tcp.d
112CLEANFILES += ../common/udp.sed ../common/udp.d
113
114CLOBBERFILES += drti.o
115
116CPPFLAGS += -I../common -I.
117CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
118CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
119YYCFLAGS =
120LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc
121DRTILDLIBS = $(LDLIBS.lib) -lc
122
123yydebug := YYCFLAGS += -DYYDEBUG
124
125$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
126
127LFLAGS = -t -v
128YFLAGS = -d -v
129
130ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
131ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
132
133ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
134ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
135ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
136
137.KEEP_STATE:
138
139all: $(LIBS) $(DRTIOBJ)
140
141lint: lintdrti lintcheck
142
143lintdrti: ../common/$(DRTISRC)
144	$(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
145
146dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
147	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
148
149dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
150	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
151	@mv y.tab.h dt_grammar.h
152	@mv y.tab.c dt_grammar.c
153
154pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
155pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
156
157pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
158pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
159
160../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
161	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
162
163../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
164	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
165
166../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
167	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
168
169../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
170	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
171
172../common/%.sed: ../common/%.sed.in
173	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
174	    sed 's/\&/\\\&/g' | grep '^s/' > $@
175
176../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
177	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
178
179../common/io.d: ../common/io.sed ../common/io.d.in
180	sed -f ../common/io.sed < ../common/io.d.in > $@
181
182../common/ip.d: ../common/ip.sed ../common/ip.d.in
183	sed -f ../common/ip.sed < ../common/ip.d.in > $@
184
185../common/net.d: ../common/net.sed ../common/net.d.in
186	sed -f ../common/net.sed < ../common/net.d.in > $@
187
188../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
189	sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
190
191../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in
192	sed -f ../common/tcp.sed < ../common/tcp.d.in > $@
193
194../common/udp.d: ../common/udp.sed ../common/udp.d.in
195	sed -f ../common/udp.sed < ../common/udp.d.in > $@
196
197pics/%.o: ../$(MACH)/%.c
198	$(COMPILE.c) -o $@ $<
199	$(POST_PROCESS_O)
200
201pics/%.o: ../$(MACH)/%.s
202	$(COMPILE.s) -o $@ $<
203	$(POST_PROCESS_O)
204
205%.o: ../common/%.c
206	$(COMPILE.c) -o $@ $<
207	$(POST_PROCESS_O)
208
209$(ROOTDLIBDIR):
210	$(INS.dir)
211
212$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
213	$(INS.dir)
214
215$(ROOTDLIBDIR)/%.d: ../common/%.d
216	$(INS.file)
217
218$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
219	$(INS.file)
220
221$(ROOTDLIBDIR)/%.d: %.d
222	$(INS.file)
223
224$(ROOTDLIBDIR)/%.o: %.o
225	$(INS.file)
226
227$(ROOTDLIBDIR64)/%.o: %.o
228	$(INS.file)
229
230$(ROOTDLIBS): $(ROOTDLIBDIR)
231
232$(ROOTDOBJS): $(ROOTDLIBDIR)
233
234$(ROOTDOBJS64): $(ROOTDLIBDIR64)
235
236include ../../Makefile.targ
237