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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 23# Copyright (c) 2012 by Delphix. All rights reserved. 24# 25 26LIBRARY = libdtrace.a 27VERS = .1 28 29LIBSRCS = \ 30 dt_aggregate.c \ 31 dt_as.c \ 32 dt_buf.c \ 33 dt_cc.c \ 34 dt_cg.c \ 35 dt_consume.c \ 36 dt_decl.c \ 37 dt_dis.c \ 38 dt_dof.c \ 39 dt_error.c \ 40 dt_errtags.c \ 41 dt_handle.c \ 42 dt_ident.c \ 43 dt_inttab.c \ 44 dt_link.c \ 45 dt_list.c \ 46 dt_open.c \ 47 dt_options.c \ 48 dt_program.c \ 49 dt_map.c \ 50 dt_module.c \ 51 dt_names.c \ 52 dt_parser.c \ 53 dt_pcb.c \ 54 dt_pid.c \ 55 dt_pq.c \ 56 dt_pragma.c \ 57 dt_print.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 73DRTISRCS = dlink_init.c dlink_common.c 74DRTIOBJS = $(DRTISRCS:%.c=pics/%.o) 75DRTIOBJ = drti.o 76 77LIBDAUDITSRCS = dlink_audit.c dlink_common.c 78LIBDAUDITOBJS = $(LIBDAUDITSRCS:%.c=pics/%.o) 79LIBDAUDIT = libdtrace_forceload.so 80 81DLINKSRCS = dlink_common.c dlink_init.c dlink_audit.c 82 83DLIBSRCS += \ 84 errno.d \ 85 fc.d \ 86 io.d \ 87 ip.d \ 88 iscsit.d \ 89 net.d \ 90 nfs.d \ 91 nfssrv.d \ 92 procfs.d \ 93 regs.d \ 94 sched.d \ 95 signal.d \ 96 scsi.d \ 97 srp.d \ 98 sysevent.d \ 99 tcp.d \ 100 udp.d \ 101 unistd.d 102 103include ../../Makefile.lib 104 105SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c) 106LIBS = $(DYNLIB) $(LINTLIB) 107 108SRCDIR = ../common 109 110CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output 111CLEANFILES += ../common/procfs.sed ../common/procfs.d 112CLEANFILES += ../common/io.sed ../common/io.d 113CLEANFILES += ../common/ip.sed ../common/ip.d 114CLEANFILES += ../common/net.sed ../common/net.d 115CLEANFILES += ../common/errno.d ../common/signal.d 116CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c 117CLEANFILES += ../common/sysevent.sed ../common/sysevent.d 118CLEANFILES += ../common/tcp.sed ../common/tcp.d 119CLEANFILES += ../common/udp.sed ../common/udp.d 120 121CLOBBERFILES += drti.o 122 123CPPFLAGS += -I../common -I. 124CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS) 125CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS) 126 127CERRWARN += -_gcc=-Wno-unused-label 128CERRWARN += -_gcc=-Wno-unused-variable 129CERRWARN += -_gcc=-Wno-parentheses 130CERRWARN += -_gcc=-Wno-uninitialized 131CERRWARN += -_gcc=-Wno-switch 132 133YYCFLAGS = 134LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc 135DRTILDLIBS = $(LDLIBS.lib) -lc 136 137yydebug := YYCFLAGS += -DYYDEBUG 138 139$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) 140 141LFLAGS = -t -v 142YFLAGS = -d -v 143 144ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace 145ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64 146 147ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%) 148ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ) $(ROOTDLIBDIR)/$(LIBDAUDIT) 149ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ) $(ROOTDLIBDIR64)/$(LIBDAUDIT) 150 151$(ROOTDLIBDIR)/%.d := FILEMODE=444 152$(ROOTDLIBDIR)/%.o := FILEMODE=444 153$(ROOTDLIBDIR64)/%.o := FILEMODE=444 154$(ROOTDLIBDIR)/%.so := FILEMODE=555 155$(ROOTDLIBDIR64)/%.so := FILEMODE=555 156 157.KEEP_STATE: 158 159all: $(LIBS) $(DRTIOBJ) $(LIBDAUDIT) 160 161lint: lintdlink lintcheck 162 163lintdlink: $(DLINKSRCS:%.c=../common/%.c) 164 $(LINT.c) $(DLINKSRCS:%.c=../common/%.c) $(DRTILDLIBS) 165 166dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h 167 $(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@ 168 169dt_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 173 174pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS) 175pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS) 176 177pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED 178pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE = 179 180../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h 181 sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@ 182 183../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h 184 sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@ 185 186../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h 187 sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@ 188 189../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h 190 sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@ 191 192../common/%.sed: ../common/%.sed.in 193 $(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \ 194 sed 's/\&/\\\&/g' | grep '^s/' > $@ 195 196../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in 197 sed -f ../common/procfs.sed < ../common/procfs.d.in > $@ 198 199../common/io.d: ../common/io.sed ../common/io.d.in 200 sed -f ../common/io.sed < ../common/io.d.in > $@ 201 202../common/ip.d: ../common/ip.sed ../common/ip.d.in 203 sed -f ../common/ip.sed < ../common/ip.d.in > $@ 204 205../common/net.d: ../common/net.sed ../common/net.d.in 206 sed -f ../common/net.sed < ../common/net.d.in > $@ 207 208../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in 209 sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@ 210 211../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in 212 sed -f ../common/tcp.sed < ../common/tcp.d.in > $@ 213 214../common/udp.d: ../common/udp.sed ../common/udp.d.in 215 sed -f ../common/udp.sed < ../common/udp.d.in > $@ 216 217pics/%.o: ../$(MACH)/%.c 218 $(COMPILE.c) -o $@ $< 219 $(POST_PROCESS_O) 220 221pics/%.o: ../$(MACH)/%.s 222 $(COMPILE.s) -o $@ $< 223 $(POST_PROCESS_O) 224 225$(DRTIOBJ): $(DRTIOBJS) 226 $(LD) -o $@ -r -Blocal -Breduce $(DRTIOBJS) 227 $(POST_PROCESS_O) 228 229$(LIBDAUDIT): $(LIBDAUDITOBJS) 230 $(LINK.c) -o $@ $(GSHARED) -h$(LIBDAUDIT) $(ZTEXT) $(ZDEFS) $(BDIRECT) \ 231 $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) $(LIBDAUDITOBJS) \ 232 -lmapmalloc -lc -lproc 233 $(POST_PROCESS_SO) 234 235$(ROOTDLIBDIR): 236 $(INS.dir) 237 238$(ROOTDLIBDIR64): $(ROOTDLIBDIR) 239 $(INS.dir) 240 241$(ROOTDLIBDIR)/%.d: ../common/%.d 242 $(INS.file) 243 244$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d 245 $(INS.file) 246 247$(ROOTDLIBDIR)/%.d: %.d 248 $(INS.file) 249 250$(ROOTDLIBDIR)/%.o: %.o 251 $(INS.file) 252 253$(ROOTDLIBDIR64)/%.o: %.o 254 $(INS.file) 255 256$(ROOTDLIBDIR)/%.so: %.so 257 $(INS.file) 258 259$(ROOTDLIBDIR64)/%.so: %.so 260 $(INS.file) 261 262$(ROOTDLIBS): $(ROOTDLIBDIR) 263 264$(ROOTDOBJS): $(ROOTDLIBDIR) 265 266$(ROOTDOBJS64): $(ROOTDLIBDIR64) 267 268include ../../Makefile.targ 269