Makefile 19.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id$
# Copyright (c) 2012 by Daniel Armbruster 
# ----
# This file is part of csback.
# 
# csback is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# csback is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with csback.  If not, see <http://www.gnu.org/licenses/>.
# ----
# Daniel Armbruster 15/01/2012
# 
# REVISIONS and CHANGES
# 15/01/2012	V0.1	Daniel Armbruster
25
# 16/01/2012  V0.2  added package rule
26
# 28/02/2012  V0.3  smaller modifications - added csbackobs.py
27
28
29
30
# 27/04/2012  V0.4  added lsYears.py - removed with V0.5 (deprecated)
# 13/02/2013  V0.5  added csbackresc.py and ssh/scp specific checks
# 14/02/2013  V0.6  added csclean.sh
# 28/02/2013  V0.7  added csbackscp.py
31
32
# 08/11/2013  V0.8  several csbackgen.py tests implemented which are related to
# 									the time exclusion commandline arguments 
33
#
34
# ----------------------------------------------------------------------------
35
PROGRAMS=csback2cron.py csbackntfy.py csbackgen.py csbackchk.py csbackobs.py \
36
	csbackresc.py csbackscp.py csclean.sh
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

.PHONY: all
all: install doc

.PHONY: install
install: installscripts

.PHONY: doc
doc: pdfdoc
  	
# ----------------------------------------------------------------------------
LOCBINDIR=~/bin
RSYNC=$(shell env which rsync)
CRON=$(shell ps -ef | grep -v grep | grep -cw cron)
SYSLOGNG=$(shell ps -ef | grep -v grep | grep -cw syslog)
52
LOGROTATE=$(shell if [ -d /etc/logrotate.d/ ]; then echo logrotate; fi)
53
PYTHON=$(shell env which python)
54
55
SSH=$(shell env which ssh)
SCP=$(shell env which scp)
56
57
58

# ----------------------------------------------------------------------------
.PHONY: clean
59
60
clean: 
	/bin/rm -rvf $(addprefix $(LOCBINDIR)/,$(patsubst %.py,%,$(PROGRAMS))) 
61
	/bin/rm -rvf $(addprefix $(LOCBINDIR)/,$(patsubst %.sh,%,$(PROGRAMS))) 
62
63
64
65
66
67
68
69
70
71
	$(MAKE) -C doc clean

# ----------------------------------------------------------------------------
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))

CHECKPROG=$(if $($(1)),,$(error ERROR: missing program $(1)))
CHECKPROGS=$(foreach prog,$(1),$(call CHECKPROG,$(prog)))

$(call CHECKVARS, LOCBINDIR)
72
$(call CHECKPROGS, RSYNC CRON SYSLOGNG LOGROTATE PYTHON SSH SCP)
73
74
75
76

# ----------------------------------------------------------------------------
PWD=$(shell env pwd)

77
78
79
$(addprefix $(LOCBINDIR)/, $(PROGRAMS)): $(addprefix $(PWD)/, $(PROGRAMS))

$(LOCBINDIR)/%: %.py
80
	mkdir -pv $(LOCBINDIR)
81
82
83
	ln -fs $(addprefix $(PWD)/,$<) $@
	chmod +x $(addprefix $(PWD)/,$<) 

84
85
86
87
88
89
90
$(LOCBINDIR)/%: %.sh
	mkdir -pv $(LOCBINDIR)
	ln -fs $(addprefix $(PWD)/,$<) $@
	chmod +x $(addprefix $(PWD)/,$<) 

installscripts: $(addprefix $(LOCBINDIR)/, $(patsubst %.py,%,$(PROGRAMS)) \
	$(patsubst %.sh,%,$(PROGRAMS)))
91

92
# ----------------------------------------------------------------------------
93
94
95
pdfdoc:
	$(MAKE) -C doc pdf

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
# ============================================================================
# create package
# --------------
# version code based on current date
VERSIONCODE=$(shell date +'%Y%m%d')
# name of the package (including version code)
THEPACKAGE=csback$(VERSIONCODE)
# directory to place temporary files in
TMPDIR=$(HOME)/tmp
# path where the package will be created
TMPPATH=$(TMPDIR)/$(THEPACKAGE)

# tar file
PACKAGETARFILE=$(THEPACKAGE).tar
# gzipped tar file
PACKAGEGZIPFILE=$(PACKAGETARFILE).gz
# bzipped tar file
PACKAGEBZIPFILE=$(PACKAGETARFILE).bz2

# list of README files to be obtained from the subversion repository
INFOFILESFROMSVNWITHPATH=src/LICENSE.GPL
# list of files to be created
INFOFILESFROMSVN=$(notdir $(INFOFILESFROMSVNWITHPATH))

DIRFROMSVNWITHPATH=src/python/csback
# list of files to be created
DIRFROMSVN=$(notdir $(DIRFROMSVNWITHPATH))

# rule for the creation of README files from the repository
$(addprefix $(TMPPATH)/,$(INFOFILESFROMSVN)):
	mkdir -pv $(dir $@)
	svn export \
	$(SVNTF)/trunk/$(filter %$(notdir $@),$(INFOFILESFROMSVNWITHPATH)) $@
	
# rule for the creation of csback files from the repository
$(addprefix $(TMPPATH)/,$(DIRFROMSVN)):
	mkdir -pv $(dir $@)
	svn export $(SVNTF)/trunk/$(filter %$(notdir $@),$(DIRFROMSVNWITHPATH)) $@

# create package tar archive
$(TMPDIR)/$(PACKAGETARFILE): $(TMPPATH)
	/bin/rm -fv $@
	cd $</..; tar cvf $@ $(notdir $<)
	/bin/rm -fv $(TMPDIR)/$(PACKAGEGZIPFILE) $(TMPDIR)/$(PACKAGEBZIPFILE)

# create compressed archives
$(TMPDIR)/$(PACKAGEGZIPFILE): $(TMPDIR)/$(PACKAGETARFILE)
	/bin/cp -vf $< $<.sik
	gzip -vf9 $<
	/bin/mv $<.sik $<
$(TMPDIR)/$(PACKAGEBZIPFILE): $(TMPDIR)/$(PACKAGETARFILE); bzip2 -vf9 $<

.PHONY: package
package:
	- /bin/rm -rvf $(TMPPATH) 
	$(MAKE) $(addprefix $(TMPPATH)/,$(INFOFILESFROMSVN)) 
	$(MAKE) $(addprefix $(TMPPATH)/,$(DIRFROMSVN)) 
	$(MAKE) -C $(TMPPATH)/$(DIRFROMSVN) doc
	$(MAKE) $(TMPDIR)/$(PACKAGEGZIPFILE) $(TMPDIR)/$(PACKAGEBZIPFILE)  
	/bin/mv -fv $(TMPDIR)/$(PACKAGEGZIPFILE) $(TMPDIR)/$(PACKAGEBZIPFILE) \
	$(TF_PUBLICATIONPATH) 
157

158
159
160
161
162
163
# ============================================================================
# tests
# --------------
# generate directory with sample files
TESTDIR=testdir
TESTRESULTDIR=testResults
164
165
TESTS=$(addprefix test, $(shell seq 0 13))

166
NOW=$(shell date +"%Y%m%d%H%M")
167
168
169
170
171
TWOMINUTESAGO=$(shell date --date "now 2 minutes ago" +"%Y%m%d%H%M") 
TWOANDHALFMINUTESAGO=$(shell date --date "now 2 minutes ago 30 seconds ago" \
										 +"%Y%m%d%H%M") 
THREEMINUTESAGO=$(shell date --date "now 3 minutes ago" +"%Y%m%d%H%M") 
FOURMINUTESAGO=$(shell date --date "now 4 minutes ago" +"%Y%m%d%H%M") 
172
HALFDAYAGO=$(shell date --date "now 12 hours ago" +"%Y%m%d%H%M") 
173
174
175
176
177
178
179
ONEDAYAGO=$(shell date --date "now 1 day ago" +"%Y%m%d%H%M") 
ONEDAYONEMINUTEAGO=$(shell date --date "now 1 day ago 1 minute ago" \
									 +"%Y%m%d%H%M") 
ONEDAYMINUSONEMINUTEAGO=$(shell date --date "now 23 hours ago 59 minutes ago" \
									 +"%Y%m%d%H%M") 
ONEDAYMINUSTWOMINUTESAGO=$(shell date --date "now 23 hours ago 58 minutes ago" \
									 +"%Y%m%d%H%M") 
180
TWODAYSAGO=$(shell date --date "now 2 days ago" +"%Y%m%d%H%M") 
181
THREEDAYSAGO=$(shell date --date "now 3 days ago" +"%Y%m%d%H%M") 
182

183
.PHONY: testclean
184
185
186
187
188
189
190
191
192
193
194
195
196
197
testclean: 
	rm -rfv $(TESTDIR)
	rm -rfv $(TESTRESULTDIR)

.PHONY: $(TESTDIR)
$(TESTDIR):
	mkdir -pv $@
$(TESTRESULTDIR):
	mkdir -pv $@

$(TESTDIR)/now: $(TESTDIR)
	touch -t $(NOW) $@
$(TESTDIR)/halfDayAgo: $(TESTDIR)
	touch -t $(HALFDAYAGO) $@
198
199
200
201
202
203
204
205
$(TESTDIR)/twoMinutesAgo: $(TESTDIR)
	touch -t $(TWOMINUTESAGO) $@
$(TESTDIR)/threeMinutesAgo: $(TESTDIR)
	touch -t $(THREEMINUTESAGO) $@
$(TESTDIR)/twoAndHalfMinutesAgo: $(TESTDIR)
	touch -t $(TWOANDHALFMINUTESAGO) $@
$(TESTDIR)/fourMinutesAgo: $(TESTDIR)
	touch -t $(FOURMINUTESAGO) $@
206
207
208
209
$(TESTDIR)/oneDayAgo: $(TESTDIR)
	touch -t $(ONEDAYAGO) $@
$(TESTDIR)/twoDaysAgo: $(TESTDIR)
	touch -t $(TWODAYSAGO) $@
210
211
212
213
214
215
216
217
$(TESTDIR)/threeDaysAgo: $(TESTDIR)
	touch -t $(THREEDAYSAGO) $@
$(TESTDIR)/oneDayOneMinuteAgo: $(TESTDIR)
	touch -t $(ONEDAYONEMINUTEAGO) $@
$(TESTDIR)/oneDayMinusOneMinuteAgo: $(TESTDIR)
	touch -t $(ONEDAYMINUSONEMINUTEAGO) $@
$(TESTDIR)/oneDayMinusTwoMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYMINUSTWOMINUTESAGO) $@
218
219

.PHONY: testEnv
220
221
222
223
testEnv: $(addprefix $(TESTDIR)/, now halfDayAgo oneDayAgo twoDaysAgo \
	oneDayOneMinuteAgo oneDayMinusOneMinuteAgo oneDayMinusTwoMinutesAgo \
	threeDaysAgo twoMinutesAgo threeMinutesAgo fourMinutesAgo \
	twoAndHalfMinutesAgo)
224

225
tests: $(TESTS)
226

227
testlst: $(addprefix $(TESTRESULTDIR)/, $(addsuffix .result, $(TESTS)))
228
229
230
231
232
	@echo -ne "----\n"
	@cat $^
	

%.result: %.csbackgen.result %.find.result 
233
234
235
236
ifeq ($(CONFIG),"")
	$(warning WARNING: Variable CONFIG not set.)
	$(eval CONFIG:=$(shell echo "undefined"))
endif
237
238
	testID="$(shell basename -s .result $@ | tr -d '[:alpha:]')"; \
	if [ -z "$(shell diff $^)" ]; then \
239
		echo "TEST $${testID}: OK    ($(CONFIG))" > $@; \
240
	else \
241
		echo "TEST $${testID}: ERROR ($(CONFIG))" > $@; \
242
243
	fi

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
test0: $(TESTRESULTDIR)/test0.result
$(TESTRESULTDIR)/test0.result: $(TESTRESULTDIR)/test0.csbackgen.result \
	$(TESTRESULTDIR)/test0.find.result 
$(TESTRESULTDIR)/test0.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mtime 0"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime 0"))
	@echo -ne "----\n"
	@echo -ne "TEST 0: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test0.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@

259
260
261
262
test1: $(TESTRESULTDIR)/test1.result
$(TESTRESULTDIR)/test1.result: $(TESTRESULTDIR)/test1.csbackgen.result \
	$(TESTRESULTDIR)/test1.find.result 
$(TESTRESULTDIR)/test1.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
263
264
	$(eval CONFIG:= $(shell echo "--mtime 1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime 1"))
265
	@echo -ne "----\n"
266
	@echo -ne "TEST 1: $(CONFIG)\n"
267
	@echo -ne "----\n"
268
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
269
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
270
271
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | \
		sort | grep -v -e "checksumfile.cs" > $@
272
$(TESTRESULTDIR)/test1.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
273
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
274
275
276
277
278

test2: $(TESTRESULTDIR)/test2.result 
$(TESTRESULTDIR)/test2.result: $(TESTRESULTDIR)/test2.csbackgen.result \
	$(TESTRESULTDIR)/test2.find.result 
$(TESTRESULTDIR)/test2.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
279
280
	$(eval CONFIG:= $(shell echo "--mtime -1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime -1"))
281
	@echo -ne "----\n"
282
	@echo -ne "TEST 2: $(CONFIG)\n"
283
	@echo -ne "----\n"
284
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
285
286
287
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test2.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
288
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
289
290
291
292
293

test3: $(TESTRESULTDIR)/test3.result 
$(TESTRESULTDIR)/test3.result: $(TESTRESULTDIR)/test3.csbackgen.result \
	$(TESTRESULTDIR)/test3.find.result 
$(TESTRESULTDIR)/test3.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
294
295
	$(eval CONFIG:= $(shell echo "--mtime +1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime +1"))
296
	@echo -ne "----\n"
297
	@echo -ne "TEST 3: $(CONFIG)\n"
298
	@echo -ne "----\n"
299
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
300
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
301
302
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | \
		sort | grep -v -e "checksumfile.cs" > $@
303
$(TESTRESULTDIR)/test3.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
304
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
305
306
307
308
309

test4: $(TESTRESULTDIR)/test4.result 
$(TESTRESULTDIR)/test4.result: $(TESTRESULTDIR)/test4.csbackgen.result \
	$(TESTRESULTDIR)/test4.find.result 
$(TESTRESULTDIR)/test4.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
310
311
	$(eval CONFIG:= $(shell echo "--mtime +1 --mtime -3"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime +1 -mtime -3"))
312
	@echo -ne "----\n"
313
	@echo -ne "TEST 4: $(CONFIG)\n"
314
	@echo -ne "----\n"
315
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
316
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
317
318
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
319
$(TESTRESULTDIR)/test4.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
320
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
321

322
323
324
325
# --daystart related tests
test5: $(TESTRESULTDIR)/test5.result 
$(TESTRESULTDIR)/test5.result: $(TESTRESULTDIR)/test5.csbackgen.result \
	$(TESTRESULTDIR)/test5.find.result 
326
$(TESTRESULTDIR)/test5.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
327
328
	$(eval CONFIG:= $(shell echo "--daystart --mtime 0"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime 0"))
329
	@echo -ne "----\n"
330
	@echo -ne "TEST 5: $(CONFIG)\n"
331
	@echo -ne "----\n"
332
333
334
335
336
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test5.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@
337

338
339
340
test6: $(TESTRESULTDIR)/test6.result 
$(TESTRESULTDIR)/test6.result: $(TESTRESULTDIR)/test6.csbackgen.result \
	$(TESTRESULTDIR)/test6.find.result 
341
$(TESTRESULTDIR)/test6.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
	$(eval CONFIG:= $(shell echo "--daystart --mtime 1"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime 1"))
	@echo -ne "----\n"
	@echo -ne "TEST 6: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test6.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test7: $(TESTRESULTDIR)/test7.result 
$(TESTRESULTDIR)/test7.result: $(TESTRESULTDIR)/test7.csbackgen.result \
	$(TESTRESULTDIR)/test7.find.result 
$(TESTRESULTDIR)/test7.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--daystart --mtime -2"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime -2"))
	@echo -ne "----\n"
	@echo -ne "TEST 7: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test7.find.result:  testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test8: $(TESTRESULTDIR)/test8.result 
$(TESTRESULTDIR)/test8.result: $(TESTRESULTDIR)/test8.csbackgen.result \
	$(TESTRESULTDIR)/test8.find.result 
$(TESTRESULTDIR)/test8.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--daystart --mtime +1"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime +1"))
	@echo -ne "----\n"
	@echo -ne "TEST 8: $(CONFIG)\n"
377
	@echo -ne "----\n"
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e 'checksumfile.cs' > $@
$(TESTRESULTDIR)/test8.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test9: $(TESTRESULTDIR)/test9.result 
$(TESTRESULTDIR)/test9.result: $(TESTRESULTDIR)/test9.csbackgen.result \
	$(TESTRESULTDIR)/test9.find.result 
$(TESTRESULTDIR)/test9.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--daystart --mtime +1 --mtime -3"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -mtime +1 -mtime -3"))
	@echo -ne "----\n"
	@echo -ne "TEST 9: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test9.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test10: $(TESTRESULTDIR)/test10.result 
$(TESTRESULTDIR)/test10.result: $(TESTRESULTDIR)/test10.csbackgen.result \
	$(TESTRESULTDIR)/test10.find.result 
$(TESTRESULTDIR)/test10.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin 3"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin 3"))
	@echo -ne "----\n"
	@echo -ne "TEST 10: $(CONFIG)\n"
409
	@echo -ne "----\n"
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test10.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test11: $(TESTRESULTDIR)/test11.result 
$(TESTRESULTDIR)/test11.result: $(TESTRESULTDIR)/test11.csbackgen.result \
	$(TESTRESULTDIR)/test11.find.result 
$(TESTRESULTDIR)/test11.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin -3"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin -3"))
	@echo -ne "----\n"
	@echo -ne "TEST 11: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test11.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test12: $(TESTRESULTDIR)/test12.result 
$(TESTRESULTDIR)/test12.result: $(TESTRESULTDIR)/test12.csbackgen.result \
	$(TESTRESULTDIR)/test12.find.result 
$(TESTRESULTDIR)/test12.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin +2"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin +2"))
	@echo -ne "----\n"
	@echo -ne "TEST 12: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test12.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test13: $(TESTRESULTDIR)/test13.result 
$(TESTRESULTDIR)/test13.result: $(TESTRESULTDIR)/test13.csbackgen.result \
	$(TESTRESULTDIR)/test13.find.result 
$(TESTRESULTDIR)/test13.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin +1 --mmin -3"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin +1 -mmin -3"))
	@echo -ne "----\n"
	@echo -ne "TEST 13: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test13.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test14: $(TESTRESULTDIR)/test14.result 
$(TESTRESULTDIR)/test14.result: $(TESTRESULTDIR)/test14.csbackgen.result \
	$(TESTRESULTDIR)/test14.find.result 
$(TESTRESULTDIR)/test14.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin 0"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin 0"))
	@echo -ne "----\n"
	@echo -ne "TEST 14: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
		sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test14.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@
479

480
# ----- END OF Makefile -----