Makefile 20.7 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
	/bin/rm -fv flist *.bak
63
64
	$(MAKE) -C doc clean

65
66
67
68
69
70
71
72
73
74
75
# ----------------------------------------------------------------------------
# vim supporter

.PHONY: flist
flist: Makefile $(wildcard *.py *.sh *.conf doc/*.tex) \
  csbackrc COPYING doc/Makefile README README.history LICENSE.GPLv3
	echo $^ | tr ' ' '\n' | sort > $@

.PHONY: edit
edit: flist; vim $<

76
77
78
79
80
81
82
83
# ----------------------------------------------------------------------------
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)
84
$(call CHECKPROGS, RSYNC CRON SYSLOGNG LOGROTATE PYTHON SSH SCP)
85
86
87
88

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

89
90
91
$(addprefix $(LOCBINDIR)/, $(PROGRAMS)): $(addprefix $(PWD)/, $(PROGRAMS))

$(LOCBINDIR)/%: %.py
92
	mkdir -pv $(LOCBINDIR)
93
94
95
	ln -fs $(addprefix $(PWD)/,$<) $@
	chmod +x $(addprefix $(PWD)/,$<) 

96
97
98
99
100
101
102
$(LOCBINDIR)/%: %.sh
	mkdir -pv $(LOCBINDIR)
	ln -fs $(addprefix $(PWD)/,$<) $@
	chmod +x $(addprefix $(PWD)/,$<) 

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

104
# ----------------------------------------------------------------------------
105
106
107
pdfdoc:
	$(MAKE) -C doc pdf

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
# ============================================================================
# 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) 
169

170
171
172
173
174
175
# ============================================================================
# tests
# --------------
# generate directory with sample files
TESTDIR=testdir
TESTRESULTDIR=testResults
176
177
TESTS=$(addprefix test, $(shell seq 0 13))

178
NOW=$(shell date +"%Y%m%d%H%M")
179
180
181
182
183
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") 
184
HALFDAYAGO=$(shell date --date "now 12 hours ago" +"%Y%m%d%H%M") 
185
186
187
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") 
188
189
190
191
192
193
ONEDAYTWOMINUTESAGO=$(shell date --date "now 1 day ago 2 minute ago" \
									 +"%Y%m%d%H%M") 
ONEDAYTHREEMINUTESAGO=$(shell date --date "now 1 day ago 3 minute ago" \
									 +"%Y%m%d%H%M") 
ONEDAYFOURMINUTESAGO=$(shell date --date "now 1 day ago 4 minute ago" \
									 +"%Y%m%d%H%M") 
194
195
196
197
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") 
198
TWODAYSAGO=$(shell date --date "now 2 days ago" +"%Y%m%d%H%M") 
199
THREEDAYSAGO=$(shell date --date "now 3 days ago" +"%Y%m%d%H%M") 
200

201
.PHONY: testclean
202
203
204
205
206
207
208
209
210
211
212
213
214
215
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) $@
216
217
218
219
220
221
222
223
$(TESTDIR)/twoMinutesAgo: $(TESTDIR)
	touch -t $(TWOMINUTESAGO) $@
$(TESTDIR)/threeMinutesAgo: $(TESTDIR)
	touch -t $(THREEMINUTESAGO) $@
$(TESTDIR)/twoAndHalfMinutesAgo: $(TESTDIR)
	touch -t $(TWOANDHALFMINUTESAGO) $@
$(TESTDIR)/fourMinutesAgo: $(TESTDIR)
	touch -t $(FOURMINUTESAGO) $@
224
225
226
227
$(TESTDIR)/oneDayAgo: $(TESTDIR)
	touch -t $(ONEDAYAGO) $@
$(TESTDIR)/twoDaysAgo: $(TESTDIR)
	touch -t $(TWODAYSAGO) $@
228
229
230
231
$(TESTDIR)/threeDaysAgo: $(TESTDIR)
	touch -t $(THREEDAYSAGO) $@
$(TESTDIR)/oneDayOneMinuteAgo: $(TESTDIR)
	touch -t $(ONEDAYONEMINUTEAGO) $@
232
233
234
235
236
237
$(TESTDIR)/oneDayTwoMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYTWOMINUTESAGO) $@
$(TESTDIR)/oneDayThreeMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYTHREEMINUTESAGO) $@
$(TESTDIR)/oneDayFourMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYFOURMINUTESAGO) $@
238
239
240
241
$(TESTDIR)/oneDayMinusOneMinuteAgo: $(TESTDIR)
	touch -t $(ONEDAYMINUSONEMINUTEAGO) $@
$(TESTDIR)/oneDayMinusTwoMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYMINUSTWOMINUTESAGO) $@
242
243

.PHONY: testEnv
244
245
246
testEnv: $(addprefix $(TESTDIR)/, now halfDayAgo oneDayAgo twoDaysAgo \
	oneDayOneMinuteAgo oneDayMinusOneMinuteAgo oneDayMinusTwoMinutesAgo \
	threeDaysAgo twoMinutesAgo threeMinutesAgo fourMinutesAgo \
247
248
	twoAndHalfMinutesAgo oneDayTwoMinutesAgo oneDayThreeMinutesAgo \
	oneDayFourMinutesAgo)
249

250
tests: $(TESTS)
251

252
testlst: $(addprefix $(TESTRESULTDIR)/, $(addsuffix .result, $(TESTS)))
253
254
255
256
257
	@echo -ne "----\n"
	@cat $^
	

%.result: %.csbackgen.result %.find.result 
258
259
260
261
ifeq ($(CONFIG),"")
	$(warning WARNING: Variable CONFIG not set.)
	$(eval CONFIG:=$(shell echo "undefined"))
endif
262
263
	testID="$(shell basename -s .result $@ | tr -d '[:alpha:]')"; \
	if [ -z "$(shell diff $^)" ]; then \
264
		echo "TEST $${testID}: OK    ($(CONFIG))" > $@; \
265
	else \
266
		echo "TEST $${testID}: ERROR ($(CONFIG))" > $@; \
267
268
	fi

269
270
271
272
273
274
275
276
277
278
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,$^) | \
279
280
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
281
282
283
284
		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 > $@

285
286
287
288
test1: $(TESTRESULTDIR)/test1.result
$(TESTRESULTDIR)/test1.result: $(TESTRESULTDIR)/test1.csbackgen.result \
	$(TESTRESULTDIR)/test1.find.result 
$(TESTRESULTDIR)/test1.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
289
290
	$(eval CONFIG:= $(shell echo "--mtime 1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime 1"))
291
	@echo -ne "----\n"
292
	@echo -ne "TEST 1: $(CONFIG)\n"
293
	@echo -ne "----\n"
294
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
295
296
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
297
298
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | \
		sort | grep -v -e "checksumfile.cs" > $@
299
$(TESTRESULTDIR)/test1.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
300
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
301
302
303
304
305

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

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

test4: $(TESTRESULTDIR)/test4.result 
$(TESTRESULTDIR)/test4.result: $(TESTRESULTDIR)/test4.csbackgen.result \
	$(TESTRESULTDIR)/test4.find.result 
$(TESTRESULTDIR)/test4.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
339
340
	$(eval CONFIG:= $(shell echo "--mtime +1 --mtime -3"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime +1 -mtime -3"))
341
	@echo -ne "----\n"
342
	@echo -ne "TEST 4: $(CONFIG)\n"
343
	@echo -ne "----\n"
344
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
345
346
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
347
348
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
349
$(TESTRESULTDIR)/test4.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
350
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
351

352
353
354
355
# --daystart related tests
test5: $(TESTRESULTDIR)/test5.result 
$(TESTRESULTDIR)/test5.result: $(TESTRESULTDIR)/test5.csbackgen.result \
	$(TESTRESULTDIR)/test5.find.result 
356
$(TESTRESULTDIR)/test5.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
357
358
	$(eval CONFIG:= $(shell echo "--daystart --mtime 0"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime 0"))
359
	@echo -ne "----\n"
360
	@echo -ne "TEST 5: $(CONFIG)\n"
361
	@echo -ne "----\n"
362
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
363
364
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
365
366
367
		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 > $@
368

369
370
371
test6: $(TESTRESULTDIR)/test6.result 
$(TESTRESULTDIR)/test6.result: $(TESTRESULTDIR)/test6.csbackgen.result \
	$(TESTRESULTDIR)/test6.find.result 
372
$(TESTRESULTDIR)/test6.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
373
374
375
376
377
378
	$(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,$^) | \
379
380
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
		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,$^) | \
396
397
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
398
399
400
401
402
403
404
405
406
407
408
409
		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"
410
	@echo -ne "----\n"
411
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
412
413
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
		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,$^) | \
429
430
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
431
432
433
434
435
436
437
438
439
440
441
442
443
		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"
444
	@echo -ne "----\n"
445
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
446
447
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
		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,$^) | \
463
464
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
465
466
467
468
469
470
471
472
473
474
475
476
477
478
		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,$^) | \
479
480
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
		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,$^) | \
496
497
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
498
499
500
501
502
		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 > $@

503
504
505
506
test100: $(TESTRESULTDIR)/test100.result 
$(TESTRESULTDIR)/test100.result: $(TESTRESULTDIR)/test100.csbackgen.result \
	$(TESTRESULTDIR)/test100.find.result 
$(TESTRESULTDIR)/test100.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
507
508
509
	$(eval CONFIG:= $(shell echo "--mmin 0"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin 0"))
	@echo -ne "----\n"
510
	@echo -ne "TEST 100: $(CONFIG)\n"
511
512
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
513
514
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
515
516
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
517
$(TESTRESULTDIR)/test100.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
518
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@
519

520
# ----- END OF Makefile -----