xref: /titanic_51/usr/src/cmd/dtrace/test/tst/Makefile.com (revision b6917abefc343244b784f0cc34bc65b01469c3bf)
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# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29include $(SRC)/cmd/Makefile.cmd
30
31.KEEP_STATE:
32
33ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
34ROOTTST = $(ROOTOPTPKG)/tst
35SUBDIR :sh= basename `pwd`
36TSTDIR = $(ROOTTST)/$(SUBDIR)
37DSTYLE = $(ROOTOPTPKG)/bin/dstyle
38
39CSRCS :sh= find . -name SCCS -prune -o -name *.c -print | cut -b3-
40SSRCS :sh= find . -name SCCS -prune -o -name *.s -print | cut -b3-
41DSRCS :sh= find . -name SCCS -prune -o -name *.d -print | cut -b3-
42
43TSTS :sh= find . -name tst.*.d -o -name err.*.d -o \
44	-name tst.*.d.out -o -name err.*.d.out -o -name tst.*.ksh \
45	-o -name err.*.ksh -o -name tst.*.ksh.out -o -name drp.*.d \
46	-o -name get.*.pl
47
48EXES :sh= find . -name SCCS -prune -o \( -name *.exe -o -name \*.pl \) -print \
49    | cut -b3-
50EXES += $(CSRCS:%.c=%.exe)
51EXES += $(SSRCS:%.s=%.exe)
52
53ROOT_TSTS = $(TSTS:%=$(TSTDIR)/%)
54ROOT_EXES = $(EXES:%=$(TSTDIR)/%)
55
56$(ROOT_TSTS) := FILEMODE = 0444
57$(ROOT_EXES) := FILEMODE = 0555
58
59all: $(EXES)
60
61clean lint:
62
63clobber: FRC
64	-$(RM) $(CSRCS:%.c=%.exe) $(CSRCS:%.c=%.o)
65	-$(RM) $(SSRCS:%.s=%.exe) $(SSRCS:%.s=%.o)
66	-$(RM) $(DSRCS:%.d=%.o)
67	-$(RM) $(CLOBBERFILES)
68
69install: $(ROOT_TSTS) $(ROOT_EXES)
70
71$(ROOT_TSTS): $(TSTDIR)
72
73$(ROOT_EXES): $(TSTDIR)
74
75$(TSTDIR):
76	$(INS.dir)
77
78$(TSTDIR)/%: %
79	$(INS) -s -d -m $(DIRMODE) $(@D)
80	$(INS.file)
81
82%.exe: %.c
83	$(LINK.c) -o $@ $< $(LDLIBS)
84	$(POST_PROCESS) ; $(STRIP_STABS)
85
86%.exe: %.o
87	$(LINK.c) -o $@ $< $(LDLIBS)
88	$(POST_PROCESS) ; $(STRIP_STABS)
89
90%.o: %.c
91	$(COMPILE.c) -o $@ $<
92	$(POST_PROCESS_O)
93
94%.o: %.s
95	$(COMPILE.s) -o $@ $<
96	$(POST_PROCESS_O)
97
98scripts: FRC
99	@cd ../cmd/scripts; pwd; $(MAKE) install
100
101dstyle: FRC
102	@if [ -n "$(DSRCS)" ]; then $(DSTYLE) $(DSRCS); fi
103
104FRC:
105