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