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