xref: /titanic_51/usr/src/lib/libdtrace/Makefile.com (revision 1a7c1b724419d3cb5fa6eea75123c6b2060ba31b)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29LIBRARY = libdtrace.a
30VERS = .1
31
32LIBSRCS = \
33	dt_aggregate.c \
34	dt_as.c \
35	dt_buf.c \
36	dt_cc.c \
37	dt_cg.c \
38	dt_consume.c \
39	dt_decl.c \
40	dt_dis.c \
41	dt_dof.c \
42	dt_error.c \
43	dt_errtags.c \
44	dt_handle.c \
45	dt_ident.c \
46	dt_inttab.c \
47	dt_link.c \
48	dt_list.c \
49	dt_open.c \
50	dt_options.c \
51	dt_program.c \
52	dt_map.c \
53	dt_module.c \
54	dt_names.c \
55	dt_parser.c \
56	dt_pcb.c \
57	dt_pid.c \
58	dt_pragma.c \
59	dt_printf.c \
60	dt_proc.c \
61	dt_provider.c \
62	dt_regset.c \
63        dt_string.c \
64	dt_strtab.c \
65	dt_subr.c \
66	dt_work.c \
67	dt_xlator.c
68
69LIBISASRCS = \
70	dt_isadep.c
71
72OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
73
74DRTISRC = drti.c
75DRTIOBJ = $(DRTISRC:%.c=%.o)
76
77DLIBSRCS += \
78	errno.d \
79	io.d \
80	procfs.d \
81	regs.d \
82	sched.d \
83	signal.d \
84	unistd.d
85
86include ../../Makefile.lib
87
88SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
89LIBS = $(DYNLIB) $(LINTLIB)
90
91SRCDIR = ../common
92SPECMAPFILE = $(MAPDIR)/mapfile
93
94CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
95CLEANFILES += ../common/procfs.sed ../common/procfs.d
96CLEANFILES += ../common/io.sed ../common/io.d
97CLEANFILES += ../common/errno.d ../common/signal.d
98CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
99
100CLOBBERFILES += drti.o
101
102CPPFLAGS += -I../common -I.
103CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
104CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
105YYCFLAGS =
106LDLIBS += -lgen -lproc -lrtld_db -lctf -lelf -lc
107DRTILDLIBS = $(LDLIBS.lib) -lc
108
109yydebug := YYCFLAGS += -DYYDEBUG
110
111$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
112
113LFLAGS = -t -v
114YFLAGS = -d -v
115
116ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
117ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
118
119ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
120ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
121ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
122
123.KEEP_STATE:
124
125all: $(LIBS) $(DRTIOBJ)
126
127lint: lintdrti lintcheck
128
129lintdrti: ../common/$(DRTISRC)
130	$(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
131
132dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
133	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
134
135dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
136	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
137	@mv y.tab.h dt_grammar.h
138	@mv y.tab.c dt_grammar.c
139
140pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
141pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
142
143pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
144pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
145
146../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
147	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
148
149../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
150	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
151
152../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
153	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
154
155../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
156	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
157
158../common/%.sed: ../common/%.sed.in
159	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | grep '^s/' > $@
160
161../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
162	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
163
164../common/io.d: ../common/io.sed ../common/io.d.in
165	sed -f ../common/io.sed < ../common/io.d.in > $@
166
167pics/%.o: ../$(MACH)/%.c
168	$(COMPILE.c) -o $@ $<
169	$(POST_PROCESS_O)
170
171pics/%.o: ../$(MACH)/%.s
172	$(COMPILE.s) -o $@ $<
173	$(POST_PROCESS_O)
174
175%.o: ../common/%.c
176	$(COMPILE.c) -o $@ $<
177	$(POST_PROCESS_O)
178
179$(ROOTDLIBDIR):
180	$(INS.dir)
181
182$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
183	$(INS.dir)
184
185$(ROOTDLIBDIR)/%.d: ../common/%.d
186	$(INS.file)
187
188$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
189	$(INS.file)
190
191$(ROOTDLIBDIR)/%.d: %.d
192	$(INS.file)
193
194$(ROOTDLIBDIR)/%.o: %.o
195	$(INS.file)
196
197$(ROOTDLIBDIR64)/%.o: %.o
198	$(INS.file)
199
200$(ROOTDLIBS): $(ROOTDLIBDIR)
201
202$(ROOTDOBJS): $(ROOTDLIBDIR)
203
204$(ROOTDOBJS64): $(ROOTDLIBDIR64)
205
206include ../../Makefile.targ
207