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.
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.
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]
22 # Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23 # Copyright (c) 2011, 2016 by Delphix. All rights reserved.
72 OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
74 DRTISRCS = dlink_init.c dlink_common.c
75 DRTIOBJS = $(DRTISRCS:%.c=pics/%.o)
78 LIBDAUDITSRCS = dlink_audit.c dlink_common.c
79 LIBDAUDITOBJS = $(LIBDAUDITSRCS:%.c=pics/%.o)
80 LIBDAUDIT = libdtrace_forceload.so
82 DLINKSRCS = dlink_common.c dlink_init.c dlink_audit.c
104 include ../../Makefile.lib
106 SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
107 LIBS = $(DYNLIB) $(LINTLIB)
111 CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
112 CLEANFILES += ../common/procfs.sed ../common/procfs.d
113 CLEANFILES += ../common/io.sed ../common/io.d
114 CLEANFILES += ../common/ip.sed ../common/ip.d
115 CLEANFILES += ../common/net.sed ../common/net.d
116 CLEANFILES += ../common/errno.d ../common/signal.d
117 CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
118 CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
119 CLEANFILES += ../common/tcp.sed ../common/tcp.d
120 CLEANFILES += ../common/udp.sed ../common/udp.d
121 CLEANFILES += $(LIBDAUDITOBJS) $(DRTIOBJS)
123 CLOBBERFILES += $(LIBDAUDIT) drti.o
125 CPPFLAGS += -I../common -I.
126 CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
127 CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
129 CERRWARN += -_gcc=-Wno-unused-label
130 CERRWARN += -_gcc=-Wno-unused-variable
131 CERRWARN += -_gcc=-Wno-parentheses
132 CERRWARN += -_gcc=-Wno-uninitialized
133 CERRWARN += -_gcc=-Wno-switch
136 LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc
137 DRTILDLIBS = $(LDLIBS.lib) -lc
138 LIBDAUDITLIBS = $(LDLIBS.lib) -lmapmalloc -lc -lproc
140 yydebug := YYCFLAGS += -DYYDEBUG
142 $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
147 ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
148 ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
150 ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
151 ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ) $(ROOTDLIBDIR)/$(LIBDAUDIT)
152 ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ) $(ROOTDLIBDIR64)/$(LIBDAUDIT)
154 $(ROOTDLIBDIR)/%.d := FILEMODE=444
155 $(ROOTDLIBDIR)/%.o := FILEMODE=444
156 $(ROOTDLIBDIR64)/%.o := FILEMODE=444
157 $(ROOTDLIBDIR)/%.so := FILEMODE=555
158 $(ROOTDLIBDIR64)/%.so := FILEMODE=555
162 all: $(LIBS) $(DRTIOBJ) $(LIBDAUDIT)
164 lint: lintdlink lintcheck
166 lintdlink: $(DLINKSRCS:%.c=../common/%.c)
167 $(LINT.c) $(DLINKSRCS:%.c=../common/%.c) $(DRTILDLIBS)
169 dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
170 $(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
172 dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
173 $(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
174 @mv y.tab.h dt_grammar.h
175 @mv y.tab.c dt_grammar.c
177 pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
178 pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
180 pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
181 pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
183 ../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
184 sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
186 ../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
187 sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
189 ../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
190 sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
192 ../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
193 sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
195 ../common/%.sed: ../common/%.sed.in
196 $(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
197 sed 's/\&/\\\&/g' | grep '^s/' > $@
199 ../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
200 sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
202 ../common/io.d: ../common/io.sed ../common/io.d.in
203 sed -f ../common/io.sed < ../common/io.d.in > $@
205 ../common/ip.d: ../common/ip.sed ../common/ip.d.in
206 sed -f ../common/ip.sed < ../common/ip.d.in > $@
208 ../common/net.d: ../common/net.sed ../common/net.d.in
209 sed -f ../common/net.sed < ../common/net.d.in > $@
211 ../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
212 sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
214 ../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in
215 sed -f ../common/tcp.sed < ../common/tcp.d.in > $@
217 ../common/udp.d: ../common/udp.sed ../common/udp.d.in
218 sed -f ../common/udp.sed < ../common/udp.d.in > $@
220 pics/%.o: ../$(MACH)/%.c
221 $(COMPILE.c) -o $@ $<
224 pics/%.o: ../$(MACH)/%.s
225 $(COMPILE.s) -o $@ $<
228 $(DRTIOBJ): $(DRTIOBJS)
229 $(LD) -o $@ -r -Blocal -Breduce $(DRTIOBJS)
232 $(LIBDAUDIT): $(LIBDAUDITOBJS)
233 $(LINK.c) -o $@ $(GSHARED) -h$(LIBDAUDIT) $(ZTEXT) $(ZDEFS) $(BDIRECT) \
234 $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) $(LIBDAUDITOBJS) \
241 $(ROOTDLIBDIR64): $(ROOTDLIBDIR)
244 $(ROOTDLIBDIR)/%.d: ../common/%.d
247 $(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
250 $(ROOTDLIBDIR)/%.d: %.d
253 $(ROOTDLIBDIR)/%.o: %.o
256 $(ROOTDLIBDIR64)/%.o: %.o
259 $(ROOTDLIBDIR)/%.so: %.so
262 $(ROOTDLIBDIR64)/%.so: %.so
265 $(ROOTDLIBS): $(ROOTDLIBDIR)
267 $(ROOTDOBJS): $(ROOTDLIBDIR)
269 $(ROOTDOBJS64): $(ROOTDLIBDIR64)
271 include ../../Makefile.targ