Makefile.targ revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (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 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
# Wrapper script that will fail if there is any output, for commands
# that don't exit with a non-zero exit code when they find errors
ERRIFOUTPUT_SCRIPT = $(METASSIST_TOPLEVEL)/scripts/errifoutput
# Suffixes for files that flag a particular check
SUFFIX_LINT = .lint
SUFFIX_CSTYLE = .cstyle
SUFFIX_HDRCHK = .hdrchk
SUFFIX_KEYWORDS = .keywords
# Get list of (non-deleted) SCCS files
tmp1 :sh= echo SCCS/s.*
tmp2 = ${tmp1:SCCS/s.%=%}
SCCSFILES = ${tmp2:.del-%=}
all := TARGET = all
install := TARGET = install
clean := TARGET = clean
clobber := TARGET = clobber
catalog := TARGET = catalog
check := TARGET = check
cstyle := TARGET = cstyle
hdrchk := TARGET = hdrchk
keywords := TARGET = keywords
lint := TARGET = lint
.KEEP_STATE:
all: ${SUBDIRS} ${OBJS} .WAIT ${PROG}
# Create the binary
$(PROG): $(OBJS) $(SUBOBJS)
$(LINK.c) $(OBJS) $(SUBOBJS) -o $@ $(LDLIBS)
$(POST_PROCESS)
# Make objects in subdirectories
$(SUBOBJS) $(POFILES):
@cd $(@D); ${MAKE} $(@F)
ROOTXML= $(ROOTSHLIB)/xml
# Rule/definitions for DTDs
ROOTXMLDTD= $(ROOTXML)/dtd
ROOTXMLDTDFILES= $(DTDFILES:%=$(ROOTXMLDTD)/%)
$(ROOTXMLDTDFILES) := OWNER = root
$(ROOTXMLDTDFILES) := GROUP = sys
$(ROOTXMLDTDFILES) := FILEMODE = 0444
$(ROOTXMLDTD)/%: %
$(INS.file)
# Rule/definitions for XSL style sheets
ROOTXMLSTYLE= $(ROOTXML)/style
ROOTXMLSTYLEFILES= $(STYLEFILES:%=$(ROOTXMLSTYLE)/%)
$(ROOTXMLSTYLEFILES) := OWNER = root
$(ROOTXMLSTYLEFILES) := GROUP = sys
$(ROOTXMLSTYLEFILES) := FILEMODE = 0444
$(ROOTXMLSTYLE)/%: %
$(INS.file)
# Rule/definitions for /etc/default
ROOTETCDEFAULTFILES= $(DEFAULTFILES:%=$(ROOTETCDEFAULT)/%)
$(ROOTETCDEFAULTFILES) := OWNER = root
$(ROOTETCDEFAULTFILES) := GROUP = sys
$(ROOTETCDEFAULTFILES) := FILEMODE = 0644
$(ROOTETCDEFAULT)/%: %
$(INS.file)
# Install recursively
install: all .WAIT \
${SUBDIRS} \
$(ROOTUSRSBINPROG) \
$(ROOTETCDEFAULTFILES) \
$(ROOTXMLDTDFILES) \
$(ROOTXMLSTYLEFILES)
# Pattern-matching rule for lint
%$(SUFFIX_LINT): %
${LINT.c} -I. ${INCLUDES} -y -c $< && touch $@
# Run lint on all source files
lint: ${SUBDIRS} $(SRCS:%=%$(SUFFIX_LINT))
# Pattern-matching rule for cstyle
# cstyle doesn't exit with a non-zero exit code when it finds errors,
# so run it through a wrapper script that fails if there is any output
%$(SUFFIX_CSTYLE): %
$(ERRIFOUTPUT_SCRIPT) ${CSTYLE} -p -P $< && touch $@
# Run cstyle on all source files and headers
cstyle: $(ERRIFOUTPUT_SCRIPT) ${SUBDIRS} $(SRCS:%=%.cstyle) $(HDRS:%=%$(SUFFIX_CSTYLE))
# Pattern-matching rule for hdrchk
# hdrchk doesn't exit with a non-zero exit code when it finds errors,
# so run it through a wrapper script that fails if there is any output
%$(SUFFIX_HDRCHK): %
$(ERRIFOUTPUT_SCRIPT) ${HDRCHK} $< && touch $@
# Run hdrchk on all headers
hdrchk: $(ERRIFOUTPUT_SCRIPT) ${SUBDIRS} $(HDRS:%=%$(SUFFIX_HDRCHK))
# Pattern-matching rule for keywords
%$(SUFFIX_KEYWORDS): %
keywords $< && touch $@
# Run keywords on all SCCS files
keywords: ${SUBDIRS} ${SCCSFILES:%=%$(SUFFIX_KEYWORDS)}
check: cstyle lint hdrchk keywords
clobber: ${SUBDIRS}
clean: ${SUBDIRS}
-${RM} *.o *.ln *.i *~ core a.out $(CLEANFILES) \
*$(SUFFIX_LINT) *$(SUFFIX_CSTYLE) *$(SUFFIX_HDRCHK) *$(SUFFIX_KEYWORDS)
catalog: $(POFILE)
${SUBDIRS}: FRC
@cd $@; pwd; ${MAKE} ${TARGET}
FRC:
# Included for message catalog handling
include $(SRC)/Makefile.msg.targ
include $(METASSIST_TOPLEVEL)/../../Makefile.targ