xref: /titanic_51/usr/src/cmd/cron/Makefile (revision 43369e138469651f508b1edd3512f007d1545665)
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
29DEFAULTFILES =	cron.dfl
30
31include		../Makefile.cmd
32
33MANIFEST =	cron.xml
34
35ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
36ROOTMETHOD =	$(ROOTLIBSVCMETHOD)/svc-cron
37
38CPPFLAGS +=	-D_FILE_OFFSET_BITS=64
39
40ROOTVAR =	$(ROOT)/var
41
42ROOTSPCRON =	$(ROOTVAR)/spool/cron
43ROOTCROND =	$(ROOTETC)/cron.d
44ROOTCRONTABS =	$(ROOTSPCRON)/crontabs
45ROOTATJOBS =	$(ROOTSPCRON)/atjobs
46ROOTLIBCRON =	$(ROOTLIB)/cron
47
48PROG1 =		cron
49PROG2 =		at atq atrm crontab
50XPG4PROG =	at
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		$(XPG4PROG:%=$(ROOTXPG4BIN)/%) \
66		$(XPG4SCRIPT:%.xpg4=$(ROOTXPG4BIN)/%)
67
68ROOTSYMLINK =	$(ROOTLIBCRON) $(ROOTETC)/cron
69
70COMMONOBJ1=	permit.o
71COMMONOBJ2=	funcs.o
72COMMONOBJS=	$(COMMONOBJ1) $(COMMONOBJ2)
73CRONOBJS=	cron.o elm.o
74ATOBJS=		at.o att1.o att2.o
75XPG4OBJS=	values-xpg4.o
76ATRMOBJS=	atrm.o
77ATQOBJS=	atq.o
78CRONTABOBJS=	crontab.o
79
80XPG4ATOBJS=	$(ATOBJS:%=atobjs.xpg4/%) $(COMMONOBJS:%=atobjs.xpg4/%) \
81		$(XPG4OBJS:%=atobjs.xpg4/%)
82
83cron :=		POBJS = $(CRONOBJS) $(COMMONOBJ2)
84at :=		POBJS = $(ATOBJS) $(COMMONOBJS)
85at.xpg4 :=	POBJS = $(XPG4ATOBJS)
86atrm :=		POBJS = $(ATRMOBJS) $(COMMONOBJS)
87atq :=		POBJS = $(ATQOBJS) $(COMMONOBJS)
88crontab :=	POBJS = crontab.o $(COMMONOBJS)
89
90at.o atobjs.xpg4/at.o funcs.o permit.o crontab.o elm.o := CFLAGS += $(CCVERBOSE)
91
92XPG4POBJS =	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
95NOBJS=		$(CRONOBJS) $(ATOBJS) $(ATRMOBJS) $(ATQOBJS) $(CRONTABOBJS) \
96		$(COMMONOBJS)
97OBJS =		$(NOBJS) $(XPG4ATOBJS)
98SRCS =		$(NOBJS:%.o=%.c)
99
100CLOBBERFILES +=	$(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
123LDLIBS +=	-lbsm
124
125at :=		LDLIBS += -lproject -lsecdb
126at.xpg4 :=	LDLIBS += -lproject -lsecdb
127atq :=		LDLIBS += -lsecdb
128atrm :=		LDLIBS += -lsecdb
129cron :=		LDLIBS += -lcmd -lpam -lproject -lcontract
130crontab :=	LDLIBS += -lsecdb -lpam
131
132lint :=		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
147all :		$(PROG) $(XPG4) $(SCRIPT) $(XPG4SCRIPT) $(FILES)
148
149install :	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
160atobjs.xpg4/%.o:	%.c
161	$(COMPILE.c) -o $@ $<
162
163atobjs.xpg4:
164	-@mkdir -p $@
165
166atobjs.xpg4/values-xpg4.o:	../../lib/common/common/values-xpg4.c
167	$(COMPILE.c) -o $@ ../../lib/common/common/values-xpg4.c
168
169att1.c :	att1.y
170		$(YACC.y) -d att1.y
171		$(MV) y.tab.c att1.c
172		$(MV) y.tab.h att1.h
173
174att2.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
186check:		$(CHKMANIFEST)
187
188$(POFILE):	$(POFILES)
189	$(RM) $@; cat $(POFILES) > $@
190
191clean :
192		$(RM) $(OBJS) att1.h att1.c att2.c
193
194lint :		lint_SRCS
195
196strip :
197		$(STRIP) $(PROG) $(XPG4)
198
199include		../Makefile.targ
200