xref: /titanic_41/usr/src/cmd/lvm/metassist/Makefile.targ (revision 5aefb6555731130ca4fd295960123d71f2d21fe8)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29# Wrapper script that will fail if there is any output, for commands
30# that don't exit with a non-zero exit code when they find errors
31ERRIFOUTPUT_SCRIPT = $(METASSIST_TOPLEVEL)/scripts/errifoutput
32
33# Suffixes for files that flag a particular check
34SUFFIX_LINT = .lint
35SUFFIX_CSTYLE = .cstyle
36SUFFIX_HDRCHK = .hdrchk
37SUFFIX_KEYWORDS = .keywords
38
39# Get list of (non-deleted) SCCS files
40tmp1 :sh= echo SCCS/s.*
41tmp2 = ${tmp1:SCCS/s.%=%}
42SCCSFILES = ${tmp2:.del-%=}
43
44all       := TARGET = all
45install   := TARGET = install
46clean     := TARGET = clean
47clobber   := TARGET = clobber
48catalog   := TARGET = catalog
49check     := TARGET = check
50cstyle    := TARGET = cstyle
51hdrchk    := TARGET = hdrchk
52keywords  := TARGET = keywords
53lint      := TARGET = lint
54
55.KEEP_STATE:
56
57all: ${SUBDIRS} ${OBJS} .WAIT ${PROG}
58
59# Create the binary
60$(PROG): $(OBJS) $(SUBOBJS)
61	$(LINK.c) $(OBJS) $(SUBOBJS) -o $@ $(LDLIBS)
62	$(POST_PROCESS)
63
64# Make objects in subdirectories
65$(SUBOBJS) $(POFILES):
66	@cd $(@D); ${MAKE} $(@F)
67
68ROOTXML=	$(ROOTSHLIB)/xml
69
70# Rule/definitions for DTDs
71ROOTXMLDTD=	$(ROOTXML)/dtd
72ROOTXMLDTDFILES=	$(DTDFILES:%=$(ROOTXMLDTD)/%)
73$(ROOTXMLDTDFILES) :=	OWNER = root
74$(ROOTXMLDTDFILES) :=	GROUP = sys
75$(ROOTXMLDTDFILES) :=	FILEMODE = 0444
76
77$(ROOTXMLDTD)/%: %
78	$(INS.file)
79
80# Rule/definitions for XSL style sheets
81ROOTXMLSTYLE=	$(ROOTXML)/style
82ROOTXMLSTYLEFILES=	$(STYLEFILES:%=$(ROOTXMLSTYLE)/%)
83$(ROOTXMLSTYLEFILES) :=	OWNER = root
84$(ROOTXMLSTYLEFILES) :=	GROUP = sys
85$(ROOTXMLSTYLEFILES) :=	FILEMODE = 0444
86
87$(ROOTXMLSTYLE)/%: %
88	$(INS.file)
89
90# Install recursively
91install: all .WAIT \
92	${SUBDIRS} \
93	$(ROOTUSRSBINPROG) \
94	$(ROOTETCDEFAULTFILES) \
95	$(ROOTXMLDTDFILES) \
96	$(ROOTXMLSTYLEFILES)
97
98# Pattern-matching rule for lint
99%$(SUFFIX_LINT): %
100	${LINT.c} -I. ${INCLUDES} -y -c $< && touch $@
101
102# Run lint on all source files
103lint: ${SUBDIRS} $(SRCS:%=%$(SUFFIX_LINT))
104
105# Pattern-matching rule for cstyle
106# cstyle doesn't exit with a non-zero exit code when it finds errors,
107# so run it through a wrapper script that fails if there is any output
108%$(SUFFIX_CSTYLE): %
109	$(ERRIFOUTPUT_SCRIPT) ${CSTYLE} -p -P $< && touch $@
110
111# Run cstyle on all source files and headers
112cstyle: $(ERRIFOUTPUT_SCRIPT) ${SUBDIRS} $(SRCS:%=%.cstyle) $(HDRS:%=%$(SUFFIX_CSTYLE))
113
114# Pattern-matching rule for hdrchk
115# hdrchk doesn't exit with a non-zero exit code when it finds errors,
116# so run it through a wrapper script that fails if there is any output
117%$(SUFFIX_HDRCHK): %
118	$(ERRIFOUTPUT_SCRIPT) ${HDRCHK} $< && touch $@
119
120# Run hdrchk on all headers
121hdrchk: $(ERRIFOUTPUT_SCRIPT) ${SUBDIRS} $(HDRS:%=%$(SUFFIX_HDRCHK))
122
123# Pattern-matching rule for keywords
124%$(SUFFIX_KEYWORDS): %
125	keywords $< && touch $@
126
127# Run keywords on all SCCS files
128keywords: ${SUBDIRS} ${SCCSFILES:%=%$(SUFFIX_KEYWORDS)}
129
130check: cstyle lint hdrchk keywords
131
132clobber: ${SUBDIRS}
133
134clean: ${SUBDIRS}
135	-${RM} *.o *.ln *.i *~ core a.out $(CLEANFILES) \
136		*$(SUFFIX_LINT) *$(SUFFIX_CSTYLE) *$(SUFFIX_HDRCHK) *$(SUFFIX_KEYWORDS)
137
138catalog: $(POFILE)
139
140${SUBDIRS}: FRC
141	@cd $@; pwd; ${MAKE} ${TARGET}
142
143FRC:
144
145# Included for message catalog handling
146include $(SRC)/Makefile.msg.targ
147include $(METASSIST_TOPLEVEL)/../../Makefile.targ
148