xref: /titanic_51/usr/src/cmd/acct/Makefile (revision ea8dc4b6d2251b437950c0056bc626b311c73c27)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26#ident	"%Z%%M%	%I%	%E% SMI"
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
42TXTS=		diskusg.c
43
44BINPROG=	acctcom
45LIBPROG=	acctcms acctcon acctcon1 acctcon2 acctdisk \
46		acctdusg acctmerg accton acctprc acctprc1 acctprc2 \
47		acctwtmp closewtmp fwtmp utmp2wtmp \
48		wtmpfix chargefee ckpacct dodisk monacct \
49		lastlogin nulladm prctmp prdaily prtacct \
50		remove runacct shutacct startup turnacct \
51		ptecms.awk ptelus.awk
52ETCPROG=	holidays
53INITPROG=	acct
54
55include		../Makefile.cmd
56
57all:=		TARGET= all
58install:=	TARGET= install
59clean:=		TARGET= clean
60clobber:=	TARGET= clobber
61lint:=		TARGET= lint
62
63acctcom := LDLIBS += lib/a.a
64acctcms acctcon acctcon1 acctmerg acctprc1 acctprc := LDLIBS += lib/a.a
65
66acctdusg:= CPPFLAGS += -D_FILE_OFFSET_BITS=64
67acctdusg:= LDLIBS += -lcmdutils
68
69LIBACCTD=	$(ROOTLIB)/acct
70ETCACCTD=	$(ROOTETC)/acct
71ETCINITD=	$(ROOTETC)/init.d
72VARADMD=	$(ROOT)/var/adm
73ACCTDIR=	$(VARADMD)/acct
74ACCTSUBDIRS=	$(ACCTDIR)/nite $(ACCTDIR)/fiscal $(ACCTDIR)/sum
75WKDIRS=		$(ACCTDIR) $(ACCTSUBDIRS)
76
77# DIRS is directories to create. $(ETCINITD) [aka: /etc/init.d] is created
78# in /usr/src/Targetdirs and hence should be assumed to exist.
79DIRS=		$(LIBACCTD) $(ETCACCTD) $(WKDIRS)
80
81USRBINPROG=	$(BINPROG:%=$(ROOTBIN)/%)
82LIBACCTPROG=	$(LIBPROG:%=$(LIBACCTD)/%)
83ETCACCTPROG=	$(ETCPROG:%=$(ETCACCTD)/%)
84ETCINITPROG=	$(INITPROG:%=$(ETCINITD)/%)
85
86$(LIBACCTD) :=		DIRMODE=	755
87$(ETCACCTD) :=		OWNER=		adm
88$(ETCACCTD) :=		GROUP=		adm
89$(ETCACCTD) :=		DIRMODE=	755
90$(WKDIRS) :=		OWNER=		adm
91$(WKDIRS) :=		GROUP=		adm
92$(WKDIRS) :=		DIRMODE=	775
93$(LIBACCTD)/accton:=	OWNER=		root
94$(LIBACCTD)/accton:=	GROUP=		adm
95$(LIBACCTD)/accton :=	FILEMODE=	04755
96$(ETCINITPROG) :=	OWNER=		root
97$(ETCINITPROG) :=	GROUP=		sys
98$(ETCINITPROG) :=	FILEMODE=	0744
99$(ETCACCTPROG) :=	FILEMODE=	0644
100
101.KEEP_STATE:
102
103.PARALLEL: $(ALL)
104
105all: $(SUBDIRS) .WAIT $(ALL) $(TXTS)
106
107install: all .WAIT $(DIRS) .WAIT $(USRBINPROG) $(LIBACCTPROG) $(ETCACCTPROG) \
108	$(ETCINITPROG)
109
110THIS_YEAR:sh=	date +%Y
111
112holidays:	FRC
113	@if grep $(THIS_YEAR) holidays > /dev/null 2>&1;\
114	then \
115		:;\
116	else \
117		$(ECHO) "building holidays";\
118		( \
119		$(ECHO) "* @(#)holidays\tJanuary 1, `date +%Y`";\
120		$(ECHO) "*";\
121		$(ECHO) "* Prime/Nonprime Table for UNIX Accounting System";\
122		$(ECHO) "*";\
123		$(ECHO) "* Curr\tPrime\tNon-Prime";\
124		$(ECHO) "* Year\tStart\tStart";\
125		$(ECHO) "*";\
126		$(ECHO) "  `date +%Y`\t0800\t1800";\
127		$(ECHO) "*";\
128		$(ECHO) "* only the first column (month/day) is significiant.";\
129		$(ECHO) "*";\
130		$(ECHO) "* month/day\tCompany";\
131		$(ECHO) "* \t\tHoliday";\
132		$(ECHO) "*";\
133		$(ECHO) "1/1\t\tNew Years Day";\
134		$(ECHO) "7/4\t\tIndep. Day";\
135		$(ECHO) "12/25\t\tChristmas" ) > holidays;\
136	fi
137
138$(DIRS):
139	$(INS.dir)
140
141$(LIBACCTD)/% : %
142	$(INS.file)
143
144$(ETCACCTD)/% : %
145	$(INS.file)
146
147$(ETCINITD)/% : %
148	$(INS.file)
149
150$(SUBDIRS): FRC
151	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
152
153FRC:
154
155clean: $(SUBDIRS)
156
157clobber: $(SUBDIRS)
158	$(RM) $(PROG) $(SHFILE1) holidays
159
160lint:	$(SUBDIRS)
161	$(LINT.c) $(SRCS)
162