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