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