dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sa / Makefile
blobba7849cd166930e12e9f693783064716bf7a1b1e
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
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.
26 # cmd/sa/Makefile
29 MANIFEST = sar.xml
30 SVCMETHOD = svc-sar
32 include ../Makefile.cmd
34 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
36 CERRWARN += -Wno-parentheses
37 CERRWARN += -Wno-uninitialized
39 GREP= grep
41 SADC= sadc
42 SAR= sar
43 TIMEX= timex
44 SA1= sa1
45 SA2= sa2
47 sadc := LDLIBS += -lkstat
49 # Executables produced
50 BINPROG= $(TIMEX)
51 SBINPROG= $(SAR)
52 LIBPROG= $(SADC)
53 LIBSHELL= $(SA1) $(SA2)
54 INITSHELL= $(PERF)
56 PROGS= $(BINPROG) $(SBINPROG) $(LIBPROG)
57 SHELLS= $(LIBSHELL)
58 TXTS= README
59 ALL= $(PROGS) $(SHELLS)
61 # Source files
62 SADC_OBJECTS= $(SADC).o
63 srcs= $(TIMEX) $(SAR) $(SADC)
64 SRCS= $(srcs:%=%.c)
65 SHSRCS= $(SHELLS:%=%.sh)
67 # Set of target install directories
68 LIBSAD= $(ROOT)/usr/lib/sa
69 CROND= $(ROOT)/var/spool/cron
70 CRONTABSD= $(CROND)/crontabs
72 # Set of target install files
73 SYSCRONTAB= $(CRONTABSD)/sys
74 ROOTPROG= $(BINPROG:%=$(ROOTBIN)/%)
75 ROOTUSBINPROG= $(SBINPROG:%=$(ROOTUSRSBIN)/%)
76 ROOTLIBPROG= $(LIBPROG:%=$(LIBSAD)/%)
77 ROOTLIBSHELL= $(LIBSHELL:%=$(LIBSAD)/%)
78 ROOTSYMLINKS= $(SBINPROG:%=$(ROOTBIN)/%)
80 # Performance monitoring should not be enabled by default. Hence, these
81 # entries are comments.
82 ENTRY1= '$(POUND_SIGN) 0 * * * 0-6 /usr/lib/sa/sa1'
83 ENTRY2= '$(POUND_SIGN) 20,40 8-17 * * 1-5 /usr/lib/sa/sa1'
84 ENTRY3= '$(POUND_SIGN) 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A'
86 CLOBBERFILES= $(PROGS) $(SHELLS)
88 # Conditionals
89 $(LIBSAD)/$(SADC) := FILEMODE = 0555
91 .KEEP_STATE:
93 all: $(ALL) $(TXTS)
95 $(SADC): $(SADC_OBJECTS)
96 $(LINK.c) -o $@ $(SADC_OBJECTS) $(LDLIBS)
97 $(POST_PROCESS)
99 # The edit of SYSCRONTAB must be done unconditionally because of the
100 # creation of this file by a different component (Adm) and the possible
101 # backdating.
102 install: all $(ROOTPROG) $(ROOTUSBINPROG) \
103 $(ROOTINITSHELL) $(ROOTLIBSHELL) $(ROOTSYMLINKS) \
104 $(ROOTMANIFEST) $(ROOTSVCMETHOD) $(ROOTLIBPROG)
105 @if [ -f $(SYSCRONTAB) ]; \
106 then \
107 if $(GREP) "sa1" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
108 else \
109 echo $(ENTRY1) >> $(SYSCRONTAB); \
110 echo $(ENTRY2) >> $(SYSCRONTAB); \
111 echo "$(SYSCRONTAB) modified"; \
112 fi; \
113 if $(GREP) "sa2" $(SYSCRONTAB) >/dev/null 2>&1 ; then :; \
114 else \
115 echo $(ENTRY3) >> $(SYSCRONTAB); \
116 fi; \
119 $(LIBSAD)/%: %
120 $(INS.file)
122 $(ROOTSYMLINKS):
123 -$(RM) $@; $(SYMLINK) ../sbin/`basename $@` $@
125 $(ETCINITD)/%: %
126 $(INS.file)
128 check: $(CHKMANIFEST)
130 clean:
131 $(RM) $(SADC_OBJECTS) $(PROGS) $(SHELLS)
134 include ../Makefile.targ