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 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_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_pragma.c \
  56         dt_print.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 
  67 LIBISASRCS = \
  68         dt_isadep.c
  69 
  70 OBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
  71 
  72 DRTISRC = drti.c
  73 DRTIOBJ = $(DRTISRC:%.c=%.o)
  74 
  75 DLIBSRCS += \
  76         dccp.d \
  77         errno.d \
  78         fc.d \
  79         io.d \
  80         ip.d \
  81         iscsit.d \
  82         net.d \
  83         nfs.d \
  84         nfssrv.d \
  85         procfs.d \
  86         regs.d \
  87         sched.d \
  88         signal.d \
  89         scsi.d \
  90         srp.d \
  91         sysevent.d \
  92         tcp.d \
  93         udp.d \
  94         unistd.d
  95 
  96 include ../../Makefile.lib
  97 
  98 SRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c) 
  99 LIBS = $(DYNLIB) $(LINTLIB)
 100 
 101 SRCDIR = ../common
 102 
 103 CLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
 104 CLEANFILES += ../common/procfs.sed ../common/procfs.d
 105 CLEANFILES += ../common/io.sed ../common/io.d
 106 CLEANFILES += ../common/ip.sed ../common/ip.d
 107 CLEANFILES += ../common/net.sed ../common/net.d
 108 CLEANFILES += ../common/errno.d ../common/signal.d
 109 CLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
 110 CLEANFILES += ../common/sysevent.sed ../common/sysevent.d
 111 CLEANFILES += ../common/tcp.sed ../common/tcp.d
 112 CLEANFILES += ../common/udp.sed ../common/udp.d
 113 CLEANFILES += ../common/dccp.sed ../common/dccp.d
 114 
 115 CLOBBERFILES += drti.o
 116 
 117 CPPFLAGS += -I../common -I.
 118 CFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
 119 CFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
 120 YYCFLAGS =
 121 LDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc
 122 DRTILDLIBS = $(LDLIBS.lib) -lc
 123 
 124 yydebug := YYCFLAGS += -DYYDEBUG
 125 
 126 $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
 127 
 128 LFLAGS = -t -v
 129 YFLAGS = -d -v
 130 
 131 ROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
 132 ROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
 133 
 134 ROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
 135 ROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ)
 136 ROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ)
 137 
 138 .KEEP_STATE:
 139 
 140 all: $(LIBS) $(DRTIOBJ)
 141 
 142 lint: lintdrti lintcheck
 143 
 144 lintdrti: ../common/$(DRTISRC)
 145         $(LINT.c) ../common/$(DRTISRC) $(DRTILDLIBS)
 146 
 147 dt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
 148         $(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
 149 
 150 dt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
 151         $(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
 152         @mv y.tab.h dt_grammar.h
 153         @mv y.tab.c dt_grammar.c
 154 
 155 pics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
 156 pics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
 157 
 158 pics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
 159 pics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
 160 
 161 ../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
 162         sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
 163 
 164 ../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
 165         sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
 166 
 167 ../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
 168         sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
 169 
 170 ../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
 171         sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
 172 
 173 ../common/%.sed: ../common/%.sed.in
 174         $(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
 175             sed 's/\&/\\\&/g' | grep '^s/' > $@
 176 
 177 ../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
 178         sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
 179 
 180 ../common/io.d: ../common/io.sed ../common/io.d.in
 181         sed -f ../common/io.sed < ../common/io.d.in > $@
 182 
 183 ../common/ip.d: ../common/ip.sed ../common/ip.d.in
 184         sed -f ../common/ip.sed < ../common/ip.d.in > $@
 185 
 186 ../common/net.d: ../common/net.sed ../common/net.d.in
 187         sed -f ../common/net.sed < ../common/net.d.in > $@
 188 
 189 ../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
 190         sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
 191 
 192 ../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in
 193         sed -f ../common/tcp.sed < ../common/tcp.d.in > $@
 194 
 195 ../common/udp.d: ../common/udp.sed ../common/udp.d.in
 196         sed -f ../common/udp.sed < ../common/udp.d.in > $@
 197 
 198 ../common/dccp.d: ../common/dccp.sed ../common/dccp.d.in
 199         sed -f ../common/dccp.sed < ../common/dccp.d.in > $@
 200 
 201 pics/%.o: ../$(MACH)/%.c
 202         $(COMPILE.c) -o $@ $<
 203         $(POST_PROCESS_O)
 204 
 205 pics/%.o: ../$(MACH)/%.s
 206         $(COMPILE.s) -o $@ $<
 207         $(POST_PROCESS_O)
 208 
 209 %.o: ../common/%.c
 210         $(COMPILE.c) -o $@ $<
 211         $(POST_PROCESS_O)
 212 
 213 $(ROOTDLIBDIR):
 214         $(INS.dir)
 215 
 216 $(ROOTDLIBDIR64): $(ROOTDLIBDIR)
 217         $(INS.dir)
 218 
 219 $(ROOTDLIBDIR)/%.d: ../common/%.d
 220         $(INS.file)
 221 
 222 $(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
 223         $(INS.file)
 224 
 225 $(ROOTDLIBDIR)/%.d: %.d
 226         $(INS.file)
 227 
 228 $(ROOTDLIBDIR)/%.o: %.o
 229         $(INS.file)
 230 
 231 $(ROOTDLIBDIR64)/%.o: %.o
 232         $(INS.file)
 233 
 234 $(ROOTDLIBS): $(ROOTDLIBDIR)
 235 
 236 $(ROOTDOBJS): $(ROOTDLIBDIR)
 237 
 238 $(ROOTDOBJS64): $(ROOTDLIBDIR64)
 239 
 240 include ../../Makefile.targ