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