xref: /titanic_41/usr/src/cmd/lvm/metassist/Makefile.targ (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 2004 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# Rule/definitions for /etc/default
91ROOTETCDEFAULTFILES=	$(DEFAULTFILES:%=$(ROOTETCDEFAULT)/%)
92$(ROOTETCDEFAULTFILES) :=	OWNER = root
93$(ROOTETCDEFAULTFILES) :=	GROUP = sys
94$(ROOTETCDEFAULTFILES) :=	FILEMODE = 0644
95
96$(ROOTETCDEFAULT)/%: %
97	$(INS.file)
98
99# Install recursively
100install: all .WAIT \
101	${SUBDIRS} \
102	$(ROOTUSRSBINPROG) \
103	$(ROOTETCDEFAULTFILES) \
104	$(ROOTXMLDTDFILES) \
105	$(ROOTXMLSTYLEFILES)
106
107# Pattern-matching rule for lint
108%$(SUFFIX_LINT): %
109	${LINT.c} -I. ${INCLUDES} -y -c $< && touch $@
110
111# Run lint on all source files
112lint: ${SUBDIRS} $(SRCS:%=%$(SUFFIX_LINT))
113
114# Pattern-matching rule for cstyle
115# cstyle 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_CSTYLE): %
118	$(ERRIFOUTPUT_SCRIPT) ${CSTYLE} -p -P $< && touch $@
119
120# Run cstyle on all source files and headers
121cstyle: $(ERRIFOUTPUT_SCRIPT) ${SUBDIRS} $(SRCS:%=%.cstyle) $(HDRS:%=%$(SUFFIX_CSTYLE))
122
123# Pattern-matching rule for hdrchk
124# hdrchk doesn't exit with a non-zero exit code when it finds errors,
125# so run it through a wrapper script that fails if there is any output
126%$(SUFFIX_HDRCHK): %
127	$(ERRIFOUTPUT_SCRIPT) ${HDRCHK} $< && touch $@
128
129# Run hdrchk on all headers
130hdrchk: $(ERRIFOUTPUT_SCRIPT) ${SUBDIRS} $(HDRS:%=%$(SUFFIX_HDRCHK))
131
132# Pattern-matching rule for keywords
133%$(SUFFIX_KEYWORDS): %
134	keywords $< && touch $@
135
136# Run keywords on all SCCS files
137keywords: ${SUBDIRS} ${SCCSFILES:%=%$(SUFFIX_KEYWORDS)}
138
139check: cstyle lint hdrchk keywords
140
141clobber: ${SUBDIRS}
142
143clean: ${SUBDIRS}
144	-${RM} *.o *.ln *.i *~ core a.out $(CLEANFILES) \
145		*$(SUFFIX_LINT) *$(SUFFIX_CSTYLE) *$(SUFFIX_HDRCHK) *$(SUFFIX_KEYWORDS)
146
147catalog: $(POFILE)
148
149${SUBDIRS}: FRC
150	@cd $@; pwd; ${MAKE} ${TARGET}
151
152FRC:
153
154# Included for message catalog handling
155include $(SRC)/Makefile.msg.targ
156include $(METASSIST_TOPLEVEL)/../../Makefile.targ
157