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.
25 # Copyright (c) 2018, Joyent, Inc.
73 OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
75 DRTISRCS = dlink_init.c dlink_common.c
76 DRTIOBJS = $(DRTISRCS:%.c=pics/%.o)
79 LIBDAUDITSRCS = dlink_audit.c dlink_common.c
80 LIBDAUDITOBJS = $(LIBDAUDITSRCS:%.c=pics/%.o)
81 LIBDAUDIT = libdtrace_forceload.so
83 DLINKSRCS = dlink_common.c dlink_init.c dlink_audit.c
105 include ../../Makefile.lib
107 SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
112 CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
113 CLEANFILES += ../common/procfs.sed ../common/procfs.d
114 CLEANFILES += ../common/io.sed ../common/io.d
115 CLEANFILES += ../common/ip.sed ../common/ip.d
116 CLEANFILES += ../common/net.sed ../common/net.d
117 CLEANFILES += ../common/errno.d ../common/signal.d
118 CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
119 CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
120 CLEANFILES += ../common/tcp.sed ../common/tcp.d
121 CLEANFILES += ../common/udp.sed ../common/udp.d
122 CLEANFILES += $(LIBDAUDITOBJS) $(DRTIOBJS)
124 CLOBBERFILES += $(LIBDAUDIT) drti.o
126 CPPFLAGS += -I../common -I.
127 CFLAGS += $(C_BIGPICFLAGS)
128 CFLAGS64 += $(C_BIGPICFLAGS)
130 CERRWARN += -Wno-unused-label
131 CERRWARN += -Wno-unused-variable
132 CERRWARN += -Wno-parentheses
133 CERRWARN += -Wno-uninitialized
134 CERRWARN += -Wno-switch
140 LDLIBS += -lgen -lproc -lrtld_db -lctf -lelf -lc
141 DRTILDLIBS = $(LDLIBS.lib) -lc
142 LIBDAUDITLIBS = $(LDLIBS.lib) -lmapmalloc -lc -lproc
144 yydebug := YYCFLAGS += -DYYDEBUG
149 ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
150 ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
152 ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
153 ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ) $(ROOTDLIBDIR)/$(LIBDAUDIT)
154 ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ) $(ROOTDLIBDIR64)/$(LIBDAUDIT)
156 $(ROOTDLIBDIR)/%.d := FILEMODE=444
157 $(ROOTDLIBDIR)/%.o := FILEMODE=444
158 $(ROOTDLIBDIR64)/%.o := FILEMODE=444
159 $(ROOTDLIBDIR)/%.so := FILEMODE=555
160 $(ROOTDLIBDIR64)/%.so := FILEMODE=555
164 all: $(LIBS) $(DRTIOBJ) $(LIBDAUDIT)
166 dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
167 $(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
169 dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
170 $(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
171 @mv y.tab.h dt_grammar.h
172 @mv y.tab.c dt_grammar.c
174 pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
175 pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
177 ../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
178 sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
180 ../common/dt_names.c: ../common/mknames.sh $(SRCTOP)/include/sys/dtrace.h
181 sh ../common/mknames.sh < $(SRCTOP)/include/sys/dtrace.h > $@
183 ../common/errno.d: ../common/mkerrno.sh $(SRCTOP)/include/sys/errno.h
184 sh ../common/mkerrno.sh < $(SRCTOP)/include/sys/errno.h > $@
186 ../common/signal.d: ../common/mksignal.sh $(SRCTOP)/include/sys/iso/signal_iso.h
187 sh ../common/mksignal.sh < $(SRCTOP)/include/sys/iso/signal_iso.h > $@
189 ../common/%.sed: ../common/%.sed.in
190 $(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
191 sed 's/\&/\\\&/g' | grep '^s/' > $@
193 ../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
194 sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
196 ../common/io.d: ../common/io.sed ../common/io.d.in
197 sed -f ../common/io.sed < ../common/io.d.in > $@
199 ../common/ip.d: ../common/ip.sed ../common/ip.d.in
200 sed -f ../common/ip.sed < ../common/ip.d.in > $@
202 ../common/net.d: ../common/net.sed ../common/net.d.in
203 sed -f ../common/net.sed < ../common/net.d.in > $@
205 ../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
206 sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
208 ../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in
209 sed -f ../common/tcp.sed < ../common/tcp.d.in > $@
211 ../common/udp.d: ../common/udp.sed ../common/udp.d.in
212 sed -f ../common/udp.sed < ../common/udp.d.in > $@
214 pics/%.o: ../$(MACH)/%.c
215 $(COMPILE.c) -o $@ $<
218 pics/%.o: ../$(MACH)/%.s
219 $(COMPILE.s) -o $@ $<
222 $(DRTIOBJ): $(DRTIOBJS)
223 $(LD) -o $@ -r -Blocal -Breduce $(DRTIOBJS)
226 $(LIBDAUDIT): $(LIBDAUDITOBJS)
227 $(LINK.c) -o $@ $(GSHARED) -h$(LIBDAUDIT) $(ZTEXT) $(ZDEFS) $(BDIRECT) \
228 $(MAPFILE.PGA:%=-Wl,-M%) $(LIBDAUDITOBJS) \
235 $(ROOTDLIBDIR64): $(ROOTDLIBDIR)
238 $(ROOTDLIBDIR)/%.d: ../common/%.d
241 $(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
244 $(ROOTDLIBDIR)/%.d: %.d
247 $(ROOTDLIBDIR)/%.o: %.o
250 $(ROOTDLIBDIR64)/%.o: %.o
253 $(ROOTDLIBDIR)/%.so: %.so
256 $(ROOTDLIBDIR64)/%.so: %.so
259 $(ROOTDLIBS): $(ROOTDLIBDIR)
261 $(ROOTDOBJS): $(ROOTDLIBDIR)
263 $(ROOTDOBJS64): $(ROOTDLIBDIR64)
265 include ../../Makefile.targ