Makefile.com   [plain text]


#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident	"@(#)Makefile.com	1.1	06/08/28 SMI"

include $(SRC)/Makefile.master

.KEEP_STATE:

ROOTOPTPKG = $(ROOT)/opt/SUNWdtrt
ROOTTST = $(ROOTOPTPKG)/tst
SUBDIR :sh= basename `pwd`
TSTDIR = $(ROOTTST)/$(SUBDIR)
DSTYLE = $(ROOTOPTPKG)/bin/dstyle

CSRCS :sh= find . -name SCCS -prune -o -name *.c -print | cut -b3-
SSRCS :sh= find . -name SCCS -prune -o -name *.s -print | cut -b3-
DSRCS :sh= find . -name SCCS -prune -o -name *.d -print | cut -b3-

TSTS :sh= find . -name tst.*.d -o -name err.*.d -o \
	-name tst.*.d.out -o -name err.*.d.out -o -name tst.*.ksh \
	-o -name err.*.ksh -o -name tst.*.ksh.out -o -name drp.*.d

EXES :sh= find . -name SCCS -prune -o -name *.exe -print | cut -b3-
EXES += $(CSRCS:%.c=%.exe)
EXES += $(SSRCS:%.s=%.exe)

ROOT_TSTS = $(TSTS:%=$(TSTDIR)/%)
ROOT_EXES = $(EXES:%=$(TSTDIR)/%)

$(ROOT_TSTS) := FILEMODE = 0444
$(ROOT_EXES) := FILEMODE = 0555

all: $(EXES)

clean lint:

clobber: FRC
	rm -f $(CSRCS:%.c=%.exe) $(CSRCS:%.c=%.o)
	rm -f $(SSRCS:%.s=%.exe) $(SSRCS:%.s=%.o)
	rm -f $(DSRC:%.d=%.o)

install: $(ROOT_TSTS) $(ROOT_EXES)

$(ROOT_TSTS): $(TSTDIR)

$(ROOT_EXES): $(TSTDIR)

$(TSTDIR):
	$(INS.dir)

$(TSTDIR)/%: %
	$(INS) -s -d -m $(DIRMODE) $(@D)
	$(INS.file)

%.exe: %.c
	$(LINK.c) -o $@ $< $(LIBS)

%.exe: %.o
	$(CC) -o $@ $< $(LIBS)

%.o: %.c
	$(COMPILE.c) -o $@ $< $(LIBS)

%.o: %.s
	$(AS) $(ASFLAGS) -o $@ $< $(LIBS)

scripts: FRC
	@cd ../cmd/scripts; pwd; $(MAKE) install

dstyle: FRC
	@$(DSTYLE) $(DSRCS)

FRC: