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 DEFAULTFILES =  cron.dfl
  27 
  28 include         ../Makefile.cmd
  29 
  30 MANIFEST =      cron.xml
  31 
  32 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
  33 ROOTMETHOD =    $(ROOTLIBSVCMETHOD)/svc-cron
  34 
  35 CPPFLAGS +=     -D_FILE_OFFSET_BITS=64 -I $(SRC)/common/util
  36 CERRWARN +=     -_gcc=-Wno-parentheses
  37 CERRWARN +=     -_gcc=-Wno-unused-label
  38 CERRWARN +=     -_gcc=-Wno-uninitialized
  39 CERRWARN +=     -_gcc=-Wno-unused-variable
  40 CERRWARN +=     -_gcc=-Wno-unused-value
  41 
  42 ROOTVAR =       $(ROOT)/var
  43 
  44 ROOTSPCRON =    $(ROOTVAR)/spool/cron
  45 ROOTCROND =     $(ROOTETC)/cron.d
  46 ROOTCRONTABS =  $(ROOTSPCRON)/crontabs
  47 ROOTATJOBS =    $(ROOTSPCRON)/atjobs
  48 ROOTLIBCRON =   $(ROOTLIB)/cron
  49 
  50 PROG1 =         cron
  51 PROG2 =         at atq atrm crontab
  52 XPG6PROG =      crontab
  53 XPG4PROG =      at crontab
  54 PROG =          $(PROG1) $(PROG2)
  55 
  56 SCRIPT =        batch
  57 XPG4SCRIPT =    batch.xpg4
  58 
  59 POFILE=         $(PROG1)_cmd.po
  60 POFILES1=       at.po crontab.po funcs.po batch.po
  61 POFILES=        $(POFILES1) atrm.po
  62 $(POFILES1) :=  XGETFLAGS= -a -x $(PROG1).xcl
  63 
  64 ROOTDIRS =      $(ROOTSPCRON) $(ROOTCROND) \
  65                 $(ROOTCRONTABS) $(ROOTATJOBS)
  66 
  67 ROOTPROG =      $(PROG1:%=$(ROOTUSRSBIN)/%) $(PROG2:%=$(ROOTBIN)/%)     \
  68                 $(SCRIPT:%=$(ROOTBIN)/%) \
  69                 $(XPG6PROG:%=$(ROOTXPG6BIN)/%) \
  70                 $(XPG4PROG:%=$(ROOTXPG4BIN)/%) \
  71                 $(XPG4SCRIPT:%.xpg4=$(ROOTXPG4BIN)/%)
  72 
  73 ROOTSYMLINK =   $(ROOTLIBCRON) $(ROOTETC)/cron
  74 
  75 GETRESPSRC=     $(SRC)/common/util/getresponse.c
  76 GETRESPOBJ=     getresponse.o
  77 COMMONOBJ1=     permit.o
  78 COMMONOBJ2=     funcs.o
  79 COMMONOBJS=     $(COMMONOBJ1) $(COMMONOBJ2)
  80 CRONOBJS=       cron.o elm.o
  81 ATOBJS=         at.o att1.o att2.o
  82 XPG4OBJS=       values-xpg4.o
  83 ATRMOBJS1=      atrm.o
  84 ATRMOBJS=       $(ATRMOBJS1) $(GETRESPOBJ)
  85 ATQOBJS=        atq.o
  86 CRONTABOBJS1=   crontab.o
  87 CRONTABOBJS=    $(CRONTABOBJS1) $(GETRESPOBJ)
  88 
  89 # /usr/xpg*/bin/crontab isn't linked with values-xpg*.o since it isn't
  90 # required by any specific behavior differences; this makes these
  91 # setuid variants less likely to accidently trip over differences that
  92 # could unintentionally open up a security hole.
  93 XPG4COMMONOBJS= $(COMMONOBJS:%=objs.xpg4/%)
  94 XPG4CTOBJS=     $(CRONTABOBJS:%=objs.xpg4/%)
  95 XPG4ATOBJS=     $(ATOBJS:%=objs.xpg4/%) $(XPG4OBJS:%=objs.xpg4/%)
  96 XPG6COMMONOBJS= $(COMMONOBJS:%=objs.xpg6/%)
  97 XPG6CTOBJS=     $(CRONTABOBJS:%=objs.xpg6/%)
  98 
  99 cron :=         POBJS = $(CRONOBJS) $(COMMONOBJ2)
 100 at :=           POBJS = $(ATOBJS) $(COMMONOBJS)
 101 at.xpg4 :=      POBJS = $(XPG4ATOBJS) $(XPG4COMMONOBJS)
 102 atrm :=         POBJS = $(ATRMOBJS) $(COMMONOBJS)
 103 atq :=          POBJS = $(ATQOBJS) $(COMMONOBJS)
 104 crontab :=      POBJS = $(CRONTABOBJS) $(COMMONOBJS)
 105 crontab.xpg4 := POBJS = $(XPG4CTOBJS) $(XPG4COMMONOBJS)
 106 crontab.xpg6 := POBJS = $(XPG6CTOBJS) $(XPG6COMMONOBJS)
 107 
 108 CFLAGS += $(CCVERBOSE)
 109 
 110 NOBJS=          $(CRONOBJS) $(ATOBJS) $(ATRMOBJS1) $(ATQOBJS) $(CRONTABOBJS1) \
 111                 $(COMMONOBJS)
 112 OBJS =          $(NOBJS) $(XPG4COMMONOBJS) $(XPG4ATOBJS) $(XPG4CTOBJS) \
 113                 $(XPG6COMMONOBJS) $(XPG6CTOBJS) $(GETRESPOBJ)
 114 
 115 SRCS =          $(NOBJS:%.o=%.c) $(GETRESPSRC)
 116 
 117 CLOBBERFILES += $(SCRIPT) $(XPG4SCRIPT)
 118 
 119 $(ROOTLIBCRON) :=               SYMLNKDEST = ../../etc/cron.d
 120 $(ROOTETC)/cron :=              SYMLNKDEST = ../usr/sbin/cron
 121 
 122 $(ROOTBIN)/at :=                FILEMODE = 04755
 123 $(ROOTXPG4BIN)/at :=            FILEMODE = 04755
 124 $(ROOTBIN)/atrm :=              FILEMODE = 04755
 125 $(ROOTBIN)/atq :=               FILEMODE = 04755
 126 $(ROOTBIN)/crontab :=           FILEMODE = 04555
 127 $(ROOTXPG6BIN)/crontab :=       FILEMODE = 04555
 128 $(ROOTXPG4BIN)/crontab :=       FILEMODE = 04555
 129 $(ROOTUSRSBIN)/cron :=          FILEMODE = 0555
 130 
 131 LDLIBS +=       -lbsm
 132 
 133 at :=           LDLIBS += -lproject -lsecdb
 134 at.xpg4 :=      LDLIBS += -lproject -lsecdb
 135 atq :=          LDLIBS += -lsecdb
 136 atrm :=         LDLIBS += -lsecdb
 137 cron :=         LDLIBS += -lpam -lproject -lcontract -lzoneinfo
 138 crontab :=      LDLIBS += -lsecdb -lpam -lzoneinfo
 139 crontab.xpg6 := LDLIBS += -lsecdb -lpam -lzoneinfo
 140 crontab.xpg4 := LDLIBS += -lsecdb -lpam -lzoneinfo
 141 
 142 lint :=         LDLIBS += -lproject -lsecdb -lcontract -lpam
 143 
 144 $(XPG4) := CFLAGS += -DXPG4
 145 $(XPG6) := CFLAGS += -DXPG6
 146 
 147 LINTFLAGS += -u
 148 
 149 $(ROOTSVCSYSTEM)/cron.xml := FILEMODE = 0444
 150 $(ROOTLIBSVCMETHOD)/svc-cron := FILEMODE = 0555
 151 
 152 
 153 .KEEP_STATE:
 154 
 155 all :           $(PROG) $(XPG4) $(XPG6) $(SCRIPT) $(XPG4SCRIPT) $(FILES)
 156 
 157 install :       all $(ROOTPROG) $(ROOTETCDEFAULTFILES) $(ROOTSYMLINK) \
 158                 $(ROOTMANIFEST) $(ROOTMETHOD)
 159 
 160 $(PROG) :       $$(POBJS)
 161                 $(LINK.c) $(POBJS) -o $@ $(LDLIBS)
 162                 $(POST_PROCESS)
 163 
 164 $(XPG4) :       objs.xpg4 $$(POBJS)
 165                 $(LINK.c) $(POBJS) -o $@ $(LDLIBS)
 166                 $(POST_PROCESS)
 167 
 168 $(XPG6) :       objs.xpg6 $$(POBJS)
 169                 $(LINK.c) $(POBJS) -o $@ $(LDLIBS)
 170                 $(POST_PROCESS)
 171 
 172 objs.xpg6/%.o:          %.c
 173         $(COMPILE.c) -o $@ $<
 174 
 175 objs.xpg6:
 176         -@mkdir -p $@
 177 
 178 objs.xpg4/%.o:          %.c
 179         $(COMPILE.c) -o $@ $<
 180 
 181 objs.xpg4:
 182         -@mkdir -p $@
 183 
 184 objs.xpg4/values-xpg4.o:        ../../lib/crt/common/values-xpg4.c
 185         $(COMPILE.c) -o $@ ../../lib/crt/common/values-xpg4.c
 186 
 187 %.o:                    $(SRC)/common/util/%.c
 188         $(COMPILE.c) $(OUTPUT_OPTION) $<
 189         $(POST_PROCESS_O)
 190 
 191 objs.xpg4/%.o:  $(SRC)/common/util/%.c
 192         $(COMPILE.c) -o $@ $<
 193         $(POST_PROCESS_O)
 194 
 195 objs.xpg6/%.o:  $(SRC)/common/util/%.c
 196         $(COMPILE.c) -o $@ $<
 197         $(POST_PROCESS_O)
 198 
 199 att1.c :        att1.y
 200                 $(YACC.y) -d att1.y
 201                 $(MV) y.tab.c att1.c
 202                 $(MV) y.tab.h att1.h
 203 
 204 att2.c :        att2.l att2.ed att1.c
 205                 $(LEX) att2.l
 206                 ed - lex.yy.c < att2.ed
 207                 $(MV) lex.yy.c att2.c
 208 
 209 # Don't re-install directories installed by Targetdirs
 210 #$(ROOTDIRS):
 211 #               $(INS.dir)
 212 
 213 $(ROOTSYMLINK) :
 214                 $(RM) $@; $(SYMLINK) $(SYMLNKDEST) $@
 215 
 216 check:          $(CHKMANIFEST)
 217 
 218 $(POFILE):      $(POFILES)
 219         $(RM) $@; cat $(POFILES) > $@
 220 
 221 clean :
 222                 $(RM) $(OBJS) att1.h att1.c att2.c
 223 
 224 lint :          lint_SRCS
 225 
 226 strip :
 227                 $(STRIP) $(PROG) $(XPG4) $(XPG6)
 228 
 229 include         ../Makefile.targ