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 2007 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
47EXES :sh= find . -name SCCS -prune -o -name *.exe -print | 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
57all: $(EXES)
58
59clean lint:
60
61clobber: FRC
62	-$(RM) $(CSRCS:%.c=%.exe) $(CSRCS:%.c=%.o)
63	-$(RM) $(SSRCS:%.s=%.exe) $(SSRCS:%.s=%.o)
64	-$(RM) $(DSRCS:%.d=%.o)
65
66install: $(ROOT_TSTS) $(ROOT_EXES)
67
68$(ROOT_TSTS): $(TSTDIR)
69
70$(ROOT_EXES): $(TSTDIR)
71
72$(TSTDIR):
73	$(INS.dir)
74
75$(TSTDIR)/%: %
76	$(INS) -s -d -m $(DIRMODE) $(@D)
77	$(INS.file)
78
79%.exe: %.c
80	$(LINK.c) -o $@ $< $(LDLIBS)
81	$(POST_PROCESS) ; $(STRIP_STABS)
82
83%.exe: %.o
84	$(LINK.c) -o $@ $< $(LDLIBS)
85	$(POST_PROCESS) ; $(STRIP_STABS)
86
87%.o: %.c
88	$(COMPILE.c) -o $@ $<
89	$(POST_PROCESS_O)
90
91%.o: %.s
92	$(COMPILE.s) -o $@ $<
93	$(POST_PROCESS_O)
94
95scripts: FRC
96	@cd ../cmd/scripts; pwd; $(MAKE) install
97
98dstyle: FRC
99	@$(DSTYLE) $(DSRCS)
100
101FRC:
102