xref: /titanic_44/usr/src/lib/libdtrace/Makefile.com (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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_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
91SPECMAPFILE = $(MAPDIR)/mapfile
92
93CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
94CLEANFILES += ../common/procfs.sed ../common/procfs.d
95CLEANFILES += ../common/io.sed ../common/io.d
96CLEANFILES += ../common/dt_errtags.c ../common/errno.d ../common/signal.d
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/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
148	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
149
150../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
151	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
152
153../common/%.sed: ../common/%.sed.in
154	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | grep '^s/' > $@
155
156../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
157	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
158
159../common/io.d: ../common/io.sed ../common/io.d.in
160	sed -f ../common/io.sed < ../common/io.d.in > $@
161
162pics/%.o: ../$(MACH)/%.c
163	$(COMPILE.c) -o $@ $<
164	$(POST_PROCESS_O)
165
166pics/%.o: ../$(MACH)/%.s
167	$(COMPILE.s) -o $@ $<
168	$(POST_PROCESS_O)
169
170%.o: ../common/%.c
171	$(COMPILE.c) -o $@ $<
172	$(POST_PROCESS_O)
173
174$(ROOTDLIBDIR):
175	$(INS.dir)
176
177$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
178	$(INS.dir)
179
180$(ROOTDLIBDIR)/%.d: ../common/%.d
181	$(INS.file)
182
183$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
184	$(INS.file)
185
186$(ROOTDLIBDIR)/%.d: %.d
187	$(INS.file)
188
189$(ROOTDLIBDIR)/%.o: %.o
190	$(INS.file)
191
192$(ROOTDLIBDIR64)/%.o: %.o
193	$(INS.file)
194
195$(ROOTDLIBS): $(ROOTDLIBDIR)
196
197$(ROOTDOBJS): $(ROOTDLIBDIR)
198
199$(ROOTDOBJS64): $(ROOTDLIBDIR64)
200
201include ../../Makefile.targ
202