xref: /illumos-gate/usr/src/cmd/acct/Makefile (revision 8226594fdd4479be135127f43632f1f995074654)
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 2015 Gary Mills
23# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# Copyright (c) 2018, Joyent, Inc.
27
28PROG=		acctcms acctcom acctcon acctcon1 acctcon2 \
29		acctdisk acctdusg acctmerg accton acctprc acctprc1 \
30		acctprc2 acctwtmp closewtmp fwtmp \
31		wtmpfix utmp2wtmp
32SHFILE1=	acct chargefee ckpacct dodisk lastlogin\
33		monacct nulladm prctmp prdaily prtacct \
34		remove runacct shutacct startup turnacct
35SHFILE2=	ptecms.awk ptelus.awk
36SUBDIRS=	lib
37ALL=		$(PROG) $(SHFILE1) $(SHFILE2) holidays
38
39SRCS=		$(PROG:%=%.c)
40SHFILE1SRCS=	$(SHFILE1:%=%.sh)
41
42BINPROG=	acctcom
43LIBPROG=	acctcms acctcon acctcon1 acctcon2 acctdisk \
44		acctdusg acctmerg accton acctprc acctprc1 acctprc2 \
45		acctwtmp closewtmp fwtmp utmp2wtmp \
46		wtmpfix chargefee ckpacct dodisk monacct \
47		lastlogin nulladm prctmp prdaily prtacct \
48		remove runacct shutacct startup turnacct \
49		ptecms.awk ptelus.awk
50ETCPROG=	holidays
51INITPROG=	acct
52
53include		../Makefile.cmd
54
55all:=		TARGET= all
56install:=	TARGET= install
57clean:=		TARGET= clean
58clobber:=	TARGET= clobber
59lint:=		TARGET= lint
60
61acctcom := LDLIBS += lib/a.a
62acctcms acctcon acctcon1 acctmerg acctprc1 acctprc := LDLIBS += lib/a.a
63
64acctdusg:= CPPFLAGS += -D_FILE_OFFSET_BITS=64
65acctdusg:= LDLIBS += -lcmdutils
66
67LIBACCTD=	$(ROOTLIB)/acct
68ETCACCTD=	$(ROOTETC)/acct
69ETCINITD=	$(ROOTETC)/init.d
70VARADMD=	$(ROOT)/var/adm
71ACCTDIR=	$(VARADMD)/acct
72ACCTSUBDIRS=	$(ACCTDIR)/nite $(ACCTDIR)/fiscal $(ACCTDIR)/sum
73WKDIRS=		$(ACCTDIR) $(ACCTSUBDIRS)
74
75# DIRS is directories to create. $(ETCINITD) [aka: /etc/init.d] is created
76# in /usr/src/Targetdirs and hence should be assumed to exist.
77DIRS=		$(LIBACCTD) $(ETCACCTD) $(WKDIRS)
78
79USRBINPROG=	$(BINPROG:%=$(ROOTBIN)/%)
80LIBACCTPROG=	$(LIBPROG:%=$(LIBACCTD)/%)
81ETCACCTPROG=	$(ETCPROG:%=$(ETCACCTD)/%)
82ETCINITPROG=	$(INITPROG:%=$(ETCINITD)/%)
83
84$(LIBACCTD) :=		DIRMODE=	755
85$(ETCACCTD) :=		DIRMODE=	755
86$(WKDIRS) :=		DIRMODE=	775
87$(LIBACCTD)/accton :=	FILEMODE=	04755
88$(ETCINITPROG) :=	FILEMODE=	0744
89$(ETCACCTPROG) :=	FILEMODE=	0644
90
91CERRWARN +=	-_gcc=-Wno-implicit-function-declaration
92CERRWARN +=	-_gcc=-Wno-parentheses
93CERRWARN +=	-_gcc=-Wno-unused-variable
94CERRWARN +=	-_gcc=-Wno-address
95
96# not linted
97SMATCH=off
98
99.KEEP_STATE:
100
101.PARALLEL: $(ALL)
102
103all: $(SUBDIRS) .WAIT $(ALL)
104
105install: all .WAIT $(DIRS) .WAIT $(USRBINPROG) $(LIBACCTPROG) $(ETCACCTPROG) \
106	$(ETCINITPROG)
107
108THIS_YEAR:sh=	date +%Y
109
110holidays:	FRC
111	@if grep $(THIS_YEAR) holidays > /dev/null 2>&1;\
112	then \
113		:;\
114	else \
115		$(ECHO) "building holidays";\
116		( \
117		$(ECHO) "* @(#)holidays\tJanuary 1, `date +%Y`";\
118		$(ECHO) "*";\
119		$(ECHO) "* Prime/Nonprime Table for UNIX Accounting System";\
120		$(ECHO) "*";\
121		$(ECHO) "* Curr\tPrime\tNon-Prime";\
122		$(ECHO) "* Year\tStart\tStart";\
123		$(ECHO) "*";\
124		$(ECHO) "  `date +%Y`\t0800\t1800";\
125		$(ECHO) "*";\
126		$(ECHO) "* only the first column (month/day) is significiant.";\
127		$(ECHO) "*";\
128		$(ECHO) "* month/day\tCompany";\
129		$(ECHO) "* \t\tHoliday";\
130		$(ECHO) "*";\
131		$(ECHO) "1/1\t\tNew Years Day";\
132		$(ECHO) "7/4\t\tIndep. Day";\
133		$(ECHO) "12/25\t\tChristmas" ) > holidays;\
134	fi
135
136$(DIRS):
137	$(INS.dir)
138
139$(LIBACCTD)/% : %
140	$(INS.file)
141
142$(ETCACCTD)/% : %
143	$(INS.file)
144
145$(ETCINITD)/% : %
146	$(INS.file)
147
148$(SUBDIRS): FRC
149	@cd $@; pwd; $(MAKE) $(TARGET)
150
151FRC:
152
153clean: $(SUBDIRS)
154
155clobber: $(SUBDIRS)
156	$(RM) $(PROG) $(SHFILE1) holidays
157
158lint:	$(SUBDIRS)
159	$(LINT.c) $(SRCS)
160