xref: /titanic_41/usr/src/cmd/dtrace/test/tst/Makefile.com (revision 4445fffbbb1ea25fd0e9ea68b9380dd7a6709025)
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
27include $(SRC)/cmd/Makefile.cmd
28
29.KEEP_STATE:
30
31ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
32ROOTTST = $(ROOTOPTPKG)/tst
33SUBDIR :sh= basename `pwd`
34TSTDIR = $(ROOTTST)/$(SUBDIR)
35DSTYLE = $(ROOTOPTPKG)/bin/dstyle
36
37CSRCS :sh= find . -name SCCS -prune -o -name *.c -print | cut -b3-
38SSRCS :sh= find . -name SCCS -prune -o -name *.s -print | cut -b3-
39DSRCS :sh= find . -name SCCS -prune -o -name *.d -print | cut -b3-
40
41TSTS :sh= find . -name tst.*.d -o -name err.*.d -o \
42	-name tst.*.d.out -o -name err.*.d.out -o -name tst.*.ksh \
43	-o -name err.*.ksh -o -name tst.*.ksh.out -o -name drp.*.d \
44	-o -name get.*.pl
45
46EXES :sh= find . -name SCCS -prune -o \( -name *.exe -o -name \*.pl \) -print \
47    | cut -b3-
48EXES += $(CSRCS:%.c=%.exe)
49EXES += $(SSRCS:%.s=%.exe)
50
51ROOT_TSTS = $(TSTS:%=$(TSTDIR)/%)
52ROOT_EXES = $(EXES:%=$(TSTDIR)/%)
53
54$(ROOT_TSTS) := FILEMODE = 0444
55$(ROOT_EXES) := FILEMODE = 0555
56
57# The DTrace tests rely on "normal" behaviour from the compiler which
58# agressive optimization of small, simple, one compilation-unit programs may
59# utterly subvert.  We force the compiler to not optimize rather than engage
60# in an arms race with increasingly belligerent optimizers.
61COPTFLAG=	-xO0
62
63all: $(EXES)
64
65clean lint:
66
67clobber: FRC
68	-$(RM) $(CSRCS:%.c=%.exe) $(CSRCS:%.c=%.o)
69	-$(RM) $(SSRCS:%.s=%.exe) $(SSRCS:%.s=%.o)
70	-$(RM) $(DSRCS:%.d=%.o)
71	-$(RM) $(CLOBBERFILES)
72
73install: $(ROOT_TSTS) $(ROOT_EXES)
74
75$(ROOT_TSTS): $(TSTDIR)
76
77$(ROOT_EXES): $(TSTDIR)
78
79$(TSTDIR):
80	$(INS.dir)
81
82$(TSTDIR)/%: %
83	$(INS) -s -d -m $(DIRMODE) $(@D)
84	$(INS.file)
85
86%.exe: %.c
87	$(LINK.c) -o $@ $< $(LDLIBS)
88	$(POST_PROCESS) ; $(STRIP_STABS)
89
90%.exe: %.o
91	$(LINK.c) -o $@ $< $(LDLIBS)
92	$(POST_PROCESS) ; $(STRIP_STABS)
93
94%.o: %.c
95	$(COMPILE.c) -o $@ $<
96	$(POST_PROCESS_O)
97
98%.o: %.s
99	$(COMPILE.s) -o $@ $<
100	$(POST_PROCESS_O)
101
102scripts: FRC
103	@cd ../cmd/scripts; pwd; $(MAKE) install
104
105dstyle: FRC
106	@if [ -n "$(DSRCS)" ]; then $(DSTYLE) $(DSRCS); fi
107
108FRC:
109