xref: /titanic_50/usr/src/lib/libdtrace/Makefile.com (revision b2b3ca14272ffe2a6fc37bab2ab65b8f6702d750)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#
26
27LIBRARY = libdtrace.a
28VERS = .1
29
30LIBSRCS = \
31	dt_aggregate.c \
32	dt_as.c \
33	dt_buf.c \
34	dt_cc.c \
35	dt_cg.c \
36	dt_consume.c \
37	dt_decl.c \
38	dt_dis.c \
39	dt_dof.c \
40	dt_error.c \
41	dt_errtags.c \
42	dt_handle.c \
43	dt_ident.c \
44	dt_inttab.c \
45	dt_link.c \
46	dt_list.c \
47	dt_open.c \
48	dt_options.c \
49	dt_program.c \
50	dt_map.c \
51	dt_module.c \
52	dt_names.c \
53	dt_parser.c \
54	dt_pcb.c \
55	dt_pid.c \
56	dt_pragma.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	unistd.d
91
92include ../../Makefile.lib
93
94SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
95LIBS = $(DYNLIB) $(LINTLIB)
96
97SRCDIR = ../common
98
99CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
100CLEANFILES += ../common/procfs.sed ../common/procfs.d
101CLEANFILES += ../common/io.sed ../common/io.d
102CLEANFILES += ../common/ip.sed ../common/ip.d
103CLEANFILES += ../common/net.sed ../common/net.d
104CLEANFILES += ../common/errno.d ../common/signal.d
105CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
106CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
107
108CLOBBERFILES += drti.o
109
110CPPFLAGS += -I../common -I.
111CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
112CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
113YYCFLAGS =
114LDLIBS += -lgen -lproc -lrtld_db -lctf -lelf -lc
115DRTILDLIBS = $(LDLIBS.lib) -lc
116
117yydebug := YYCFLAGS += -DYYDEBUG
118
119$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
120
121LFLAGS = -t -v
122YFLAGS = -d -v
123
124ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
125ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
126
127ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
128ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
129ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
130
131.KEEP_STATE:
132
133all: $(LIBS) $(DRTIOBJ)
134
135lint: lintdrti lintcheck
136
137lintdrti: ../common/$(DRTISRC)
138	$(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
139
140dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
141	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
142
143dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
144	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
145	@mv y.tab.h dt_grammar.h
146	@mv y.tab.c dt_grammar.c
147
148pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
149pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
150
151pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
152pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
153
154../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
155	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
156
157../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
158	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
159
160../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
161	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
162
163../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
164	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
165
166../common/%.sed: ../common/%.sed.in
167	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
168	    sed 's/\&/\\\&/g' | grep '^s/' > $@
169
170../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
171	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
172
173../common/io.d: ../common/io.sed ../common/io.d.in
174	sed -f ../common/io.sed < ../common/io.d.in > $@
175
176../common/ip.d: ../common/ip.sed ../common/ip.d.in
177	sed -f ../common/ip.sed < ../common/ip.d.in > $@
178
179../common/net.d: ../common/net.sed ../common/net.d.in
180	sed -f ../common/net.sed < ../common/net.d.in > $@
181
182../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
183	sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
184
185pics/%.o: ../$(MACH)/%.c
186	$(COMPILE.c) -o $@ $<
187	$(POST_PROCESS_O)
188
189pics/%.o: ../$(MACH)/%.s
190	$(COMPILE.s) -o $@ $<
191	$(POST_PROCESS_O)
192
193%.o: ../common/%.c
194	$(COMPILE.c) -o $@ $<
195	$(POST_PROCESS_O)
196
197$(ROOTDLIBDIR):
198	$(INS.dir)
199
200$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
201	$(INS.dir)
202
203$(ROOTDLIBDIR)/%.d: ../common/%.d
204	$(INS.file)
205
206$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
207	$(INS.file)
208
209$(ROOTDLIBDIR)/%.d: %.d
210	$(INS.file)
211
212$(ROOTDLIBDIR)/%.o: %.o
213	$(INS.file)
214
215$(ROOTDLIBDIR64)/%.o: %.o
216	$(INS.file)
217
218$(ROOTDLIBS): $(ROOTDLIBDIR)
219
220$(ROOTDOBJS): $(ROOTDLIBDIR)
221
222$(ROOTDOBJS64): $(ROOTDLIBDIR64)
223
224include ../../Makefile.targ
225