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