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