xref: /titanic_51/usr/src/cmd/acct/Makefile (revision 12844f5a6e6a4f8cb472dc421b8263103c55bd43)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
524fe0b3bSjmcp# Common Development and Distribution License (the "License").
624fe0b3bSjmcp# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
22*12844f5aSGary Mills# Copyright 2015 Gary Mills
2324fe0b3bSjmcp# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gatePROG=		acctcms acctcom acctcon acctcon1 acctcon2 \
287c478bd9Sstevel@tonic-gate		acctdisk acctdusg acctmerg accton acctprc acctprc1 \
297c478bd9Sstevel@tonic-gate		acctprc2 acctwtmp closewtmp fwtmp \
307c478bd9Sstevel@tonic-gate		wtmpfix utmp2wtmp
317c478bd9Sstevel@tonic-gateSHFILE1=	acct chargefee ckpacct dodisk lastlogin\
327c478bd9Sstevel@tonic-gate		monacct nulladm prctmp prdaily prtacct \
337c478bd9Sstevel@tonic-gate		remove runacct shutacct startup turnacct
347c478bd9Sstevel@tonic-gateSHFILE2=	ptecms.awk ptelus.awk
357c478bd9Sstevel@tonic-gateSUBDIRS=	lib
367c478bd9Sstevel@tonic-gateALL=		$(PROG) $(SHFILE1) $(SHFILE2) holidays
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gateSRCS=		$(PROG:%=%.c)
397c478bd9Sstevel@tonic-gateSHFILE1SRCS=	$(SHFILE1:%=%.sh)
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gateBINPROG=	acctcom
427c478bd9Sstevel@tonic-gateLIBPROG=	acctcms acctcon acctcon1 acctcon2 acctdisk \
437c478bd9Sstevel@tonic-gate		acctdusg acctmerg accton acctprc acctprc1 acctprc2 \
447c478bd9Sstevel@tonic-gate		acctwtmp closewtmp fwtmp utmp2wtmp \
457c478bd9Sstevel@tonic-gate		wtmpfix chargefee ckpacct dodisk monacct \
467c478bd9Sstevel@tonic-gate		lastlogin nulladm prctmp prdaily prtacct \
477c478bd9Sstevel@tonic-gate		remove runacct shutacct startup turnacct \
487c478bd9Sstevel@tonic-gate		ptecms.awk ptelus.awk
497c478bd9Sstevel@tonic-gateETCPROG=	holidays
507c478bd9Sstevel@tonic-gateINITPROG=	acct
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gateinclude		../Makefile.cmd
537c478bd9Sstevel@tonic-gate
547c478bd9Sstevel@tonic-gateall:=		TARGET= all
557c478bd9Sstevel@tonic-gateinstall:=	TARGET= install
567c478bd9Sstevel@tonic-gateclean:=		TARGET= clean
577c478bd9Sstevel@tonic-gateclobber:=	TARGET= clobber
587c478bd9Sstevel@tonic-gatelint:=		TARGET= lint
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gateacctcom := LDLIBS += lib/a.a
617c478bd9Sstevel@tonic-gateacctcms acctcon acctcon1 acctmerg acctprc1 acctprc := LDLIBS += lib/a.a
627c478bd9Sstevel@tonic-gate
637c478bd9Sstevel@tonic-gateacctdusg:= CPPFLAGS += -D_FILE_OFFSET_BITS=64
647c478bd9Sstevel@tonic-gateacctdusg:= LDLIBS += -lcmdutils
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gateLIBACCTD=	$(ROOTLIB)/acct
677c478bd9Sstevel@tonic-gateETCACCTD=	$(ROOTETC)/acct
687c478bd9Sstevel@tonic-gateETCINITD=	$(ROOTETC)/init.d
697c478bd9Sstevel@tonic-gateVARADMD=	$(ROOT)/var/adm
707c478bd9Sstevel@tonic-gateACCTDIR=	$(VARADMD)/acct
717c478bd9Sstevel@tonic-gateACCTSUBDIRS=	$(ACCTDIR)/nite $(ACCTDIR)/fiscal $(ACCTDIR)/sum
727c478bd9Sstevel@tonic-gateWKDIRS=		$(ACCTDIR) $(ACCTSUBDIRS)
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate# DIRS is directories to create. $(ETCINITD) [aka: /etc/init.d] is created
757c478bd9Sstevel@tonic-gate# in /usr/src/Targetdirs and hence should be assumed to exist.
767c478bd9Sstevel@tonic-gateDIRS=		$(LIBACCTD) $(ETCACCTD) $(WKDIRS)
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gateUSRBINPROG=	$(BINPROG:%=$(ROOTBIN)/%)
797c478bd9Sstevel@tonic-gateLIBACCTPROG=	$(LIBPROG:%=$(LIBACCTD)/%)
807c478bd9Sstevel@tonic-gateETCACCTPROG=	$(ETCPROG:%=$(ETCACCTD)/%)
817c478bd9Sstevel@tonic-gateETCINITPROG=	$(INITPROG:%=$(ETCINITD)/%)
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gate$(LIBACCTD) :=		DIRMODE=	755
847c478bd9Sstevel@tonic-gate$(ETCACCTD) :=		DIRMODE=	755
857c478bd9Sstevel@tonic-gate$(WKDIRS) :=		DIRMODE=	775
867c478bd9Sstevel@tonic-gate$(LIBACCTD)/accton :=	FILEMODE=	04755
877c478bd9Sstevel@tonic-gate$(ETCINITPROG) :=	FILEMODE=	0744
887c478bd9Sstevel@tonic-gate$(ETCACCTPROG) :=	FILEMODE=	0644
897c478bd9Sstevel@tonic-gate
907014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-implicit-function-declaration
917014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
927014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-unused-variable
937014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-address
947014882cSRichard Lowe
957c478bd9Sstevel@tonic-gate.KEEP_STATE:
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate.PARALLEL: $(ALL)
987c478bd9Sstevel@tonic-gate
99*12844f5aSGary Millsall: $(SUBDIRS) .WAIT $(ALL)
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gateinstall: all .WAIT $(DIRS) .WAIT $(USRBINPROG) $(LIBACCTPROG) $(ETCACCTPROG) \
1027c478bd9Sstevel@tonic-gate	$(ETCINITPROG)
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gateTHIS_YEAR:sh=	date +%Y
1057c478bd9Sstevel@tonic-gate
1067c478bd9Sstevel@tonic-gateholidays:	FRC
1077c478bd9Sstevel@tonic-gate	@if grep $(THIS_YEAR) holidays > /dev/null 2>&1;\
1087c478bd9Sstevel@tonic-gate	then \
1097c478bd9Sstevel@tonic-gate		:;\
1107c478bd9Sstevel@tonic-gate	else \
1117c478bd9Sstevel@tonic-gate		$(ECHO) "building holidays";\
1127c478bd9Sstevel@tonic-gate		( \
1137c478bd9Sstevel@tonic-gate		$(ECHO) "* @(#)holidays\tJanuary 1, `date +%Y`";\
1147c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1157c478bd9Sstevel@tonic-gate		$(ECHO) "* Prime/Nonprime Table for UNIX Accounting System";\
1167c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1177c478bd9Sstevel@tonic-gate		$(ECHO) "* Curr\tPrime\tNon-Prime";\
1187c478bd9Sstevel@tonic-gate		$(ECHO) "* Year\tStart\tStart";\
1197c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1207c478bd9Sstevel@tonic-gate		$(ECHO) "  `date +%Y`\t0800\t1800";\
1217c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1227c478bd9Sstevel@tonic-gate		$(ECHO) "* only the first column (month/day) is significiant.";\
1237c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1247c478bd9Sstevel@tonic-gate		$(ECHO) "* month/day\tCompany";\
1257c478bd9Sstevel@tonic-gate		$(ECHO) "* \t\tHoliday";\
1267c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1277c478bd9Sstevel@tonic-gate		$(ECHO) "1/1\t\tNew Years Day";\
1287c478bd9Sstevel@tonic-gate		$(ECHO) "7/4\t\tIndep. Day";\
1297c478bd9Sstevel@tonic-gate		$(ECHO) "12/25\t\tChristmas" ) > holidays;\
1307c478bd9Sstevel@tonic-gate	fi
1317c478bd9Sstevel@tonic-gate
1327c478bd9Sstevel@tonic-gate$(DIRS):
1337c478bd9Sstevel@tonic-gate	$(INS.dir)
1347c478bd9Sstevel@tonic-gate
1357c478bd9Sstevel@tonic-gate$(LIBACCTD)/% : %
1367c478bd9Sstevel@tonic-gate	$(INS.file)
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gate$(ETCACCTD)/% : %
1397c478bd9Sstevel@tonic-gate	$(INS.file)
1407c478bd9Sstevel@tonic-gate
1417c478bd9Sstevel@tonic-gate$(ETCINITD)/% : %
1427c478bd9Sstevel@tonic-gate	$(INS.file)
1437c478bd9Sstevel@tonic-gate
1447c478bd9Sstevel@tonic-gate$(SUBDIRS): FRC
1457c478bd9Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET)
1467c478bd9Sstevel@tonic-gate
1477c478bd9Sstevel@tonic-gateFRC:
1487c478bd9Sstevel@tonic-gate
1497c478bd9Sstevel@tonic-gateclean: $(SUBDIRS)
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gateclobber: $(SUBDIRS)
1527c478bd9Sstevel@tonic-gate	$(RM) $(PROG) $(SHFILE1) holidays
1537c478bd9Sstevel@tonic-gate
1547c478bd9Sstevel@tonic-gatelint:	$(SUBDIRS)
1557c478bd9Sstevel@tonic-gate	$(LINT.c) $(SRCS)
156