xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/common/Makefile (revision 8b184c19c5f61fa8890900f7bab686bf19b543d3)
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#
23# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26
27#
28# Copyright (c) 2012 by Delphix. All rights reserved.
29# Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
30# Copyright 2018 Joyent, Inc.
31# Copyright 2022 Oxide Computer Company
32#
33
34#
35# WARNING: Do not include Makefile.ctf here. That will cause tests to
36# break.
37#
38
39include $(SRC)/Makefile.master
40include ../Makefile.com
41
42SNOOPDIR = $(SRC)/cmd/cmd-inet/usr.sbin/snoop
43SNOOPOBJS = nfs4_xdr.o
44SNOOPSRCS = ${SNOOPOBJS:%.o=%.c}
45CLOBBERFILES += nfs/$(SNOOPOBJS)
46
47RPCSVCDIR = $(SRC)/head/rpcsvc
48RPCSVCOBJS = nfs_prot.o
49RPCSVCSRCS = ${RPCSVCOBJS:%o=%c}
50CLOBBERFILES += nfs/$(RPCSVCOBJS) $(RPCSVCDIR)/$(RPCSVCSRCS)
51CLOBBERFILES += usdt/forker.h usdt/lazyprobe.h
52
53fasttrap/tst.fasttrap.exe := LDLIBS += -ldtrace
54fasttrap/tst.stack.exe := LDLIBS += -ldtrace
55
56ip/msnc.exe := LDLIBS += -lsocket
57
58sysevent/tst.post.exe := LDLIBS += -lsysevent
59sysevent/tst.post_chan.exe := LDLIBS += -lsysevent
60
61ustack/tst.bigstack.exe := COPTFLAG += -xO1
62
63CSTD = $(CSTD_GNU99)
64
65nfs/%.o: $(SNOOPDIR)/%.c
66	$(COMPILE.c) -o $@ $< -I$(SNOOPDIR)
67	$(POST_PROCESS_O)
68nfs/tst.call.exe: nfs/tst.call.o nfs/$(SNOOPOBJS)
69	$(LINK.c) -o $@ nfs/tst.call.o nfs/$(SNOOPOBJS) $(LDLIBS) -lnsl
70	$(POST_PROCESS) ; $(STRIP_STABS)
71$(RPCSVCDIR)/%.c: $(RPCSVCDIR)/%.x
72	$(RPCGEN) -Cc $< > $@
73nfs/$(RPCSVCOBJS): $(RPCSVCDIR)/$(RPCSVCSRCS)
74	$(COMPILE.c) -o $@ $(RPCSVCDIR)/$(RPCSVCSRCS)
75	$(POST_PROCESS_O)
76nfs/tst.call3.exe: nfs/tst.call3.o nfs/$(RPCSVCOBJS)
77	$(LINK.c) -o $@ nfs/tst.call3.o nfs/$(RPCSVCOBJS) \
78	$(LDLIBS) -lnsl -lrpcsvc
79	$(POST_PROCESS) ; $(STRIP_STABS)
80
81json/tst.usdt.o: json/usdt.h
82
83json/usdt.h: json/usdt.d
84	$(DTRACE) -h -s json/usdt.d -o json/usdt.h
85
86CLOBBERFILES +=	json/usdt.h
87
88json/usdt.o: json/usdt.d json/tst.usdt.o
89	$(COMPILE.d) -o json/usdt.o -s json/usdt.d json/tst.usdt.o
90
91json/tst.usdt.exe: json/tst.usdt.o json/usdt.o
92	$(LINK.c) -o json/tst.usdt.exe json/tst.usdt.o json/usdt.o $(LDLIBS)
93	$(POST_PROCESS) ; $(STRIP_STABS)
94
95#
96# Tests that use the next programs rely on the binaries having valid CTF
97# data.
98#
99bitfields/tst.bitfields.exe: bitfields/tst.bitfields.c
100	$(COMPILE.c) $(CTF_FLAGS) -o bitfields/tst.bitfields.o bitfields/tst.bitfields.c
101	$(CTFCONVERT) -i -L VERSION bitfields/tst.bitfields.o
102	$(LINK.c) -o bitfields/tst.bitfields.exe bitfields/tst.bitfields.o $(LDLIBS)
103	$(CTFMERGE) -L VERSION -o $@ bitfields/tst.bitfields.o
104	$(POST_PROCESS) ; $(STRIP_STABS)
105
106offsetof/tst.anon.exe: offsetof/tst.anon.c
107	$(COMPILE.c) $(CTF_FLAGS) -o offsetof/tst.anon.o offsetof/tst.anon.c
108	$(CTFCONVERT) -i -L VERSION offsetof/tst.anon.o
109	$(LINK.c) -o offsetof/tst.anon.exe offsetof/tst.anon.o $(LDLIBS)
110	$(CTFMERGE) -L VERSION -o $@ offsetof/tst.anon.o
111	$(POST_PROCESS) ; $(STRIP_STABS)
112
113print/tst.anon.exe: print/tst.anon.c
114	$(COMPILE.c) $(CTF_FLAGS) -o print/tst.anon.o print/tst.anon.c
115	$(CTFCONVERT) -i -L VERSION print/tst.anon.o
116	$(LINK.c) -o print/tst.anon.exe print/tst.anon.o $(LDLIBS)
117	$(CTFMERGE) -L VERSION -o $@ print/tst.anon.o
118	$(POST_PROCESS) ; $(STRIP_STABS)
119
120uctf/tst.aouttype.exe: uctf/tst.aouttype.c
121	$(COMPILE.c) $(CTF_FLAGS) -o uctf/tst.aouttype.o uctf/tst.aouttype.c
122	$(CTFCONVERT) -i -L VERSION uctf/tst.aouttype.o
123	$(LINK.c) -o uctf/tst.aouttype.exe uctf/tst.aouttype.o $(LDLIBS)
124	$(CTFMERGE) -L VERSION -o $@ uctf/tst.aouttype.o
125	$(POST_PROCESS) ; $(STRIP_STABS)
126
127uctf/tst.chasestrings.exe: uctf/tst.chasestrings.c
128	$(COMPILE.c) $(CTF_FLAGS) -o uctf/tst.chasestrings.o uctf/tst.chasestrings.c
129	$(CTFCONVERT) -i -L VERSION uctf/tst.chasestrings.o
130	$(LINK.c) -o uctf/tst.chasestrings.exe uctf/tst.chasestrings.o $(LDLIBS)
131	$(CTFMERGE) -L VERSION -o $@ uctf/tst.chasestrings.o
132	$(POST_PROCESS) ; $(STRIP_STABS)
133
134uctf/tst.printtype.exe: uctf/tst.printtype.c
135	$(COMPILE.c) $(CTF_FLAGS) -o uctf/tst.printtype.o uctf/tst.printtype.c
136	$(CTFCONVERT) -i -L VERSION uctf/tst.printtype.o
137	$(LINK.c) -o uctf/tst.printtype.exe uctf/tst.printtype.o $(LDLIBS)
138	$(CTFMERGE) -L VERSION -o $@ uctf/tst.printtype.o
139	$(POST_PROCESS) ; $(STRIP_STABS)
140
141#
142# This program should never have any ctf data in it.
143#
144uctf/tst.libtype.exe:
145	$(LINK.c) -o uctf/tst.libtype.exe uctf/tst.libtype.c $(LDLIBS)
146	$(POST_PROCESS) ; $(STRIP_STABS)
147
148usdt/tst.args.exe: usdt/tst.args.o usdt/args.o
149	$(LINK.c) -o usdt/tst.args.exe usdt/tst.args.o usdt/args.o $(LDLIBS)
150	$(POST_PROCESS) ; $(STRIP_STABS)
151
152usdt/args.o: usdt/args.d usdt/tst.args.o
153	$(COMPILE.d) -o usdt/args.o -s usdt/args.d usdt/tst.args.o
154
155usdt/tst.argmap.exe: usdt/tst.argmap.o usdt/argmap.o
156	$(LINK.c) -o usdt/tst.argmap.exe \
157	    usdt/tst.argmap.o usdt/argmap.o $(LDLIBS)
158	$(POST_PROCESS) ; $(STRIP_STABS)
159
160usdt/argmap.o: usdt/argmap.d usdt/tst.argmap.o
161	$(COMPILE.d) -o usdt/argmap.o -s usdt/argmap.d usdt/tst.argmap.o
162
163usdt/tst.forker.exe: usdt/tst.forker.o usdt/forker.o
164	$(LINK.c) -o usdt/tst.forker.exe \
165	    usdt/tst.forker.o usdt/forker.o $(LDLIBS)
166	$(POST_PROCESS) ; $(STRIP_STABS)
167
168usdt/forker.o: usdt/forker.d usdt/tst.forker.o
169	$(COMPILE.d) -o usdt/forker.o -s usdt/forker.d usdt/tst.forker.o
170
171usdt/tst.forker.o: usdt/forker.h
172
173usdt/forker.h: usdt/forker.d
174	$(DTRACE) -h -s usdt/forker.d -o usdt/forker.h
175
176usdt/tst.lazyprobe.exe: usdt/tst.lazyprobe.o usdt/lazyprobe.o
177	$(LINK.c) -o usdt/tst.lazyprobe.exe \
178	    usdt/tst.lazyprobe.o usdt/lazyprobe.o $(LDLIBS)
179	$(POST_PROCESS) ; $(STRIP_STABS)
180
181usdt/lazyprobe.o: usdt/lazyprobe.d usdt/tst.lazyprobe.o
182	$(COMPILE.d) -xlazyload -o usdt/lazyprobe.o \
183	    -s usdt/lazyprobe.d usdt/tst.lazyprobe.o
184
185usdt/tst.lazyprobe.o: usdt/lazyprobe.h
186
187usdt/lazyprobe.h: usdt/lazyprobe.d
188	$(DTRACE) -h -s usdt/lazyprobe.d -o usdt/lazyprobe.h
189
190SUBDIRS = java_api
191include ../../Makefile.subdirs
192