xref: /titanic_51/usr/src/lib/libdtrace/Makefile.com (revision 0f6e7ba6e1c0f032e0e839fdba06b2e0ddb0c0d4)
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	procfs.d \
80	regs.d \
81	sched.d \
82	signal.d \
83	sysevent.d \
84	unistd.d
85
86include ../../Makefile.lib
87
88SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
89LIBS = $(DYNLIB) $(LINTLIB)
90
91SRCDIR = ../common
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/errno.d ../common/signal.d
97CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
98CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
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 '"' '@' | \
160	    sed 's/\&/\\\&/g' | grep '^s/' > $@
161
162../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
163	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
164
165../common/io.d: ../common/io.sed ../common/io.d.in
166	sed -f ../common/io.sed < ../common/io.d.in > $@
167
168../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
169	sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
170
171pics/%.o: ../$(MACH)/%.c
172	$(COMPILE.c) -o $@ $<
173	$(POST_PROCESS_O)
174
175pics/%.o: ../$(MACH)/%.s
176	$(COMPILE.s) -o $@ $<
177	$(POST_PROCESS_O)
178
179%.o: ../common/%.c
180	$(COMPILE.c) -o $@ $<
181	$(POST_PROCESS_O)
182
183$(ROOTDLIBDIR):
184	$(INS.dir)
185
186$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
187	$(INS.dir)
188
189$(ROOTDLIBDIR)/%.d: ../common/%.d
190	$(INS.file)
191
192$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
193	$(INS.file)
194
195$(ROOTDLIBDIR)/%.d: %.d
196	$(INS.file)
197
198$(ROOTDLIBDIR)/%.o: %.o
199	$(INS.file)
200
201$(ROOTDLIBDIR64)/%.o: %.o
202	$(INS.file)
203
204$(ROOTDLIBS): $(ROOTDLIBDIR)
205
206$(ROOTDOBJS): $(ROOTDLIBDIR)
207
208$(ROOTDOBJS64): $(ROOTDLIBDIR64)
209
210include ../../Makefile.targ
211