xref: /titanic_51/usr/src/cmd/sa/Makefile (revision ea76c26cbb46a2abd6ae5d4bdfaa26e32a405633)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5a192e900Samaguire# Common Development and Distribution License (the "License").
6a192e900Samaguire# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2224fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
24*ea76c26cSAndy Stormont# Copyright (c) 2013 Andrew Stormont.  All rights reserved.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# cmd/sa/Makefile
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate
299ba7e32fSdduvallMANIFEST =	sar.xml
309ba7e32fSdduvallSVCMETHOD =	svc-sar
31a192e900Samaguire
327c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd
337c478bd9Sstevel@tonic-gate
349ba7e32fSdduvallROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
357c478bd9Sstevel@tonic-gate
367014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
377014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-uninitialized
387014882cSRichard Lowe
399ba7e32fSdduvallGREP=		grep
409ba7e32fSdduvall
419ba7e32fSdduvallSADC= 		sadc
429ba7e32fSdduvallSADP= 		sadp
439ba7e32fSdduvallSAR= 		sar
449ba7e32fSdduvallTIMEX=		timex
459ba7e32fSdduvallSA1=		sa1
469ba7e32fSdduvallSA2=		sa2
479ba7e32fSdduvall
489ba7e32fSdduvallsadc :=		LDLIBS += -lkstat
499ba7e32fSdduvall
509ba7e32fSdduvall# Executables produced
519ba7e32fSdduvallBINPROG=	$(TIMEX)
526e244e4dSGarrett D'AmoreSBINPROG=	$(SAR)
539ba7e32fSdduvallLIBPROG=	$(SADC)
549ba7e32fSdduvallLIBSHELL=	$(SA1) $(SA2)
559ba7e32fSdduvallINITSHELL=	$(PERF)
569ba7e32fSdduvall
579ba7e32fSdduvallPROGS=		$(BINPROG) $(SBINPROG) $(LIBPROG)
589ba7e32fSdduvallSHELLS=		$(LIBSHELL)
599ba7e32fSdduvallTXTS= 		$(SADP).c README
609ba7e32fSdduvallALL=		$(PROGS) $(SHELLS)
619ba7e32fSdduvall
629ba7e32fSdduvall# Source files
639ba7e32fSdduvallSADC_OBJECTS=	$(SADC).o
649ba7e32fSdduvallsrcs=		$(TIMEX) $(SAR) $(SADC)
656e244e4dSGarrett D'AmoreSRCS=		$(srcs:%=%.c)
669ba7e32fSdduvallSHSRCS=		$(SHELLS:%=%.sh)
679ba7e32fSdduvall
689ba7e32fSdduvall# Set of target install directories
699ba7e32fSdduvallLIBSAD=		$(ROOT)/usr/lib/sa
709ba7e32fSdduvallCROND=		$(ROOT)/var/spool/cron
719ba7e32fSdduvallCRONTABSD=	$(CROND)/crontabs
729ba7e32fSdduvall
739ba7e32fSdduvall# Set of target install files
749ba7e32fSdduvallSYSCRONTAB=	$(CRONTABSD)/sys
759ba7e32fSdduvallROOTPROG=	$(BINPROG:%=$(ROOTBIN)/%)
769ba7e32fSdduvallROOTUSBINPROG=	$(SBINPROG:%=$(ROOTUSRSBIN)/%)
779ba7e32fSdduvallROOTLIBPROG=	$(LIBPROG:%=$(LIBSAD)/%)
789ba7e32fSdduvallROOTLIBSHELL=	$(LIBSHELL:%=$(LIBSAD)/%)
799ba7e32fSdduvallROOTSYMLINKS=	$(SBINPROG:%=$(ROOTBIN)/%)
809ba7e32fSdduvall
819ba7e32fSdduvall# Performance monitoring should not be enabled by default. Hence, these
82*ea76c26cSAndy Stormont# entries are comments.
83*ea76c26cSAndy StormontENTRY1=		'$(POUND_SIGN) 0 * * * 0-6 /usr/lib/sa/sa1'
84*ea76c26cSAndy StormontENTRY2=		'$(POUND_SIGN) 20,40 8-17 * * 1-5 /usr/lib/sa/sa1'
85*ea76c26cSAndy StormontENTRY3=		'$(POUND_SIGN) 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A'
869ba7e32fSdduvall
879ba7e32fSdduvallCLOBBERFILES=	$(PROGS) $(SHELLS)
889ba7e32fSdduvall
899ba7e32fSdduvall# Conditionals
909ba7e32fSdduvall$(LIBSAD)/$(SADC) 	:= FILEMODE = 0555
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gate.KEEP_STATE:
937c478bd9Sstevel@tonic-gate
949ba7e32fSdduvallall: 		$(ALL) $(TXTS)
957c478bd9Sstevel@tonic-gate
969ba7e32fSdduvall$(SADC):	$(SADC_OBJECTS)
979ba7e32fSdduvall	$(LINK.c) -o $@ $(SADC_OBJECTS) $(LDLIBS)
989ba7e32fSdduvall	$(POST_PROCESS)
997c478bd9Sstevel@tonic-gate
1009ba7e32fSdduvall# The edit of SYSCRONTAB must be done unconditionally because of the
1019ba7e32fSdduvall# creation of this file by a different component (Adm) and the possible
1029ba7e32fSdduvall# backdating.
1039ba7e32fSdduvallinstall:	all $(ROOTPROG) $(ROOTUSBINPROG)     \
1049ba7e32fSdduvall		$(ROOTINITSHELL)  $(ROOTLIBSHELL) $(ROOTSYMLINKS) \
1059ba7e32fSdduvall		$(ROOTMANIFEST) $(ROOTSVCMETHOD) $(ROOTLIBPROG)
1069ba7e32fSdduvall	@if [ -f $(SYSCRONTAB) ]; \
1079ba7e32fSdduvall	then \
1089ba7e32fSdduvall		if $(GREP) "sa1" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
1099ba7e32fSdduvall		else \
1109ba7e32fSdduvall			echo $(ENTRY1) >> $(SYSCRONTAB); \
1119ba7e32fSdduvall			echo $(ENTRY2) >> $(SYSCRONTAB); \
1129ba7e32fSdduvall			echo "$(SYSCRONTAB) modified"; \
1139ba7e32fSdduvall		fi; \
1149ba7e32fSdduvall		if $(GREP) "sa2" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
1159ba7e32fSdduvall		else \
1169ba7e32fSdduvall			echo $(ENTRY3) >> $(SYSCRONTAB); \
1179ba7e32fSdduvall		fi; \
1189ba7e32fSdduvall	fi
1197c478bd9Sstevel@tonic-gate
1209ba7e32fSdduvall$(LIBSAD)/%: %
1219ba7e32fSdduvall	$(INS.file)
1227c478bd9Sstevel@tonic-gate
1239ba7e32fSdduvall$(ROOTSYMLINKS):
1249ba7e32fSdduvall	-$(RM) $@; $(SYMLINK) ../sbin/`basename $@` $@
1259ba7e32fSdduvall
1269ba7e32fSdduvall$(ETCINITD)/%: %
1279ba7e32fSdduvall	$(INS.file)
1289ba7e32fSdduvall
1299ba7e32fSdduvallcheck:	$(CHKMANIFEST)
1309ba7e32fSdduvall
1319ba7e32fSdduvallclean:
1326e244e4dSGarrett D'Amore	$(RM) $(SADC_OBJECTS) $(PROGS) $(SHELLS) $(SADP)
1339ba7e32fSdduvall
1349ba7e32fSdduvalllint:	lint_SRCS
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
137