summaryrefslogtreecommitdiff
path: root/usr/src/cmd/acct/Makefile
blob: ca9bb05fdc7690ee64b8d5d1dcf86942fdea2ba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident	"%Z%%M%	%I%	%E% SMI"

PROG=		acctcms acctcom acctcon acctcon1 acctcon2 \
		acctdisk acctdusg acctmerg accton acctprc acctprc1 \
		acctprc2 acctwtmp closewtmp fwtmp \
		wtmpfix utmp2wtmp
SHFILE1=	acct chargefee ckpacct dodisk lastlogin\
		monacct nulladm prctmp prdaily prtacct \
		remove runacct shutacct startup turnacct
SHFILE2=	ptecms.awk ptelus.awk
SUBDIRS=	lib
ALL=		$(PROG) $(SHFILE1) $(SHFILE2) holidays

SRCS=		$(PROG:%=%.c)
SHFILE1SRCS=	$(SHFILE1:%=%.sh)

TXTS=		diskusg.c

BINPROG=	acctcom
LIBPROG=	acctcms acctcon acctcon1 acctcon2 acctdisk \
		acctdusg acctmerg accton acctprc acctprc1 acctprc2 \
		acctwtmp closewtmp fwtmp utmp2wtmp \
		wtmpfix chargefee ckpacct dodisk monacct \
		lastlogin nulladm prctmp prdaily prtacct \
		remove runacct shutacct startup turnacct \
		ptecms.awk ptelus.awk
ETCPROG=	holidays
INITPROG=	acct

include		../Makefile.cmd

all:=		TARGET= all
install:=	TARGET= install
clean:=		TARGET= clean
clobber:=	TARGET= clobber
lint:=		TARGET= lint

acctcom := LDLIBS += lib/a.a
acctcms acctcon acctcon1 acctmerg acctprc1 acctprc := LDLIBS += lib/a.a

acctdusg:= CPPFLAGS += -D_FILE_OFFSET_BITS=64
acctdusg:= LDLIBS += -lcmdutils

LIBACCTD=	$(ROOTLIB)/acct
ETCACCTD=	$(ROOTETC)/acct
ETCINITD=	$(ROOTETC)/init.d
VARADMD=	$(ROOT)/var/adm
ACCTDIR=	$(VARADMD)/acct
ACCTSUBDIRS=	$(ACCTDIR)/nite $(ACCTDIR)/fiscal $(ACCTDIR)/sum
WKDIRS=		$(ACCTDIR) $(ACCTSUBDIRS)

# DIRS is directories to create. $(ETCINITD) [aka: /etc/init.d] is created
# in /usr/src/Targetdirs and hence should be assumed to exist.
DIRS=		$(LIBACCTD) $(ETCACCTD) $(WKDIRS)

USRBINPROG=	$(BINPROG:%=$(ROOTBIN)/%)
LIBACCTPROG=	$(LIBPROG:%=$(LIBACCTD)/%)
ETCACCTPROG=	$(ETCPROG:%=$(ETCACCTD)/%)
ETCINITPROG=	$(INITPROG:%=$(ETCINITD)/%)

$(LIBACCTD) :=		DIRMODE=	755
$(ETCACCTD) :=		OWNER=		adm
$(ETCACCTD) :=		GROUP=		adm
$(ETCACCTD) :=		DIRMODE=	755
$(WKDIRS) :=		OWNER=		adm
$(WKDIRS) :=		GROUP=		adm
$(WKDIRS) :=		DIRMODE=	775
$(LIBACCTD)/accton:=	OWNER=		root
$(LIBACCTD)/accton:=	GROUP=		adm
$(LIBACCTD)/accton :=	FILEMODE=	04755
$(ETCINITPROG) :=	OWNER=		root
$(ETCINITPROG) :=	GROUP=		sys
$(ETCINITPROG) :=	FILEMODE=	0744
$(ETCACCTPROG) :=	FILEMODE=	0644

.KEEP_STATE:

.PARALLEL: $(ALL)

all: $(SUBDIRS) .WAIT $(ALL) $(TXTS)

install: all .WAIT $(DIRS) .WAIT $(USRBINPROG) $(LIBACCTPROG) $(ETCACCTPROG) \
	$(ETCINITPROG)

THIS_YEAR:sh=	date +%Y

holidays:	FRC
	@if grep $(THIS_YEAR) holidays > /dev/null 2>&1;\
	then \
		:;\
	else \
		$(ECHO) "building holidays";\
		( \
		$(ECHO) "* @(#)holidays\tJanuary 1, `date +%Y`";\
		$(ECHO) "*";\
		$(ECHO) "* Prime/Nonprime Table for UNIX Accounting System";\
		$(ECHO) "*";\
		$(ECHO) "* Curr\tPrime\tNon-Prime";\
		$(ECHO) "* Year\tStart\tStart";\
		$(ECHO) "*";\
		$(ECHO) "  `date +%Y`\t0800\t1800";\
		$(ECHO) "*";\
		$(ECHO) "* only the first column (month/day) is significiant.";\
		$(ECHO) "*";\
		$(ECHO) "* month/day\tCompany";\
		$(ECHO) "* \t\tHoliday";\
		$(ECHO) "*";\
		$(ECHO) "1/1\t\tNew Years Day";\
		$(ECHO) "7/4\t\tIndep. Day";\
		$(ECHO) "12/25\t\tChristmas" ) > holidays;\
	fi

$(DIRS):
	$(INS.dir)

$(LIBACCTD)/% : %
	$(INS.file)

$(ETCACCTD)/% : %
	$(INS.file)

$(ETCINITD)/% : %
	$(INS.file)

$(SUBDIRS): FRC
	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)

FRC:

clean: $(SUBDIRS)

clobber: $(SUBDIRS)
	$(RM) $(PROG) $(SHFILE1) holidays

lint:	$(SUBDIRS)
	$(LINT.c) $(SRCS)