xref: /illumos-gate/usr/src/cmd/sa/Makefile (revision 02b17e23cf5bf66a5ea787e066ae3d1aa49bd856)
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.
24ea76c26cSAndy Stormont# Copyright (c) 2013 Andrew Stormont.  All rights reserved.
257c478bd9Sstevel@tonic-gate#
265661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
277c478bd9Sstevel@tonic-gate
289ba7e32fSdduvallMANIFEST =	sar.xml
299ba7e32fSdduvallSVCMETHOD =	svc-sar
30a192e900Samaguire
317c478bd9Sstevel@tonic-gateinclude ../Makefile.cmd
327c478bd9Sstevel@tonic-gate
339ba7e32fSdduvallROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
347c478bd9Sstevel@tonic-gate
357014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
36*d3b5f563SJohn LevonCERRWARN +=	$(CNOWARN_UNINIT)
377014882cSRichard Lowe
385661bb76SJohn LevonSMOFF += all_func_returns
395661bb76SJohn Levon
409ba7e32fSdduvallSADC=		sadc
419ba7e32fSdduvallSAR=		sar
429ba7e32fSdduvallTIMEX=		timex
439ba7e32fSdduvallSA1=		sa1
449ba7e32fSdduvallSA2=		sa2
459ba7e32fSdduvall
469ba7e32fSdduvallsadc :=		LDLIBS += -lkstat
479ba7e32fSdduvall
489ba7e32fSdduvall# Executables produced
499ba7e32fSdduvallBINPROG=	$(TIMEX)
506e244e4dSGarrett D'AmoreSBINPROG=	$(SAR)
519ba7e32fSdduvallLIBPROG=	$(SADC)
529ba7e32fSdduvallLIBSHELL=	$(SA1) $(SA2)
539ba7e32fSdduvallINITSHELL=	$(PERF)
549ba7e32fSdduvall
559ba7e32fSdduvallPROGS=		$(BINPROG) $(SBINPROG) $(LIBPROG)
569ba7e32fSdduvallSHELLS=		$(LIBSHELL)
57d3d32e94SPeter TribbleTXTS=		README
589ba7e32fSdduvallALL=		$(PROGS) $(SHELLS)
599ba7e32fSdduvall
609ba7e32fSdduvall# Source files
619ba7e32fSdduvallSADC_OBJECTS=	$(SADC).o
629ba7e32fSdduvallsrcs=		$(TIMEX) $(SAR) $(SADC)
636e244e4dSGarrett D'AmoreSRCS=		$(srcs:%=%.c)
649ba7e32fSdduvallSHSRCS=		$(SHELLS:%=%.sh)
659ba7e32fSdduvall
669ba7e32fSdduvall# Set of target install directories
679ba7e32fSdduvallLIBSAD=		$(ROOT)/usr/lib/sa
689ba7e32fSdduvallCROND=		$(ROOT)/var/spool/cron
699ba7e32fSdduvallCRONTABSD=	$(CROND)/crontabs
709ba7e32fSdduvall
719ba7e32fSdduvall# Set of target install files
729ba7e32fSdduvallSYSCRONTAB=	$(CRONTABSD)/sys
739ba7e32fSdduvallROOTPROG=	$(BINPROG:%=$(ROOTBIN)/%)
749ba7e32fSdduvallROOTUSBINPROG=	$(SBINPROG:%=$(ROOTUSRSBIN)/%)
759ba7e32fSdduvallROOTLIBPROG=	$(LIBPROG:%=$(LIBSAD)/%)
769ba7e32fSdduvallROOTLIBSHELL=	$(LIBSHELL:%=$(LIBSAD)/%)
779ba7e32fSdduvallROOTSYMLINKS=	$(SBINPROG:%=$(ROOTBIN)/%)
789ba7e32fSdduvall
799ba7e32fSdduvall# Performance monitoring should not be enabled by default. Hence, these
80ea76c26cSAndy Stormont# entries are comments.
81ea76c26cSAndy StormontENTRY1=		'$(POUND_SIGN) 0 * * * 0-6 /usr/lib/sa/sa1'
82ea76c26cSAndy StormontENTRY2=		'$(POUND_SIGN) 20,40 8-17 * * 1-5 /usr/lib/sa/sa1'
83ea76c26cSAndy StormontENTRY3=		'$(POUND_SIGN) 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A'
849ba7e32fSdduvall
859ba7e32fSdduvallCLOBBERFILES=	$(PROGS) $(SHELLS)
869ba7e32fSdduvall
879ba7e32fSdduvall# Conditionals
889ba7e32fSdduvall$(LIBSAD)/$(SADC)	:= FILEMODE = 0555
897c478bd9Sstevel@tonic-gate
907c478bd9Sstevel@tonic-gate.KEEP_STATE:
917c478bd9Sstevel@tonic-gate
929ba7e32fSdduvallall:		$(ALL) $(TXTS)
937c478bd9Sstevel@tonic-gate
949ba7e32fSdduvall$(SADC):	$(SADC_OBJECTS)
959ba7e32fSdduvall	$(LINK.c) -o $@ $(SADC_OBJECTS) $(LDLIBS)
969ba7e32fSdduvall	$(POST_PROCESS)
977c478bd9Sstevel@tonic-gate
989ba7e32fSdduvall# The edit of SYSCRONTAB must be done unconditionally because of the
999ba7e32fSdduvall# creation of this file by a different component (Adm) and the possible
1009ba7e32fSdduvall# backdating.
1019ba7e32fSdduvallinstall:	all $(ROOTPROG) $(ROOTUSBINPROG)     \
1029ba7e32fSdduvall		$(ROOTINITSHELL)  $(ROOTLIBSHELL) $(ROOTSYMLINKS) \
1039ba7e32fSdduvall		$(ROOTMANIFEST) $(ROOTSVCMETHOD) $(ROOTLIBPROG)
1049ba7e32fSdduvall	@if [ -f $(SYSCRONTAB) ]; \
1059ba7e32fSdduvall	then \
1069ba7e32fSdduvall		if $(GREP) "sa1" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
1079ba7e32fSdduvall		else \
1089ba7e32fSdduvall			echo $(ENTRY1) >> $(SYSCRONTAB); \
1099ba7e32fSdduvall			echo $(ENTRY2) >> $(SYSCRONTAB); \
1109ba7e32fSdduvall			echo "$(SYSCRONTAB) modified"; \
1119ba7e32fSdduvall		fi; \
1129ba7e32fSdduvall		if $(GREP) "sa2" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
1139ba7e32fSdduvall		else \
1149ba7e32fSdduvall			echo $(ENTRY3) >> $(SYSCRONTAB); \
1159ba7e32fSdduvall		fi; \
1169ba7e32fSdduvall	fi
1177c478bd9Sstevel@tonic-gate
1189ba7e32fSdduvall$(LIBSAD)/%: %
1199ba7e32fSdduvall	$(INS.file)
1207c478bd9Sstevel@tonic-gate
1219ba7e32fSdduvall$(ROOTSYMLINKS):
1229ba7e32fSdduvall	-$(RM) $@; $(SYMLINK) ../sbin/`basename $@` $@
1239ba7e32fSdduvall
1249ba7e32fSdduvall$(ETCINITD)/%: %
1259ba7e32fSdduvall	$(INS.file)
1269ba7e32fSdduvall
1279ba7e32fSdduvallcheck:	$(CHKMANIFEST)
1289ba7e32fSdduvall
1299ba7e32fSdduvallclean:
130d3d32e94SPeter Tribble	$(RM) $(SADC_OBJECTS) $(PROGS) $(SHELLS)
1319ba7e32fSdduvall
1329ba7e32fSdduvalllint:	lint_SRCS
1337c478bd9Sstevel@tonic-gate
1347c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
135