xref: /titanic_52/usr/src/lib/libdtrace/Makefile.com (revision 71269a2275bf5a143dad6461eee2710a344e7261)
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 2008 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/net.sed ../common/net.d
101CLEANFILES += ../common/errno.d ../common/signal.d
102CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
103CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
104
105CLOBBERFILES += drti.o
106
107CPPFLAGS += -I../common -I.
108CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
109CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
110YYCFLAGS =
111LDLIBS += -lgen -lproc -lrtld_db -lctf -lelf -lc
112DRTILDLIBS = $(LDLIBS.lib) -lc
113
114yydebug := YYCFLAGS += -DYYDEBUG
115
116$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
117
118LFLAGS = -t -v
119YFLAGS = -d -v
120
121ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
122ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
123
124ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
125ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
126ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
127
128.KEEP_STATE:
129
130all: $(LIBS) $(DRTIOBJ)
131
132lint: lintdrti lintcheck
133
134lintdrti: ../common/$(DRTISRC)
135	$(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
136
137dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
138	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
139
140dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
141	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
142	@mv y.tab.h dt_grammar.h
143	@mv y.tab.c dt_grammar.c
144
145pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
146pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
147
148pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
149pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
150
151../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
152	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
153
154../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
155	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
156
157../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
158	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
159
160../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
161	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
162
163../common/%.sed: ../common/%.sed.in
164	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
165	    sed 's/\&/\\\&/g' | grep '^s/' > $@
166
167../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
168	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
169
170../common/io.d: ../common/io.sed ../common/io.d.in
171	sed -f ../common/io.sed < ../common/io.d.in > $@
172
173../common/ip.d: ../common/ip.sed ../common/ip.d.in
174	sed -f ../common/ip.sed < ../common/ip.d.in > $@
175
176../common/net.d: ../common/net.sed ../common/net.d.in
177	sed -f ../common/net.sed < ../common/net.d.in > $@
178
179../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
180	sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
181
182pics/%.o: ../$(MACH)/%.c
183	$(COMPILE.c) -o $@ $<
184	$(POST_PROCESS_O)
185
186pics/%.o: ../$(MACH)/%.s
187	$(COMPILE.s) -o $@ $<
188	$(POST_PROCESS_O)
189
190%.o: ../common/%.c
191	$(COMPILE.c) -o $@ $<
192	$(POST_PROCESS_O)
193
194$(ROOTDLIBDIR):
195	$(INS.dir)
196
197$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
198	$(INS.dir)
199
200$(ROOTDLIBDIR)/%.d: ../common/%.d
201	$(INS.file)
202
203$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
204	$(INS.file)
205
206$(ROOTDLIBDIR)/%.d: %.d
207	$(INS.file)
208
209$(ROOTDLIBDIR)/%.o: %.o
210	$(INS.file)
211
212$(ROOTDLIBDIR64)/%.o: %.o
213	$(INS.file)
214
215$(ROOTDLIBS): $(ROOTDLIBDIR)
216
217$(ROOTDOBJS): $(ROOTDLIBDIR)
218
219$(ROOTDOBJS64): $(ROOTDLIBDIR64)
220
221include ../../Makefile.targ
222