Home | History | Annotate | Download | only in acct
      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 
     28 PROG=		acctcms acctcom acctcon acctcon1 acctcon2 \
     29 		acctdisk acctdusg acctmerg accton acctprc acctprc1 \
     30 		acctprc2 acctwtmp closewtmp fwtmp \
     31 		wtmpfix utmp2wtmp
     32 SHFILE1=	acct chargefee ckpacct dodisk lastlogin\
     33 		monacct nulladm prctmp prdaily prtacct \
     34 		remove runacct shutacct startup turnacct
     35 SHFILE2=	ptecms.awk ptelus.awk
     36 SUBDIRS=	lib
     37 ALL=		$(PROG) $(SHFILE1) $(SHFILE2) holidays
     38 
     39 SRCS=		$(PROG:%=%.c)
     40 SHFILE1SRCS=	$(SHFILE1:%=%.sh)
     41 
     42 TXTS=		diskusg.c
     43 
     44 BINPROG=	acctcom
     45 LIBPROG=	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
     52 ETCPROG=	holidays
     53 INITPROG=	acct
     54 
     55 include		../Makefile.cmd
     56 
     57 all:=		TARGET= all
     58 install:=	TARGET= install
     59 clean:=		TARGET= clean
     60 clobber:=	TARGET= clobber
     61 lint:=		TARGET= lint
     62 
     63 acctcom := LDLIBS += lib/a.a
     64 acctcms acctcon acctcon1 acctmerg acctprc1 acctprc := LDLIBS += lib/a.a
     65 
     66 acctdusg:= CPPFLAGS += -D_FILE_OFFSET_BITS=64
     67 acctdusg:= LDLIBS += -lcmdutils
     68 
     69 LIBACCTD=	$(ROOTLIB)/acct
     70 ETCACCTD=	$(ROOTETC)/acct
     71 ETCINITD=	$(ROOTETC)/init.d
     72 VARADMD=	$(ROOT)/var/adm
     73 ACCTDIR=	$(VARADMD)/acct
     74 ACCTSUBDIRS=	$(ACCTDIR)/nite $(ACCTDIR)/fiscal $(ACCTDIR)/sum
     75 WKDIRS=		$(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.
     79 DIRS=		$(LIBACCTD) $(ETCACCTD) $(WKDIRS)
     80 
     81 USRBINPROG=	$(BINPROG:%=$(ROOTBIN)/%)
     82 LIBACCTPROG=	$(LIBPROG:%=$(LIBACCTD)/%)
     83 ETCACCTPROG=	$(ETCPROG:%=$(ETCACCTD)/%)
     84 ETCINITPROG=	$(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 
    105 all: $(SUBDIRS) .WAIT $(ALL) $(TXTS)
    106 
    107 install: all .WAIT $(DIRS) .WAIT $(USRBINPROG) $(LIBACCTPROG) $(ETCACCTPROG) \
    108 	$(ETCINITPROG)
    109 
    110 THIS_YEAR:sh=	date +%Y
    111 
    112 holidays:	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 
    153 FRC:
    154 
    155 clean: $(SUBDIRS)
    156 
    157 clobber: $(SUBDIRS)
    158 	$(RM) $(PROG) $(SHFILE1) holidays
    159 
    160 lint:	$(SUBDIRS)
    161 	$(LINT.c) $(SRCS)
    162