-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile.in
334 lines (275 loc) · 12.2 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
############################
# fcron's Makefile ########
############################
# @configure_input@
# The following should not be edited manually (use configure options)
# If you must do it, BEWARE : some of the following is also defined
# in config.h, so you must modify config.h AND Makefile in order
# to set the same values in the two files.
# Please, keep assignments aligned with spaces.
FCRON_ALLOW = fcron.allow
FCRON_DENY = fcron.deny
FCRON_CONF = fcron.conf
SRCDIR := @srcdir@
# Useful to build packages
# you may want to use this var with a : 'make DESTDIR=dir install'
DESTDIR :=
# Where should we install it ?
prefix = @prefix@
exec_prefix = @exec_prefix@
DESTSBIN = @sbindir@
DESTBIN = @bindir@
ETC = @sysconfdir@
FCRONTABS = @FCRONTABS@
PIDDIR = @PIDDIR@
FIFODIR = @FIFODIR@
PIDFILE = @PIDFILE@
REBOOT_LOCK = @REBOOT_LOCK@
SUSPEND_FILE = @SUSPEND_FILE@
FIFOFILE = @FIFOFILE@
FCRON_SHELL = @FCRON_SHELL@
SENDMAIL = @SENDMAIL@
FCRON_EDITOR = @FCRON_EDITOR@
OPTIM := @CFLAGS@
LDFLAGS := @LDFLAGS@
CPPFLAGS := @CPPFLAGS@ -I. -I${SRCDIR}
LIBS := @LIBS@
LIBOBJS := @LIBOBJS@
DEFS := @DEFS@
CC := @CC@
INSTALL := @INSTALL@
STRIP := @STRIP@
ROOTNAME := @ROOTNAME@
ROOTGROUP := @ROOTGROUP@
USERNAME := @USERNAME@
GROUPNAME := @GROUPNAME@
SYSFCRONTAB := @SYSFCRONTAB@
DEBUG := @DEBUG@
BOOTINSTALL := @BOOTINSTALL@
ANSWERALL := @ANSWERALL@
USEPAM := @USEPAM@
FCRONDYN := @FCRONDYN@
SYSTEMD_DIR := @SYSTEMD_DIR@
MAILDISPLAYNAME := @MAILDISPLAYNAME@
# Options
# -DDEBUG even more verbose
# -DCHECKJOBS send a mail containing the exact shell command
# for each execution of each job.
# -DFOREGROUND=[0|1] default run in foreground ?
#OPTION = -DCHECKJOBS
#OPTION = -O3 -mcpu=i686
OPTION :=
####################################
# Should not be changed under this #
####################################
VERSION := @VERSION@
CFLAGS += $(OPTIM) $(OPTION) $(DEFS) $(CPPFLAGS) $(LDFLAGS)
ifeq ($(FCRONDYN), 1)
LIBOBJS := $(LIBOBJS)
endif
OBJSD := fcron.o cl.o subs.o mem.o save.o temp_file.o log.o database.o job.o conf.o u_list.o exe_list.o lavg_list.o env_list.o fcronconf.o mail.o filesubs.o select.o fcrondyn_svr.o suspend.o $(LIBOBJS)
OBJSTAB := fcrontab.o cl.o subs.o mem.o save.o temp_file.o log.o fileconf.o allow.o read_string.o u_list.o env_list.o fcronconf.o mail.o filesubs.o
OBJSDYN := fcrondyn.o subs.o mem.o log.o allow.o read_string.o fcronconf.o mail.o filesubs.o
OBJCONV := convert-fcrontab.o cl.o subs.o mem.o save.o log.o u_list.o env_list.o fcronconf.o mail.o filesubs.o
OBJSIG := fcronsighup.o subs.o mem.o log.o allow.o fcronconf.o mail.o filesubs.o
HEADERSALL := config.h $(SRCDIR)/global.h $(SRCDIR)/cl.h $(SRCDIR)/log.h $(SRCDIR)/subs.h $(SRCDIR)/mem.h $(SRCDIR)/save.h $(SRCDIR)/option.h $(SRCDIR)/dyncom.h $(SRCDIR)/mail.h
# this is a regular expression :
# do not ci automaticaly generated files and doc (done by doc's Makefile)
RCSNOCI := .*\(.html\|VERSION\|MANIFEST\|configure\|install.sh\|config.log\|config.status\|config.h\|config.cache\|Makefile\|doc.*\|CVS.*\|.git.*\)
RUN_NON_PRIVILEGED := @RUN_NON_PRIVILEGED@
ifeq ($(RUN_NON_PRIVILEGED), 1)
BINMODE := 711
BINMODESIGHUP := 711
else
BINMODE := 6711
BINMODESIGHUP := 4710
endif
ifeq ($(FCRONDYN), 1)
all: fcron fcrontab fcrondyn convert-fcrontab files/fcron.conf initscripts documentation
else
all: fcron fcrontab convert-fcrontab files/fcron.conf initscripts documentation
endif
fcron: $(OBJSD)
$(CC) $(CFLAGS) -o $@ $(OBJSD) $(LIBS)
fcrontab: fcronsighup $(OBJSTAB)
$(CC) $(CFLAGS) -o $@ $(OBJSTAB) $(LIBS)
fcrondyn: $(OBJSDYN)
$(CC) $(CFLAGS) -o $@ $(OBJSDYN) $(LIBS)
fcronsighup: $(OBJSIG)
$(CC) $(CFLAGS) -o $@ $(OBJSIG) $(LIBS)
convert-fcrontab: $(OBJCONV)
$(CC) $(CFLAGS) -o $@ $(OBJCONV) $(LIBS)
exe_list_test: exe_list.o u_list.o exe_list_test.o log.o subs.o
$(CC) $(CFLAGS) -o $@ exe_list.o u_list.o exe_list_test.o log.o subs.o $(LIBS)
%.o: $(SRCDIR)/%.c $(HEADERSALL) $(SRCDIR)/%.h
$(CC) $(CFLAGS) -DPIDFILE="\"${PIDFILE}\"" -DREBOOT_LOCK="\"${REBOOT_LOCK}\"" \
-DSUSPEND_FILE="\"${SUSPEND_FILE}\"" -DFIFOFILE="\"${FIFOFILE}\"" -DETC="\"${ETC}\"" \
-DFCRON_SHELL="\"${FCRON_SHELL}\"" -DFCRON_CONF="\"${FCRON_CONF}\"" \
-DFCRONTABS="\"${FCRONTABS}\"" \
-DFCRON_ALLOW="\"${FCRON_ALLOW}\"" -DFCRON_DENY="\"${FCRON_DENY}\"" \
-DFCRON_SHELL="\"${FCRON_SHELL}\"" -DSENDMAIL="\"${SENDMAIL}\"" \
-DFCRON_EDITOR="\"${FCRON_EDITOR}\"" \-DMAILDISPLAYNAME="\"${MAILDISPLAYNAME}\"" -DBINDIREX="\"${DESTBIN}\"" \
-c $<
initscripts:
@(if test ! -d script; then mkdir script ; fi ; \
for F in sysVinit-launcher fcron.sh fcron.init.suse fcron.init.systemd fcron.init.systemd.reboot fcron.suspend.sh ; do \
$(SRCDIR)/script/gen-in.pl $(SRCDIR)/script/$${F}.in script/$${F} ./ ; \
done)
documentation:
$(MAKE) -C doc doc-if-none
.PHONY: test
test: fcron
$(MAKE) -C test tests
install: install-staged strip perms
ifeq ($(BOOTINSTALL), 1)
$(SRCDIR)/script/boot-install "$(INSTALL) -o $(ROOTNAME)" $(DESTSBIN) $(DEBUG) $(FCRONTABS) $(ANSWERALL) $(SRCDIR)
endif
ifneq ($(SYSTEMD_DIR), no)
if test ! -d $(DESTDIR)$(SYSTEMD_DIR); then $(INSTALL) -m 755 -d $(DESTDIR)$(SYSTEMD_DIR) ; fi
$(INSTALL) -m 644 script/fcron.init.systemd $(DESTDIR)$(SYSTEMD_DIR)/fcron.service
$(INSTALL) -m 644 script/fcron.init.systemd.reboot $(DESTDIR)$(SYSTEMD_DIR)/fcronreboot.service
systemctl daemon-reload
endif
install-staged: all
# needed by boot-install script :
echo `fcron -V 2>&1 | grep "^fcron "` > PREVIOUS_VERSION && chmod a+rw PREVIOUS_VERSION
$(SRCDIR)/script/user-group $(USERNAME) $(GROUPNAME) $(ANSWERALL) $(SRCDIR)
# check if the directories we use exist, and if not, create them
if test ! -d $(DESTDIR)$(DESTSBIN); then $(INSTALL) -m 755 -d $(DESTDIR)$(DESTSBIN) ; fi
if test ! -d $(DESTDIR)$(DESTBIN); then $(INSTALL) -m 755 -d $(DESTDIR)$(DESTBIN) ; fi
if test ! -d $(DESTDIR)$(ETC); then $(INSTALL) -m 755 -d $(DESTDIR)$(ETC) ; fi
if test ! -d $(DESTDIR)$(PIDDIR); then $(INSTALL) -m 755 -d $(DESTDIR)$(PIDDIR) ; fi
if test ! -d $(DESTDIR)$(FIFODIR); then $(INSTALL) -m 755 -d $(DESTDIR)$(FIFODIR) ; fi
# create the spool dir
$(INSTALL) -m 755 -d $(DESTDIR)$(FCRONTABS)
$(INSTALL) -m 755 fcron $(DESTDIR)$(DESTSBIN)
$(INSTALL) -m 755 fcrontab $(DESTDIR)$(DESTBIN)
$(INSTALL) -m 755 fcronsighup $(DESTDIR)$(DESTBIN)
ifeq ($(FCRONDYN), 1)
$(INSTALL) -m 755 fcrondyn $(DESTDIR)$(DESTBIN)
endif
if test ! -f $(DESTDIR)$(ETC)/fcron.allow -a ! -f $(DESTDIR)$(ETC)/fcron.deny ; then $(INSTALL) -m 644 $(SRCDIR)/files/fcron.allow $(DESTDIR)$(ETC) ; $(INSTALL) -m 644 $(SRCDIR)/files/fcron.deny $(DESTDIR)$(ETC) ; fi
test -f $(DESTDIR)$(ETC)/fcron.conf || $(INSTALL) -m 644 files/fcron.conf $(DESTDIR)$(ETC)
$(MAKE) -C doc install-staged
perms: install-staged strip
# Note : we don't use "chown user:group file" because some systems use ":"
# and others "." as separator.
chown $(ROOTNAME) $(DESTDIR)$(DESTSBIN)
chgrp $(ROOTGROUP) $(DESTDIR)$(DESTSBIN)
chown $(ROOTNAME) $(DESTDIR)$(DESTBIN)
chgrp $(ROOTGROUP) $(DESTDIR)$(DESTBIN)
chown $(ROOTNAME) $(DESTDIR)$(ETC)
chgrp $(ROOTGROUP) $(DESTDIR)$(ETC)
chown $(ROOTNAME) $(DESTDIR)$(FIFODIR)
chgrp $(ROOTGROUP) $(DESTDIR)$(FIFODIR)
chown $(ROOTNAME) $(DESTDIR)$(PIDDIR)
chgrp $(ROOTGROUP) $(DESTDIR)$(PIDDIR)
# change spool dir mode
chown $(USERNAME) $(DESTDIR)$(FCRONTABS)
chgrp $(GROUPNAME) $(DESTDIR)$(FCRONTABS)
chmod 770 $(DESTDIR)$(FCRONTABS)
chown $(ROOTNAME) $(DESTDIR)$(DESTSBIN)/fcron
chgrp $(ROOTGROUP) $(DESTDIR)$(DESTSBIN)/fcron
chmod 710 $(DESTDIR)$(DESTSBIN)/fcron
chown $(USERNAME) $(DESTDIR)$(DESTBIN)/fcrontab
chgrp $(GROUPNAME) $(DESTDIR)$(DESTBIN)/fcrontab
chmod $(BINMODE) $(DESTDIR)$(DESTBIN)/fcrontab
chown $(ROOTNAME) $(DESTDIR)$(DESTBIN)/fcronsighup
chgrp $(GROUPNAME) $(DESTDIR)$(DESTBIN)/fcronsighup
chmod $(BINMODESIGHUP) $(DESTDIR)$(DESTBIN)/fcronsighup
ifeq ($(FCRONDYN), 1)
chown $(USERNAME) $(DESTDIR)$(DESTBIN)/fcrondyn
chgrp $(GROUPNAME) $(DESTDIR)$(DESTBIN)/fcrondyn
chmod $(BINMODE) $(DESTDIR)$(DESTBIN)/fcrondyn
endif
chown $(ROOTNAME) $(DESTDIR)$(ETC)/fcron.allow $(DESTDIR)$(ETC)/fcron.deny
chgrp $(GROUPNAME) $(DESTDIR)$(ETC)/fcron.allow $(DESTDIR)$(ETC)/fcron.deny
chmod 640 $(DESTDIR)$(ETC)/fcron.allow $(DESTDIR)$(ETC)/fcron.deny
chown $(ROOTNAME) $(DESTDIR)$(ETC)/fcron.conf
chgrp $(GROUPNAME) $(DESTDIR)$(ETC)/fcron.conf
chmod 640 $(DESTDIR)$(ETC)/fcron.conf
ifeq ($(USEPAM), 1)
$(SRCDIR)/script/install-pam-conf $(SRCDIR) $(DESTDIR)$(ETC) $(ROOTNAME) $(ROOTGROUP) "$(INSTALL)"
endif
# in order to get correct rights when upgrading :
find $(DESTDIR)$(FCRONTABS) -type f \( -name "*.orig" -a ! -name "$(ROOTNAME).orig" -a ! -name "$(SYSFCRONTAB).orig" \) -exec chown $(USERNAME) {} \; -exec chgrp $(GROUPNAME) {} \; -exec chmod 640 {} \;
find $(DESTDIR)$(FCRONTABS) -type f \( -name "$(ROOTNAME).orig" -o -name "$(SYSFCRONTAB).orig" \) -exec chown $(ROOTNAME) {} \; -exec chgrp $(GROUPNAME) {} \; -exec chmod 600 {} \;
# First, remove the potential fcrontab.sig, or it could not get removed by fcronsighup if it becomes root:root 600
rm -f $(DESTDIR)$(FCRONTABS)/fcrontab.sig
find $(DESTDIR)$(FCRONTABS) -type f ! -name "*.orig" -exec chown $(ROOTNAME) {} \; -exec chgrp $(ROOTGROUP) {} \; -exec chmod 600 {} \;
$(MAKE) -C doc perms
# strip executables
strip: install-staged
ifneq ($(DEBUG), 1)
$(STRIP) $(DESTDIR)$(DESTSBIN)/fcron
$(STRIP) $(DESTDIR)$(DESTBIN)/fcrontab
$(STRIP) $(DESTDIR)$(DESTBIN)/fcronsighup
ifeq ($(FCRONDYN), 1)
$(STRIP) $(DESTDIR)$(DESTBIN)/fcrondyn
endif
endif
install-boot: install
$(SRCDIR)/script/boot-install "$(INSTALL) -o $(ROOTNAME)" $(DESTSBIN) $(DEBUG) $(FCRONTABS) $(ANSWERALL) $(SRCDIR)
install-restart: install
ifeq ($(DEBUG), 1)
kill -TERM `pidof fcron` || exit 0
service fcron restart
endif
uninstall:
rm -f $(DESTDIR)$(DESTSBIN)/fcron
rm -f $(DESTDIR)$(DESTBIN)/fcrontab
rm -f $(DESTDIR)$(DESTBIN)/fcronsighup
rm -f $(DESTDIR)$(DESTBIN)/fcrondyn
$(MAKE) -C doc uninstall
$(SRCDIR)/script/boot-uninstall
clean:
rm -f *.o core
rm -f fcron fcrontab fcrondyn fcronsighup convert-fcrontab files/fcron.conf
$(MAKE) -C doc clean
$(MAKE) -C test clean
ciclean: clean
find ./ -name "*~" -exec rm -f {} \;
rm -fR autom4te*
vclean: ciclean
rm -f config.log config.status config.h config.cache Makefile PREVIOUS_VERSION \
files/fcron.conf script/fcron.init.suse script/fcron.init.systemd script/fcron.init.systemd.reboot \
script/fcron.sh script/sysVinit-launcher
$(MAKE) -C doc clean
$(MAKE) -C test clean
files/fcron.conf: $(SRCDIR)/files/fcron.conf.in config.h
if test ! -d files; then mkdir files ; fi
$(SRCDIR)/script/gen-in.pl $(SRCDIR)/files/fcron.conf.in files/fcron.conf ./
updatedoc:
$(MAKE) -C doc doc
indent:
indent -linux -i4 --no-tabs --leave-optional-blank-lines \
--start-left-side-of-comments --procnames-start-lines \
--dont-cuddle-else *.c *.h
configure: configure.in
# update configure script, then Makefile and config.h, and finally
# run make tar using the new Makefile (needed because the version
# is set in the configure.in file)
autoconf
./configure
@($(MAKE) tar && \
echo "---------------------------------------------" && \
echo "Success !" && \
echo "(Please ignore the following make error" && \
echo " and run your latest make command again)" && \
echo "---------------------------------------------" && \
exit 999)
ci: ciclean
# the symbolic links verX_X_X has been created since version 2.9.4
@(find ./ -type f ! -regex '.*RCS.*' ! -regex "$(RCSNOCI)" \
-exec ci -l -Nver`echo $(VERSION) | tr '.' '_'` {} \;)
# ci the doc files
$(MAKE) -C doc ci
tar: configure updatedoc vclean ciclean
echo $(VERSION) > ./VERSION
$(MAKE) -C doc tarclean
@(find ./ -type f ! -regex '.*RCS.*' ! -regex '.*CVS.*' ! -regex '.*\.git.*' ! -regex '.*debug/.*'| \
sed -e "s:^\./:fcron-$(VERSION)/:" > MANIFEST)
@(cd ..; ln -s fcron fcron-$(VERSION))
(cd ..; tar -czvf fcron-$(VERSION).src.tar.gz `cat fcron/MANIFEST`)
@(cd ..; rm -f fcron-$(VERSION))
@(cd ..; mv -f fcron-$(VERSION).src.tar.gz old-fcron-pkg/)