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