xref: /titanic_41/usr/src/cmd/sa/Makefile (revision 4f4499478f0aa55fc93bcd8030ba3d128663ae70)
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# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24# Copyright (c) 2013 Andrew Stormont.  All rights reserved.
25#
26# cmd/sa/Makefile
27#
28
29MANIFEST =	sar.xml
30SVCMETHOD =	svc-sar
31
32include ../Makefile.cmd
33
34ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
35
36CERRWARN +=	-_gcc=-Wno-parentheses
37CERRWARN +=	-_gcc=-Wno-uninitialized
38
39GREP=		grep
40
41SADC= 		sadc
42SADP= 		sadp
43SAR= 		sar
44TIMEX=		timex
45SA1=		sa1
46SA2=		sa2
47
48sadc :=		LDLIBS += -lkstat
49
50# Executables produced
51BINPROG=	$(TIMEX)
52SBINPROG=	$(SAR)
53LIBPROG=	$(SADC)
54LIBSHELL=	$(SA1) $(SA2)
55INITSHELL=	$(PERF)
56
57PROGS=		$(BINPROG) $(SBINPROG) $(LIBPROG)
58SHELLS=		$(LIBSHELL)
59TXTS= 		$(SADP).c README
60ALL=		$(PROGS) $(SHELLS)
61
62# Source files
63SADC_OBJECTS=	$(SADC).o
64srcs=		$(TIMEX) $(SAR) $(SADC)
65SRCS=		$(srcs:%=%.c)
66SHSRCS=		$(SHELLS:%=%.sh)
67
68# Set of target install directories
69LIBSAD=		$(ROOT)/usr/lib/sa
70CROND=		$(ROOT)/var/spool/cron
71CRONTABSD=	$(CROND)/crontabs
72
73# Set of target install files
74SYSCRONTAB=	$(CRONTABSD)/sys
75ROOTPROG=	$(BINPROG:%=$(ROOTBIN)/%)
76ROOTUSBINPROG=	$(SBINPROG:%=$(ROOTUSRSBIN)/%)
77ROOTLIBPROG=	$(LIBPROG:%=$(LIBSAD)/%)
78ROOTLIBSHELL=	$(LIBSHELL:%=$(LIBSAD)/%)
79ROOTSYMLINKS=	$(SBINPROG:%=$(ROOTBIN)/%)
80
81# Performance monitoring should not be enabled by default. Hence, these
82# entries are comments.
83ENTRY1=		'$(POUND_SIGN) 0 * * * 0-6 /usr/lib/sa/sa1'
84ENTRY2=		'$(POUND_SIGN) 20,40 8-17 * * 1-5 /usr/lib/sa/sa1'
85ENTRY3=		'$(POUND_SIGN) 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A'
86
87CLOBBERFILES=	$(PROGS) $(SHELLS)
88
89# Conditionals
90$(LIBSAD)/$(SADC) 	:= FILEMODE = 0555
91
92.KEEP_STATE:
93
94all: 		$(ALL) $(TXTS)
95
96$(SADC):	$(SADC_OBJECTS)
97	$(LINK.c) -o $@ $(SADC_OBJECTS) $(LDLIBS)
98	$(POST_PROCESS)
99
100# The edit of SYSCRONTAB must be done unconditionally because of the
101# creation of this file by a different component (Adm) and the possible
102# backdating.
103install:	all $(ROOTPROG) $(ROOTUSBINPROG)     \
104		$(ROOTINITSHELL)  $(ROOTLIBSHELL) $(ROOTSYMLINKS) \
105		$(ROOTMANIFEST) $(ROOTSVCMETHOD) $(ROOTLIBPROG)
106	@if [ -f $(SYSCRONTAB) ]; \
107	then \
108		if $(GREP) "sa1" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
109		else \
110			echo $(ENTRY1) >> $(SYSCRONTAB); \
111			echo $(ENTRY2) >> $(SYSCRONTAB); \
112			echo "$(SYSCRONTAB) modified"; \
113		fi; \
114		if $(GREP) "sa2" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
115		else \
116			echo $(ENTRY3) >> $(SYSCRONTAB); \
117		fi; \
118	fi
119
120$(LIBSAD)/%: %
121	$(INS.file)
122
123$(ROOTSYMLINKS):
124	-$(RM) $@; $(SYMLINK) ../sbin/`basename $@` $@
125
126$(ETCINITD)/%: %
127	$(INS.file)
128
129check:	$(CHKMANIFEST)
130
131clean:
132	$(RM) $(SADC_OBJECTS) $(PROGS) $(SHELLS) $(SADP)
133
134lint:	lint_SRCS
135
136include ../Makefile.targ
137