xref: /titanic_52/usr/src/cmd/cron/Makefile (revision d2117003c7d0588abeea5ed1b925b77f025e2c96)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24 # Use is subject to license terms.
25 #
26 # ident	"%Z%%M%	%I%	%E% SMI"
27 #
28 
29 DEFAULTFILES =	cron.dfl
30 
31 include		../Makefile.cmd
32 
33 MANIFEST =	cron.xml
34 
35 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
36 ROOTMETHOD =	$(ROOTLIBSVCMETHOD)/svc-cron
37 
38 CPPFLAGS +=	-D_FILE_OFFSET_BITS=64
39 
40 ROOTVAR =	$(ROOT)/var
41 
42 ROOTSPCRON =	$(ROOTVAR)/spool/cron
43 ROOTCROND =	$(ROOTETC)/cron.d
44 ROOTCRONTABS =	$(ROOTSPCRON)/crontabs
45 ROOTATJOBS =	$(ROOTSPCRON)/atjobs
46 ROOTLIBCRON =	$(ROOTLIB)/cron
47 
48 PROG1 =		cron
49 PROG2 =		at atq atrm crontab
50 XPG4PROG =	at
51 PROG =		$(PROG1) $(PROG2)
52 
53 SCRIPT =	batch
54 XPG4SCRIPT =	batch.xpg4
55 
56 POFILE=		$(PROG1)_cmd.po
57 POFILES=	at.po crontab.po funcs.po batch.po
58 XGETFLAGS=	-a -x $(PROG1).xcl
59 
60 ROOTDIRS =	$(ROOTSPCRON) $(ROOTCROND) \
61 		$(ROOTCRONTABS) $(ROOTATJOBS)
62 
63 ROOTPROG =	$(PROG1:%=$(ROOTUSRSBIN)/%) $(PROG2:%=$(ROOTBIN)/%)	\
64 		$(SCRIPT:%=$(ROOTBIN)/%) \
65 		$(XPG4PROG:%=$(ROOTXPG4BIN)/%) \
66 		$(XPG4SCRIPT:%.xpg4=$(ROOTXPG4BIN)/%)
67 
68 ROOTSYMLINK =	$(ROOTLIBCRON) $(ROOTETC)/cron
69 
70 COMMONOBJ1=	permit.o
71 COMMONOBJ2=	funcs.o
72 COMMONOBJS=	$(COMMONOBJ1) $(COMMONOBJ2)
73 CRONOBJS=	cron.o elm.o
74 ATOBJS=		at.o att1.o att2.o
75 XPG4OBJS=	values-xpg4.o
76 ATRMOBJS=	atrm.o
77 ATQOBJS=	atq.o
78 CRONTABOBJS=	crontab.o
79 
80 XPG4ATOBJS=	$(ATOBJS:%=atobjs.xpg4/%) $(COMMONOBJS:%=atobjs.xpg4/%) \
81 		$(XPG4OBJS:%=atobjs.xpg4/%)
82 
83 cron :=		POBJS = $(CRONOBJS) $(COMMONOBJ2)
84 at :=		POBJS = $(ATOBJS) $(COMMONOBJS)
85 at.xpg4 :=	POBJS = $(XPG4ATOBJS)
86 atrm :=		POBJS = $(ATRMOBJS) $(COMMONOBJS)
87 atq :=		POBJS = $(ATQOBJS) $(COMMONOBJS)
88 crontab :=	POBJS = crontab.o $(COMMONOBJS)
89 
90 at.o atobjs.xpg4/at.o funcs.o permit.o crontab.o elm.o := CFLAGS += $(CCVERBOSE)
91 
92 XPG4POBJS =	atobjs.xpg4/at.o atobjs.xpg4/att1.o		\
93 		atobjs.xpg4/att2.o atobjs.xpg4/funcs.o			\
94 		atobjs.xpg4/permit.o atobjs.xpg4/values-xpg4.o
95 NOBJS=		$(CRONOBJS) $(ATOBJS) $(ATRMOBJS) $(ATQOBJS) $(CRONTABOBJS) \
96 		$(COMMONOBJS)
97 OBJS =		$(NOBJS) $(XPG4ATOBJS)
98 SRCS =		$(NOBJS:%.o=%.c)
99 
100 CLOBBERFILES +=	$(SCRIPT) $(XPG4SCRIPT)
101 
102 $(ROOTLIBCRON) :=		SYMLNKDEST = ../../etc/cron.d
103 $(ROOTETC)/cron :=		SYMLNKDEST = ../usr/sbin/cron
104 
105 $(ROOTBIN)/at :=		FILEMODE = 04755
106 $(ROOTBIN)/at :=		OWNER = root
107 $(ROOTBIN)/at :=		GROUP = sys
108 $(ROOTXPG4BIN)/at :=		FILEMODE = 04755
109 $(ROOTXPG4BIN)/at :=		OWNER = root
110 $(ROOTXPG4BIN)/at :=		GROUP = sys
111 $(ROOTBIN)/atrm :=		FILEMODE = 04755
112 $(ROOTBIN)/atrm :=		OWNER = root
113 $(ROOTBIN)/atrm :=		GROUP = sys
114 $(ROOTBIN)/atq :=		FILEMODE = 04755
115 $(ROOTBIN)/atq :=		OWNER = root
116 $(ROOTBIN)/atq :=		GROUP = sys
117 $(ROOTBIN)/crontab :=		FILEMODE = 04555
118 $(ROOTBIN)/crontab :=		OWNER = root
119 $(ROOTUSRSBIN)/cron :=		FILEMODE = 0555
120 $(ROOTUSRSBIN)/cron :=		OWNER = root
121 $(ROOTUSRSBIN)/cron :=		GROUP = sys
122 
123 LDLIBS +=	-lbsm
124 
125 at :=		LDLIBS += -lproject -lsecdb
126 at.xpg4 :=	LDLIBS += -lproject -lsecdb
127 atq :=		LDLIBS += -lsecdb
128 atrm :=		LDLIBS += -lsecdb
129 cron :=		LDLIBS += -lcmd -lpam -lproject -lcontract
130 crontab :=	LDLIBS += -lsecdb -lpam
131 
132 lint :=		LDLIBS += -lproject -lsecdb -lcontract -lpam
133 
134 $(XPG4) := CFLAGS += -DXPG4
135 
136 $(ROOTSVCSYSTEM)/cron.xml := OWNER = root
137 $(ROOTSVCSYSTEM)/cron.xml := GROUP = sys
138 $(ROOTSVCSYSTEM)/cron.xml := FILEMODE = 0444
139 
140 $(ROOTLIBSVCMETHOD)/svc-cron := OWNER = root
141 $(ROOTLIBSVCMETHOD)/svc-cron := GROUP = bin
142 $(ROOTLIBSVCMETHOD)/svc-cron := FILEMODE = 0555
143 
144 
145 .KEEP_STATE:
146 
147 all :		$(PROG) $(XPG4) $(SCRIPT) $(XPG4SCRIPT) $(FILES)
148 
149 install :	all $(ROOTPROG) $(ROOTETCDEFAULTFILES) $(ROOTSYMLINK) \
150 		$(ROOTMANIFEST) $(ROOTMETHOD)
151 
152 $(PROG) :	$$(POBJS)
153 		$(LINK.c) $(POBJS) -o $@ $(LDLIBS)
154 		$(POST_PROCESS)
155 
156 $(XPG4) :	atobjs.xpg4 $(XPG4POBJS)
157 		$(LINK.c) $(XPG4POBJS) -o $@ $(LDLIBS)
158 		$(POST_PROCESS)
159 
160 atobjs.xpg4/%.o:	%.c
161 	$(COMPILE.c) -o $@ $<
162 
163 atobjs.xpg4:
164 	-@mkdir -p $@
165 
166 atobjs.xpg4/values-xpg4.o:	../../lib/common/common/values-xpg4.c
167 	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
168 
169 att1.c :	att1.y
170 		$(YACC.y) -d att1.y
171 		$(MV) y.tab.c att1.c
172 		$(MV) y.tab.h att1.h
173 
174 att2.c :	att2.l att2.ed att1.c
175 		$(LEX) att2.l
176 		ed - lex.yy.c < att2.ed
177 		$(MV) lex.yy.c att2.c
178 
179 # Don't re-install direcories installed by Targetdirs
180 #$(ROOTDIRS):
181 #		$(INS.dir)
182 
183 $(ROOTSYMLINK) :
184 		$(RM) $@; $(SYMLINK) $(SYMLNKDEST) $@
185 
186 check:		$(CHKMANIFEST)
187 
188 $(POFILE):	$(POFILES)
189 	$(RM) $@; cat $(POFILES) > $@
190 
191 clean :
192 		$(RM) $(OBJS) att1.h att1.c att2.c
193 
194 lint :		lint_SRCS
195 
196 strip :
197 		$(STRIP) $(PROG) $(XPG4)
198 
199 include		../Makefile.targ
200