xref: /titanic_41/usr/src/lib/libdtrace/Makefile.com (revision b6805bf78d2bbbeeaea8909a05623587b42d58b3)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5f808c858Sraf# Common Development and Distribution License (the "License").
6f808c858Sraf# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
229cd928feSAlan Maguire# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
23e5803b76SAdam H. Leventhal# Copyright (c) 2012 by Delphix. All rights reserved.
247c478bd9Sstevel@tonic-gate#
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gateLIBRARY = libdtrace.a
277c478bd9Sstevel@tonic-gateVERS = .1
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gateLIBSRCS = \
307c478bd9Sstevel@tonic-gate	dt_aggregate.c \
317c478bd9Sstevel@tonic-gate	dt_as.c \
327c478bd9Sstevel@tonic-gate	dt_buf.c \
337c478bd9Sstevel@tonic-gate	dt_cc.c \
347c478bd9Sstevel@tonic-gate	dt_cg.c \
357c478bd9Sstevel@tonic-gate	dt_consume.c \
367c478bd9Sstevel@tonic-gate	dt_decl.c \
377c478bd9Sstevel@tonic-gate	dt_dis.c \
387c478bd9Sstevel@tonic-gate	dt_dof.c \
397c478bd9Sstevel@tonic-gate	dt_error.c \
407c478bd9Sstevel@tonic-gate	dt_errtags.c \
417c478bd9Sstevel@tonic-gate	dt_handle.c \
427c478bd9Sstevel@tonic-gate	dt_ident.c \
437c478bd9Sstevel@tonic-gate	dt_inttab.c \
447c478bd9Sstevel@tonic-gate	dt_link.c \
457c478bd9Sstevel@tonic-gate	dt_list.c \
467c478bd9Sstevel@tonic-gate	dt_open.c \
477c478bd9Sstevel@tonic-gate	dt_options.c \
487c478bd9Sstevel@tonic-gate	dt_program.c \
497c478bd9Sstevel@tonic-gate	dt_map.c \
507c478bd9Sstevel@tonic-gate	dt_module.c \
511a7c1b72Smws	dt_names.c \
527c478bd9Sstevel@tonic-gate	dt_parser.c \
537c478bd9Sstevel@tonic-gate	dt_pcb.c \
547c478bd9Sstevel@tonic-gate	dt_pid.c \
55e5803b76SAdam H. Leventhal	dt_pq.c \
567c478bd9Sstevel@tonic-gate	dt_pragma.c \
57deef35fdSEric Schrock	dt_print.c \
587c478bd9Sstevel@tonic-gate	dt_printf.c \
597c478bd9Sstevel@tonic-gate	dt_proc.c \
607c478bd9Sstevel@tonic-gate	dt_provider.c \
617c478bd9Sstevel@tonic-gate	dt_regset.c \
627c478bd9Sstevel@tonic-gate        dt_string.c \
637c478bd9Sstevel@tonic-gate	dt_strtab.c \
647c478bd9Sstevel@tonic-gate	dt_subr.c \
657c478bd9Sstevel@tonic-gate	dt_work.c \
667c478bd9Sstevel@tonic-gate	dt_xlator.c
677c478bd9Sstevel@tonic-gate
687c478bd9Sstevel@tonic-gateLIBISASRCS = \
697c478bd9Sstevel@tonic-gate	dt_isadep.c
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gateOBJECTS = dt_lex.o dt_grammar.o $(MACHOBJS) $(LIBSRCS:%.c=%.o) $(LIBISASRCS:%.c=%.o)
727c478bd9Sstevel@tonic-gate
73edb34883SAdam H. LeventhalDRTISRCS = dlink_init.c dlink_common.c
74edb34883SAdam H. LeventhalDRTIOBJS = $(DRTISRCS:%.c=pics/%.o)
75edb34883SAdam H. LeventhalDRTIOBJ = drti.o
76edb34883SAdam H. Leventhal
77edb34883SAdam H. LeventhalLIBDAUDITSRCS = dlink_audit.c dlink_common.c
78edb34883SAdam H. LeventhalLIBDAUDITOBJS = $(LIBDAUDITSRCS:%.c=pics/%.o)
79edb34883SAdam H. LeventhalLIBDAUDIT = libdtrace_forceload.so
80edb34883SAdam H. Leventhal
81edb34883SAdam H. LeventhalDLINKSRCS = dlink_common.c dlink_init.c dlink_audit.c
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gateDLIBSRCS += \
847c478bd9Sstevel@tonic-gate	errno.d \
855f549bd2SSam Cramer	fc.d \
867c478bd9Sstevel@tonic-gate	io.d \
874edabff4Sbrendan	ip.d \
88a668b114SPriya Krishnan	iscsit.d \
89f3b585ceSsamf	net.d \
90f3b585ceSsamf	nfs.d \
91f9e4b91fSRichard Lowe	nfssrv.d \
927c478bd9Sstevel@tonic-gate	procfs.d \
937c478bd9Sstevel@tonic-gate	regs.d \
947c478bd9Sstevel@tonic-gate	sched.d \
957c478bd9Sstevel@tonic-gate	signal.d \
965f549bd2SSam Cramer	scsi.d \
97191c289bSCharles Ting	srp.d \
98e04145d0Seschrock	sysevent.d \
999cd928feSAlan Maguire	tcp.d \
1009cd928feSAlan Maguire	udp.d \
1017c478bd9Sstevel@tonic-gate	unistd.d
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gateinclude ../../Makefile.lib
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gateSRCS = $(LIBSRCS:%.c=../common/%.c) $(LIBISASRCS:%.c=../$(MACH)/%.c)
1067c478bd9Sstevel@tonic-gateLIBS = $(DYNLIB) $(LINTLIB)
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gateSRCDIR = ../common
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gateCLEANFILES += dt_lex.c dt_grammar.c dt_grammar.h y.output
1117c478bd9Sstevel@tonic-gateCLEANFILES += ../common/procfs.sed ../common/procfs.d
1127c478bd9Sstevel@tonic-gateCLEANFILES += ../common/io.sed ../common/io.d
1134edabff4SbrendanCLEANFILES += ../common/ip.sed ../common/ip.d
11410e6dadfSbrendanCLEANFILES += ../common/net.sed ../common/net.d
1151a7c1b72SmwsCLEANFILES += ../common/errno.d ../common/signal.d
1161a7c1b72SmwsCLEANFILES += ../common/dt_errtags.c ../common/dt_names.c
117e04145d0SeschrockCLEANFILES += ../common/sysevent.sed ../common/sysevent.d
1189cd928feSAlan MaguireCLEANFILES += ../common/tcp.sed ../common/tcp.d
1199cd928feSAlan MaguireCLEANFILES += ../common/udp.sed ../common/udp.d
120*b6805bf7SGordon RossCLEANFILES += $(LIBDAUDITOBJS) $(DRTIOBJS)
1217c478bd9Sstevel@tonic-gate
122*b6805bf7SGordon RossCLOBBERFILES += $(LIBDAUDIT) drti.o
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gateCPPFLAGS += -I../common -I.
1257c478bd9Sstevel@tonic-gateCFLAGS += $(CCVERBOSE) $(C_BIGPICFLAGS)
1267c478bd9Sstevel@tonic-gateCFLAGS64 += $(CCVERBOSE) $(C_BIGPICFLAGS)
1277014882cSRichard Lowe
1287014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label
1297014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable
1307014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses
1317014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized
1327014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch
1337014882cSRichard Lowe
1347c478bd9Sstevel@tonic-gateYYCFLAGS =
135c9a6ea2eSBryan CantrillLDLIBS += -lgen -lproc -lrtld_db -lnsl -lsocket -lctf -lelf -lc
1367c478bd9Sstevel@tonic-gateDRTILDLIBS = $(LDLIBS.lib) -lc
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gateyydebug := YYCFLAGS += -DYYDEBUG
1397c478bd9Sstevel@tonic-gate
1407c478bd9Sstevel@tonic-gate$(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC)
1417c478bd9Sstevel@tonic-gate
1427c478bd9Sstevel@tonic-gateLFLAGS = -t -v
1437c478bd9Sstevel@tonic-gateYFLAGS = -d -v
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gateROOTDLIBDIR = $(ROOT)/usr/lib/dtrace
1467c478bd9Sstevel@tonic-gateROOTDLIBDIR64 = $(ROOT)/usr/lib/dtrace/64
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gateROOTDLIBS = $(DLIBSRCS:%=$(ROOTDLIBDIR)/%)
149edb34883SAdam H. LeventhalROOTDOBJS = $(ROOTDLIBDIR)/$(DRTIOBJ) $(ROOTDLIBDIR)/$(LIBDAUDIT)
150edb34883SAdam H. LeventhalROOTDOBJS64 = $(ROOTDLIBDIR64)/$(DRTIOBJ) $(ROOTDLIBDIR64)/$(LIBDAUDIT)
151edb34883SAdam H. Leventhal
152edb34883SAdam H. Leventhal$(ROOTDLIBDIR)/%.d := FILEMODE=444
153edb34883SAdam H. Leventhal$(ROOTDLIBDIR)/%.o := FILEMODE=444
154edb34883SAdam H. Leventhal$(ROOTDLIBDIR64)/%.o :=	FILEMODE=444
155edb34883SAdam H. Leventhal$(ROOTDLIBDIR)/%.so := FILEMODE=555
156edb34883SAdam H. Leventhal$(ROOTDLIBDIR64)/%.so := FILEMODE=555
1577c478bd9Sstevel@tonic-gate
1587c478bd9Sstevel@tonic-gate.KEEP_STATE:
1597c478bd9Sstevel@tonic-gate
160edb34883SAdam H. Leventhalall: $(LIBS) $(DRTIOBJ) $(LIBDAUDIT)
1617c478bd9Sstevel@tonic-gate
162edb34883SAdam H. Leventhallint: lintdlink lintcheck
1637c478bd9Sstevel@tonic-gate
164edb34883SAdam H. Leventhallintdlink: $(DLINKSRCS:%.c=../common/%.c)
165edb34883SAdam H. Leventhal	$(LINT.c) $(DLINKSRCS:%.c=../common/%.c) $(DRTILDLIBS)
1667c478bd9Sstevel@tonic-gate
1677c478bd9Sstevel@tonic-gatedt_lex.c: $(SRCDIR)/dt_lex.l dt_grammar.h
1687c478bd9Sstevel@tonic-gate	$(LEX) $(LFLAGS) $(SRCDIR)/dt_lex.l > $@
1697c478bd9Sstevel@tonic-gate
1707c478bd9Sstevel@tonic-gatedt_grammar.c dt_grammar.h: $(SRCDIR)/dt_grammar.y
1717c478bd9Sstevel@tonic-gate	$(YACC) $(YFLAGS) $(SRCDIR)/dt_grammar.y
1727c478bd9Sstevel@tonic-gate	@mv y.tab.h dt_grammar.h
1737c478bd9Sstevel@tonic-gate	@mv y.tab.c dt_grammar.c
1747c478bd9Sstevel@tonic-gate
1757c478bd9Sstevel@tonic-gatepics/dt_lex.o pics/dt_grammar.o := CFLAGS += $(YYCFLAGS)
1767c478bd9Sstevel@tonic-gatepics/dt_lex.o pics/dt_grammar.o := CFLAGS64 += $(YYCFLAGS)
1777c478bd9Sstevel@tonic-gate
1787c478bd9Sstevel@tonic-gatepics/dt_lex.o pics/dt_grammar.o := CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
1797c478bd9Sstevel@tonic-gatepics/dt_lex.o pics/dt_grammar.o := CCVERBOSE =
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate../common/dt_errtags.c: ../common/mkerrtags.sh ../common/dt_errtags.h
1827c478bd9Sstevel@tonic-gate	sh ../common/mkerrtags.sh < ../common/dt_errtags.h > $@
1837c478bd9Sstevel@tonic-gate
1841a7c1b72Smws../common/dt_names.c: ../common/mknames.sh $(SRC)/uts/common/sys/dtrace.h
1851a7c1b72Smws	sh ../common/mknames.sh < $(SRC)/uts/common/sys/dtrace.h > $@
1861a7c1b72Smws
1877c478bd9Sstevel@tonic-gate../common/errno.d: ../common/mkerrno.sh $(SRC)/uts/common/sys/errno.h
1887c478bd9Sstevel@tonic-gate	sh ../common/mkerrno.sh < $(SRC)/uts/common/sys/errno.h > $@
1897c478bd9Sstevel@tonic-gate
1907c478bd9Sstevel@tonic-gate../common/signal.d: ../common/mksignal.sh $(SRC)/uts/common/sys/iso/signal_iso.h
1917c478bd9Sstevel@tonic-gate	sh ../common/mksignal.sh < $(SRC)/uts/common/sys/iso/signal_iso.h > $@
1927c478bd9Sstevel@tonic-gate
1937c478bd9Sstevel@tonic-gate../common/%.sed: ../common/%.sed.in
194e04145d0Seschrock	$(COMPILE.cpp) -D_KERNEL $< | tr -d ' ' | tr '"' '@' | \
195e04145d0Seschrock	    sed 's/\&/\\\&/g' | grep '^s/' > $@
1967c478bd9Sstevel@tonic-gate
1977c478bd9Sstevel@tonic-gate../common/procfs.d: ../common/procfs.sed ../common/procfs.d.in
1987c478bd9Sstevel@tonic-gate	sed -f ../common/procfs.sed < ../common/procfs.d.in > $@
1997c478bd9Sstevel@tonic-gate
2007c478bd9Sstevel@tonic-gate../common/io.d: ../common/io.sed ../common/io.d.in
2017c478bd9Sstevel@tonic-gate	sed -f ../common/io.sed < ../common/io.d.in > $@
2027c478bd9Sstevel@tonic-gate
2034edabff4Sbrendan../common/ip.d: ../common/ip.sed ../common/ip.d.in
2044edabff4Sbrendan	sed -f ../common/ip.sed < ../common/ip.d.in > $@
2054edabff4Sbrendan
20610e6dadfSbrendan../common/net.d: ../common/net.sed ../common/net.d.in
20710e6dadfSbrendan	sed -f ../common/net.sed < ../common/net.d.in > $@
20810e6dadfSbrendan
209e04145d0Seschrock../common/sysevent.d: ../common/sysevent.sed ../common/sysevent.d.in
210e04145d0Seschrock	sed -f ../common/sysevent.sed < ../common/sysevent.d.in > $@
211e04145d0Seschrock
2129cd928feSAlan Maguire../common/tcp.d: ..//common/tcp.sed ../common/tcp.d.in
2139cd928feSAlan Maguire	sed -f ../common/tcp.sed < ../common/tcp.d.in > $@
2149cd928feSAlan Maguire
2159cd928feSAlan Maguire../common/udp.d: ../common/udp.sed ../common/udp.d.in
2169cd928feSAlan Maguire	sed -f ../common/udp.sed < ../common/udp.d.in > $@
2179cd928feSAlan Maguire
2187c478bd9Sstevel@tonic-gatepics/%.o: ../$(MACH)/%.c
2197c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $<
2207c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
2217c478bd9Sstevel@tonic-gate
2227c478bd9Sstevel@tonic-gatepics/%.o: ../$(MACH)/%.s
2237c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $@ $<
2247c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
2257c478bd9Sstevel@tonic-gate
226edb34883SAdam H. Leventhal$(DRTIOBJ): $(DRTIOBJS)
227edb34883SAdam H. Leventhal	$(LD) -o $@ -r -Blocal -Breduce $(DRTIOBJS)
2287c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
2297c478bd9Sstevel@tonic-gate
230edb34883SAdam H. Leventhal$(LIBDAUDIT): $(LIBDAUDITOBJS)
231edb34883SAdam H. Leventhal	$(LINK.c) -o $@ $(GSHARED) -h$(LIBDAUDIT) $(ZTEXT) $(ZDEFS) $(BDIRECT) \
232edb34883SAdam H. Leventhal	    $(MAPFILE.PGA:%=-M%) $(MAPFILE.NED:%=-M%) $(LIBDAUDITOBJS) \
233edb34883SAdam H. Leventhal	    -lmapmalloc -lc -lproc
234edb34883SAdam H. Leventhal	$(POST_PROCESS_SO)
235edb34883SAdam H. Leventhal
2367c478bd9Sstevel@tonic-gate$(ROOTDLIBDIR):
2377c478bd9Sstevel@tonic-gate	$(INS.dir)
2387c478bd9Sstevel@tonic-gate
2397c478bd9Sstevel@tonic-gate$(ROOTDLIBDIR64): $(ROOTDLIBDIR)
2407c478bd9Sstevel@tonic-gate	$(INS.dir)
2417c478bd9Sstevel@tonic-gate
2427c478bd9Sstevel@tonic-gate$(ROOTDLIBDIR)/%.d: ../common/%.d
2437c478bd9Sstevel@tonic-gate	$(INS.file)
2447c478bd9Sstevel@tonic-gate
2457c478bd9Sstevel@tonic-gate$(ROOTDLIBDIR)/%.d: ../$(MACH)/%.d
2467c478bd9Sstevel@tonic-gate	$(INS.file)
2477c478bd9Sstevel@tonic-gate
2487c478bd9Sstevel@tonic-gate$(ROOTDLIBDIR)/%.d: %.d
2497c478bd9Sstevel@tonic-gate	$(INS.file)
2507c478bd9Sstevel@tonic-gate
2517c478bd9Sstevel@tonic-gate$(ROOTDLIBDIR)/%.o: %.o
2527c478bd9Sstevel@tonic-gate	$(INS.file)
2537c478bd9Sstevel@tonic-gate
2547c478bd9Sstevel@tonic-gate$(ROOTDLIBDIR64)/%.o: %.o
2557c478bd9Sstevel@tonic-gate	$(INS.file)
2567c478bd9Sstevel@tonic-gate
257edb34883SAdam H. Leventhal$(ROOTDLIBDIR)/%.so: %.so
258edb34883SAdam H. Leventhal	$(INS.file)
259edb34883SAdam H. Leventhal
260edb34883SAdam H. Leventhal$(ROOTDLIBDIR64)/%.so: %.so
261edb34883SAdam H. Leventhal	$(INS.file)
262edb34883SAdam H. Leventhal
2637c478bd9Sstevel@tonic-gate$(ROOTDLIBS): $(ROOTDLIBDIR)
2647c478bd9Sstevel@tonic-gate
2657c478bd9Sstevel@tonic-gate$(ROOTDOBJS): $(ROOTDLIBDIR)
2667c478bd9Sstevel@tonic-gate
2677c478bd9Sstevel@tonic-gate$(ROOTDOBJS64): $(ROOTDLIBDIR64)
2687c478bd9Sstevel@tonic-gate
2697c478bd9Sstevel@tonic-gateinclude ../../Makefile.targ
270