xref: /illumos-gate/usr/src/cmd/acct/Makefile (revision f96a0cef)
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#
2212844f5aSGary 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#
265661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gatePROG=		acctcms acctcom acctcon acctcon1 acctcon2 \
297c478bd9Sstevel@tonic-gate		acctdisk acctdusg acctmerg accton acctprc acctprc1 \
307c478bd9Sstevel@tonic-gate		acctprc2 acctwtmp closewtmp fwtmp \
317c478bd9Sstevel@tonic-gate		wtmpfix utmp2wtmp
327c478bd9Sstevel@tonic-gateSHFILE1=	acct chargefee ckpacct dodisk lastlogin\
337c478bd9Sstevel@tonic-gate		monacct nulladm prctmp prdaily prtacct \
347c478bd9Sstevel@tonic-gate		remove runacct shutacct startup turnacct
357c478bd9Sstevel@tonic-gateSHFILE2=	ptecms.awk ptelus.awk
367c478bd9Sstevel@tonic-gateSUBDIRS=	lib
377c478bd9Sstevel@tonic-gateALL=		$(PROG) $(SHFILE1) $(SHFILE2) holidays
387c478bd9Sstevel@tonic-gate
397c478bd9Sstevel@tonic-gateSRCS=		$(PROG:%=%.c)
407c478bd9Sstevel@tonic-gateSHFILE1SRCS=	$(SHFILE1:%=%.sh)
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gateBINPROG=	acctcom
437c478bd9Sstevel@tonic-gateLIBPROG=	acctcms acctcon acctcon1 acctcon2 acctdisk \
447c478bd9Sstevel@tonic-gate		acctdusg acctmerg accton acctprc acctprc1 acctprc2 \
457c478bd9Sstevel@tonic-gate		acctwtmp closewtmp fwtmp utmp2wtmp \
467c478bd9Sstevel@tonic-gate		wtmpfix chargefee ckpacct dodisk monacct \
477c478bd9Sstevel@tonic-gate		lastlogin nulladm prctmp prdaily prtacct \
487c478bd9Sstevel@tonic-gate		remove runacct shutacct startup turnacct \
497c478bd9Sstevel@tonic-gate		ptecms.awk ptelus.awk
507c478bd9Sstevel@tonic-gateETCPROG=	holidays
517c478bd9Sstevel@tonic-gateINITPROG=	acct
527c478bd9Sstevel@tonic-gate
537c478bd9Sstevel@tonic-gateinclude		../Makefile.cmd
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gateall:=		TARGET= all
567c478bd9Sstevel@tonic-gateinstall:=	TARGET= install
577c478bd9Sstevel@tonic-gateclean:=		TARGET= clean
587c478bd9Sstevel@tonic-gateclobber:=	TARGET= clobber
597c478bd9Sstevel@tonic-gatelint:=		TARGET= lint
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gateacctcom := LDLIBS += lib/a.a
627c478bd9Sstevel@tonic-gateacctcms acctcon acctcon1 acctmerg acctprc1 acctprc := LDLIBS += lib/a.a
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gateacctdusg:= CPPFLAGS += -D_FILE_OFFSET_BITS=64
657c478bd9Sstevel@tonic-gateacctdusg:= LDLIBS += -lcmdutils
667c478bd9Sstevel@tonic-gate
677c478bd9Sstevel@tonic-gateLIBACCTD=	$(ROOTLIB)/acct
687c478bd9Sstevel@tonic-gateETCACCTD=	$(ROOTETC)/acct
697c478bd9Sstevel@tonic-gateETCINITD=	$(ROOTETC)/init.d
707c478bd9Sstevel@tonic-gateVARADMD=	$(ROOT)/var/adm
717c478bd9Sstevel@tonic-gateACCTDIR=	$(VARADMD)/acct
727c478bd9Sstevel@tonic-gateACCTSUBDIRS=	$(ACCTDIR)/nite $(ACCTDIR)/fiscal $(ACCTDIR)/sum
737c478bd9Sstevel@tonic-gateWKDIRS=		$(ACCTDIR) $(ACCTSUBDIRS)
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate# DIRS is directories to create. $(ETCINITD) [aka: /etc/init.d] is created
767c478bd9Sstevel@tonic-gate# in /usr/src/Targetdirs and hence should be assumed to exist.
777c478bd9Sstevel@tonic-gateDIRS=		$(LIBACCTD) $(ETCACCTD) $(WKDIRS)
787c478bd9Sstevel@tonic-gate
797c478bd9Sstevel@tonic-gateUSRBINPROG=	$(BINPROG:%=$(ROOTBIN)/%)
807c478bd9Sstevel@tonic-gateLIBACCTPROG=	$(LIBPROG:%=$(LIBACCTD)/%)
817c478bd9Sstevel@tonic-gateETCACCTPROG=	$(ETCPROG:%=$(ETCACCTD)/%)
827c478bd9Sstevel@tonic-gateETCINITPROG=	$(INITPROG:%=$(ETCINITD)/%)
837c478bd9Sstevel@tonic-gate
847c478bd9Sstevel@tonic-gate$(LIBACCTD) :=		DIRMODE=	755
857c478bd9Sstevel@tonic-gate$(ETCACCTD) :=		DIRMODE=	755
867c478bd9Sstevel@tonic-gate$(WKDIRS) :=		DIRMODE=	775
877c478bd9Sstevel@tonic-gate$(LIBACCTD)/accton :=	FILEMODE=	04755
887c478bd9Sstevel@tonic-gate$(ETCINITPROG) :=	FILEMODE=	0744
897c478bd9Sstevel@tonic-gate$(ETCACCTPROG) :=	FILEMODE=	0644
907c478bd9Sstevel@tonic-gate
917014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-implicit-function-declaration
927014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-parentheses
937014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-unused-variable
947014882cSRichard LoweCERRWARN +=	-_gcc=-Wno-address
957014882cSRichard Lowe
965661bb76SJohn Levon# not linted
975661bb76SJohn LevonSMATCH=off
985661bb76SJohn Levon
997c478bd9Sstevel@tonic-gate.KEEP_STATE:
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gate.PARALLEL: $(ALL)
1027c478bd9Sstevel@tonic-gate
10312844f5aSGary Millsall: $(SUBDIRS) .WAIT $(ALL)
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gateinstall: all .WAIT $(DIRS) .WAIT $(USRBINPROG) $(LIBACCTPROG) $(ETCACCTPROG) \
1067c478bd9Sstevel@tonic-gate	$(ETCINITPROG)
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gateTHIS_YEAR:sh=	date +%Y
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gateholidays:	FRC
1117c478bd9Sstevel@tonic-gate	@if grep $(THIS_YEAR) holidays > /dev/null 2>&1;\
1127c478bd9Sstevel@tonic-gate	then \
1137c478bd9Sstevel@tonic-gate		:;\
1147c478bd9Sstevel@tonic-gate	else \
1157c478bd9Sstevel@tonic-gate		$(ECHO) "building holidays";\
1167c478bd9Sstevel@tonic-gate		( \
1177c478bd9Sstevel@tonic-gate		$(ECHO) "* @(#)holidays\tJanuary 1, `date +%Y`";\
1187c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1197c478bd9Sstevel@tonic-gate		$(ECHO) "* Prime/Nonprime Table for UNIX Accounting System";\
1207c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1217c478bd9Sstevel@tonic-gate		$(ECHO) "* Curr\tPrime\tNon-Prime";\
1227c478bd9Sstevel@tonic-gate		$(ECHO) "* Year\tStart\tStart";\
1237c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1247c478bd9Sstevel@tonic-gate		$(ECHO) "  `date +%Y`\t0800\t1800";\
1257c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1267c478bd9Sstevel@tonic-gate		$(ECHO) "* only the first column (month/day) is significiant.";\
1277c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1287c478bd9Sstevel@tonic-gate		$(ECHO) "* month/day\tCompany";\
1297c478bd9Sstevel@tonic-gate		$(ECHO) "* \t\tHoliday";\
1307c478bd9Sstevel@tonic-gate		$(ECHO) "*";\
1317c478bd9Sstevel@tonic-gate		$(ECHO) "1/1\t\tNew Years Day";\
1327c478bd9Sstevel@tonic-gate		$(ECHO) "7/4\t\tIndep. Day";\
1337c478bd9Sstevel@tonic-gate		$(ECHO) "12/25\t\tChristmas" ) > holidays;\
1347c478bd9Sstevel@tonic-gate	fi
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate$(DIRS):
1377c478bd9Sstevel@tonic-gate	$(INS.dir)
1387c478bd9Sstevel@tonic-gate
1397c478bd9Sstevel@tonic-gate$(LIBACCTD)/% : %
1407c478bd9Sstevel@tonic-gate	$(INS.file)
1417c478bd9Sstevel@tonic-gate
1427c478bd9Sstevel@tonic-gate$(ETCACCTD)/% : %
1437c478bd9Sstevel@tonic-gate	$(INS.file)
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gate$(ETCINITD)/% : %
1467c478bd9Sstevel@tonic-gate	$(INS.file)
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gate$(SUBDIRS): FRC
149*f96a0cefSRichard Lowe	@cd $@; pwd; $(MAKE) $(TARGET)
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gateFRC:
1527c478bd9Sstevel@tonic-gate
1537c478bd9Sstevel@tonic-gateclean: $(SUBDIRS)
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gateclobber: $(SUBDIRS)
1567c478bd9Sstevel@tonic-gate	$(RM) $(PROG) $(SHFILE1) holidays
1577c478bd9Sstevel@tonic-gate
1587c478bd9Sstevel@tonic-gatelint:	$(SUBDIRS)
1597c478bd9Sstevel@tonic-gate	$(LINT.c) $(SRCS)
160