xref: /titanic_50/usr/src/lib/libdtrace/Makefile.com (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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 2006 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	procfs.d \
80	regs.d \
81	sched.d \
82	signal.d \
83	unistd.d
84
85include ../../Makefile.lib
86
87SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
88LIBS = $(DYNLIB) $(LINTLIB)
89
90SRCDIR = ../common
91
92CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
93CLEANFILES += ../common/procfs.sed ../common/procfs.d
94CLEANFILES += ../common/io.sed ../common/io.d
95CLEANFILES += ../common/errno.d ../common/signal.d
96CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
97
98CLOBBERFILES += drti.o
99
100CPPFLAGS += -I../common -I.
101CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
102CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
103YYCFLAGS =
104LDLIBS += -lgen -lproc -lrtld_db -lctf -lelf -lc
105DRTILDLIBS = $(LDLIBS.lib) -lc
106
107yydebug := YYCFLAGS += -DYYDEBUG
108
109$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
110
111LFLAGS = -t -v
112YFLAGS = -d -v
113
114ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
115ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
116
117ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
118ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
119ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
120
121.KEEP_STATE:
122
123all: $(LIBS) $(DRTIOBJ)
124
125lint: lintdrti lintcheck
126
127lintdrti: ../common/$(DRTISRC)
128	$(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
129
130dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
131	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
132
133dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
134	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
135	@mv y.tab.h dt_grammar.h
136	@mv y.tab.c dt_grammar.c
137
138pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
139pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
140
141pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
142pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
143
144../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
145	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
146
147../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
148	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
149
150../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
151	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
152
153../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
154	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
155
156../common/%.sed: ../common/%.sed.in
157	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | grep '^s/' > $@
158
159../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
160	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
161
162../common/io.d: ../common/io.sed ../common/io.d.in
163	sed -f ../common/io.sed < ../common/io.d.in > $@
164
165pics/%.o: ../$(MACH)/%.c
166	$(COMPILE.c) -o $@ $<
167	$(POST_PROCESS_O)
168
169pics/%.o: ../$(MACH)/%.s
170	$(COMPILE.s) -o $@ $<
171	$(POST_PROCESS_O)
172
173%.o: ../common/%.c
174	$(COMPILE.c) -o $@ $<
175	$(POST_PROCESS_O)
176
177$(ROOTDLIBDIR):
178	$(INS.dir)
179
180$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
181	$(INS.dir)
182
183$(ROOTDLIBDIR)/%.d: ../common/%.d
184	$(INS.file)
185
186$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
187	$(INS.file)
188
189$(ROOTDLIBDIR)/%.d: %.d
190	$(INS.file)
191
192$(ROOTDLIBDIR)/%.o: %.o
193	$(INS.file)
194
195$(ROOTDLIBDIR64)/%.o: %.o
196	$(INS.file)
197
198$(ROOTDLIBS): $(ROOTDLIBDIR)
199
200$(ROOTDOBJS): $(ROOTDLIBDIR)
201
202$(ROOTDOBJS64): $(ROOTDLIBDIR64)
203
204include ../../Makefile.targ
205