xref: /illumos-gate/usr/src/lib/libdtrace/Makefile.com (revision 5279807d7e1818eac6f90ac640b7a89cdb37522d)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25#
26
27LIBRARY = libdtrace.a
28VERS = .1
29
30LIBSRCS = \
31	dt_aggregate.c \
32	dt_as.c \
33	dt_buf.c \
34	dt_cc.c \
35	dt_cg.c \
36	dt_consume.c \
37	dt_decl.c \
38	dt_dis.c \
39	dt_dof.c \
40	dt_error.c \
41	dt_errtags.c \
42	dt_handle.c \
43	dt_ident.c \
44	dt_inttab.c \
45	dt_link.c \
46	dt_list.c \
47	dt_open.c \
48	dt_options.c \
49	dt_program.c \
50	dt_map.c \
51	dt_module.c \
52	dt_names.c \
53	dt_parser.c \
54	dt_pcb.c \
55	dt_pid.c \
56	dt_pragma.c \
57	dt_printf.c \
58	dt_proc.c \
59	dt_provider.c \
60	dt_regset.c \
61        dt_string.c \
62	dt_strtab.c \
63	dt_subr.c \
64	dt_work.c \
65	dt_xlator.c
66
67LIBISASRCS = \
68	dt_isadep.c
69
70OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
71
72DRTISRC = drti.c
73DRTIOBJ = $(DRTISRC:%.c=%.o)
74
75DLIBSRCS += \
76	errno.d \
77	fc.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	scsi.d \
87	sysevent.d \
88	unistd.d
89
90include ../../Makefile.lib
91
92SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
93LIBS = $(DYNLIB) $(LINTLIB)
94
95SRCDIR = ../common
96
97CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
98CLEANFILES += ../common/procfs.sed ../common/procfs.d
99CLEANFILES += ../common/io.sed ../common/io.d
100CLEANFILES += ../common/ip.sed ../common/ip.d
101CLEANFILES += ../common/net.sed ../common/net.d
102CLEANFILES += ../common/errno.d ../common/signal.d
103CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
104CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
105
106CLOBBERFILES += drti.o
107
108CPPFLAGS += -I../common -I.
109CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
110CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
111YYCFLAGS =
112LDLIBS += -lgen -lproc -lrtld_db -lctf -lelf -lc
113DRTILDLIBS = $(LDLIBS.lib) -lc
114
115yydebug := YYCFLAGS += -DYYDEBUG
116
117$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
118
119LFLAGS = -t -v
120YFLAGS = -d -v
121
122ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
123ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
124
125ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
126ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
127ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
128
129.KEEP_STATE:
130
131all: $(LIBS) $(DRTIOBJ)
132
133lint: lintdrti lintcheck
134
135lintdrti: ../common/$(DRTISRC)
136	$(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
137
138dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
139	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
140
141dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
142	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
143	@mv y.tab.h dt_grammar.h
144	@mv y.tab.c dt_grammar.c
145
146pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
147pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
148
149pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
150pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
151
152../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
153	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
154
155../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
156	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
157
158../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
159	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
160
161../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
162	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
163
164../common/%.sed: ../common/%.sed.in
165	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
166	    sed 's/\&/\\\&/g' | grep '^s/' > $@
167
168../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
169	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
170
171../common/io.d: ../common/io.sed ../common/io.d.in
172	sed -f ../common/io.sed < ../common/io.d.in > $@
173
174../common/ip.d: ../common/ip.sed ../common/ip.d.in
175	sed -f ../common/ip.sed < ../common/ip.d.in > $@
176
177../common/net.d: ../common/net.sed ../common/net.d.in
178	sed -f ../common/net.sed < ../common/net.d.in > $@
179
180../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
181	sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
182
183pics/%.o: ../$(MACH)/%.c
184	$(COMPILE.c) -o $@ $<
185	$(POST_PROCESS_O)
186
187pics/%.o: ../$(MACH)/%.s
188	$(COMPILE.s) -o $@ $<
189	$(POST_PROCESS_O)
190
191%.o: ../common/%.c
192	$(COMPILE.c) -o $@ $<
193	$(POST_PROCESS_O)
194
195$(ROOTDLIBDIR):
196	$(INS.dir)
197
198$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
199	$(INS.dir)
200
201$(ROOTDLIBDIR)/%.d: ../common/%.d
202	$(INS.file)
203
204$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
205	$(INS.file)
206
207$(ROOTDLIBDIR)/%.d: %.d
208	$(INS.file)
209
210$(ROOTDLIBDIR)/%.o: %.o
211	$(INS.file)
212
213$(ROOTDLIBDIR64)/%.o: %.o
214	$(INS.file)
215
216$(ROOTDLIBS): $(ROOTDLIBDIR)
217
218$(ROOTDOBJS): $(ROOTDLIBDIR)
219
220$(ROOTDOBJS64): $(ROOTDLIBDIR64)
221
222include ../../Makefile.targ
223