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) 2011, 2016 by Delphix. All rights reserved. 24 # 25 26 LIBRARY = libdtrace.a 27 VERS = .1 28 29 LIBSRCS = \ 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_sugar.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_pq.c \ 57 dt_pragma.c \ 58 dt_print.c \ 59 dt_printf.c \ 60 dt_proc.c \ 61 dt_provider.c \ 62 dt_regset.c \ 63 dt_string.c \ 64 dt_strtab.c \ 65 dt_subr.c \ 66 dt_work.c \ 67 dt_xlator.c 68 69 LIBISASRCS = \ 70 dt_isadep.c 71 72 OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o) 73 74 DRTISRCS = dlink_init.c dlink_common.c 75 DRTIOBJS = $(DRTISRCS:%.c=pics/%.o) 76 DRTIOBJ = drti.o 77 78 LIBDAUDITSRCS = dlink_audit.c dlink_common.c 79 LIBDAUDITOBJS = $(LIBDAUDITSRCS:%.c=pics/%.o) 80 LIBDAUDIT = libdtrace_forceload.so 81 82 DLINKSRCS = dlink_common.c dlink_init.c dlink_audit.c 83 84 DLIBSRCS += \ 85 errno.d \ 86 fc.d \ 87 io.d \ 88 ip.d \ 89 iscsit.d \ 90 net.d \ 91 nfs.d \ 92 nfssrv.d \ 93 procfs.d \ 94 regs.d \ 95 sched.d \ 96 signal.d \ 97 scsi.d \ 98 smb.d \ 99 srp.d \ 100 sysevent.d \ 101 tcp.d \ 102 udp.d \ 103 unistd.d 104 105 include ../../Makefile.lib 106 107 SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c) 108 LIBS = $(DYNLIB) $(LINTLIB) 109 110 SRCDIR = ../common 111 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) 123 124 CLOBBERFILES += $(LIBDAUDIT) drti.o 125 126 CPPFLAGS += -I../common -I. 127 CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS) 128 CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS) 129 130 CERRWARN += -_gcc=-Wno-unused-label 131 CERRWARN += -_gcc=-Wno-unused-variable 132 CERRWARN += -_gcc=-Wno-parentheses 133 CERRWARN += -_gcc=-Wno-uninitialized 134 CERRWARN += -_gcc=-Wno-switch 135 136 YYCFLAGS = 137 LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc 138 DRTILDLIBS = $(LDLIBS.lib) -lc 139 LIBDAUDITLIBS = $(LDLIBS.lib) -lmapmalloc -lc -lproc 140 141 yydebug := YYCFLAGS += -DYYDEBUG 142 143 $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) 144 145 LFLAGS = -t -v 146 YFLAGS = -d -v 147 148 ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace 149 ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64 150 151 ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%) 152 ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ) $(ROOTDLIBDIR)/$(LIBDAUDIT) 153 ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ) $(ROOTDLIBDIR64)/$(LIBDAUDIT) 154 155 $(ROOTDLIBDIR)/%.d := FILEMODE=444 156 $(ROOTDLIBDIR)/%.o := FILEMODE=444 157 $(ROOTDLIBDIR64)/%.o := FILEMODE=444 158 $(ROOTDLIBDIR)/%.so := FILEMODE=555 159 $(ROOTDLIBDIR64)/%.so := FILEMODE=555 160 161 .KEEP_STATE: 162 163 all: $(LIBS) $(DRTIOBJ) $(LIBDAUDIT) 164 165 lint: lintdlink lintcheck 166 167 lintdlink: $(DLINKSRCS:%.c=../common/%.c) 168 $(LINT.c) $(DLINKSRCS:%.c=../common/%.c) $(DRTILDLIBS) 169 170 dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h 171 $(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@ 172 173 dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y 174 $(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y 175 @mv y.tab.h dt_grammar.h 176 @mv y.tab.c dt_grammar.c 177 178 pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS) 179 pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS) 180 181 pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED 182 pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE = 183 184 ../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h 185 sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@ 186 187 ../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h 188 sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@ 189 190 ../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h 191 sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@ 192 193 ../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h 194 sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@ 195 196 ../common/%.sed: ../common/%.sed.in 197 $(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \ 198 sed 's/\&/\\\&/g' | grep '^s/' > $@ 199 200 ../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in 201 sed -f ../common/procfs.sed < ../common/procfs.d.in > $@ 202 203 ../common/io.d: ../common/io.sed ../common/io.d.in 204 sed -f ../common/io.sed < ../common/io.d.in > $@ 205 206 ../common/ip.d: ../common/ip.sed ../common/ip.d.in 207 sed -f ../common/ip.sed < ../common/ip.d.in > $@ 208 209 ../common/net.d: ../common/net.sed ../common/net.d.in 210 sed -f ../common/net.sed < ../common/net.d.in > $@ 211 212 ../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in 213 sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@ 214 215 ../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in 216 sed -f ../common/tcp.sed < ../common/tcp.d.in > $@ 217 218 ../common/udp.d: ../common/udp.sed ../common/udp.d.in 219 sed -f ../common/udp.sed < ../common/udp.d.in > $@ 220 221 pics/%.o: ../$(MACH)/%.c 222 $(COMPILE.c) -o $@ $< 223 $(POST_PROCESS_O) 224 225 pics/%.o: ../$(MACH)/%.s 226 $(COMPILE.s) -o $@ $< 227 $(POST_PROCESS_O) 228 229 $(DRTIOBJ): $(DRTIOBJS) 230 $(LD) -o $@ -r -Blocal -Breduce $(DRTIOBJS) 231 $(POST_PROCESS_O) 232 233 $(LIBDAUDIT): $(LIBDAUDITOBJS) 234 $(LINK.c) -o $@ $(GSHARED) -h$(LIBDAUDIT) $(ZTEXT) $(ZDEFS) $(BDIRECT) \ 235 $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) $(LIBDAUDITOBJS) \ 236 $(LIBDAUDITLIBS) 237 $(POST_PROCESS_SO) 238 239 $(ROOTDLIBDIR): 240 $(INS.dir) 241 242 $(ROOTDLIBDIR64): $(ROOTDLIBDIR) 243 $(INS.dir) 244 245 $(ROOTDLIBDIR)/%.d: ../common/%.d 246 $(INS.file) 247 248 $(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d 249 $(INS.file) 250 251 $(ROOTDLIBDIR)/%.d: %.d 252 $(INS.file) 253 254 $(ROOTDLIBDIR)/%.o: %.o 255 $(INS.file) 256 257 $(ROOTDLIBDIR64)/%.o: %.o 258 $(INS.file) 259 260 $(ROOTDLIBDIR)/%.so: %.so 261 $(INS.file) 262 263 $(ROOTDLIBDIR64)/%.so: %.so 264 $(INS.file) 265 266 $(ROOTDLIBS): $(ROOTDLIBDIR) 267 268 $(ROOTDOBJS): $(ROOTDLIBDIR) 269 270 $(ROOTDOBJS64): $(ROOTDLIBDIR64) 271 272 include ../../Makefile.targ