Makefile 19.2 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
# this is <Makefile>
# ----------------------------------------------------------------------------
# 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
24
# 16/01/2012  V0.2  added package rule
25
# 28/02/2012  V0.3  smaller modifications - added csbackobs.py
26
27
28
29
# 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
30
31
# 08/11/2013  V0.8  several csbackgen.py tests implemented which are 
#                   related to the time exclusion commandline arguments 
32
33
34
# 15/07/2016  V1.0  binary installation directory is hard-wired; use
#                   CSBACKBINDIR instead of LOCBINDIR to avoid conflicts with 
#                   Seitosh
35
#
36
# ----------------------------------------------------------------------------
37
PROGRAMS=csback2cron.py csbackntfy.py csbackgen.py csbackchk.py csbackobs.py \
38
	csbackresc.py csbackscp.py csclean.sh BFO2LSDF.sh
39
40
41
42
43
44
45
46
47
48
49

.PHONY: all
all: install doc

.PHONY: install
install: installscripts

.PHONY: doc
doc: pdfdoc
  	
# ----------------------------------------------------------------------------
50
CSBACKBINDIR=$(HOME)/bin
51
52
53
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)
54
LOGROTATE=$(shell if [ -d /etc/logrotate.d/ ]; then echo logrotate; fi)
55
PYTHON=$(shell env which python)
56
57
SSH=$(shell env which ssh)
SCP=$(shell env which scp)
58
59
60

# ----------------------------------------------------------------------------
.PHONY: clean
61
clean: 
62
63
	/bin/rm -rvf $(addprefix $(CSBACKBINDIR)/,$(patsubst %.py,%,$(PROGRAMS))) 
	/bin/rm -rvf $(addprefix $(CSBACKBINDIR)/,$(patsubst %.sh,%,$(PROGRAMS))) 
64
	/bin/rm -fv flist *.bak
65
66
	$(MAKE) -C doc clean

67
68
# ----------------------------------------------------------------------------
# vim supporter
69
70
71
72
73
74
#
# files in example subdirectory
EXAMPLES=$(wildcard examples/*.exclude examples/README \
  examples/*rc examples/*xml)
# files in utility subdirectory
UTILS=$(wildcard util/*.sh util/README)
75
76
# README files
READMES=$(filter-out %.bak,$(wildcard README*))
77
78
79

.PHONY: flist
flist: Makefile $(wildcard *.py *.sh *.conf doc/*.tex) \
80
  csbackrc COPYING doc/Makefile $(READMES) LICENSE.GPLv3 \
81
  $(EXAMPLES) $(UTILS)
82
83
84
85
86
	echo $^ | tr ' ' '\n' | sort > $@

.PHONY: edit
edit: flist; vim $<

87
88
89
90
91
92
93
# ----------------------------------------------------------------------------
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)))

94
$(call CHECKVARS, CSBACKBINDIR)
95
$(call CHECKPROGS, RSYNC CRON SYSLOGNG LOGROTATE PYTHON SSH SCP)
96
97
98
99

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

100
$(addprefix $(CSBACKBINDIR)/, $(PROGRAMS)): $(addprefix $(PWD)/, $(PROGRAMS))
101

102
103
$(CSBACKBINDIR)/%: %.py
	mkdir -pv $(CSBACKBINDIR)
104
105
106
	ln -fs $(addprefix $(PWD)/,$<) $@
	chmod +x $(addprefix $(PWD)/,$<) 

107
108
$(CSBACKBINDIR)/%: %.sh
	mkdir -pv $(CSBACKBINDIR)
109
110
111
	ln -fs $(addprefix $(PWD)/,$<) $@
	chmod +x $(addprefix $(PWD)/,$<) 

112
installscripts: $(addprefix $(CSBACKBINDIR)/, $(patsubst %.py,%,$(PROGRAMS)) \
113
	$(patsubst %.sh,%,$(PROGRAMS)))
114

115
# ----------------------------------------------------------------------------
116
117
118
pdfdoc:
	$(MAKE) -C doc pdf

119
120
121
122
123
124
# ============================================================================
# tests
# --------------
# generate directory with sample files
TESTDIR=testdir
TESTRESULTDIR=testResults
125
126
TESTS=$(addprefix test, $(shell seq 0 13))

127
NOW=$(shell date +"%Y%m%d%H%M")
128
129
130
131
132
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") 
133
HALFDAYAGO=$(shell date --date "now 12 hours ago" +"%Y%m%d%H%M") 
134
135
136
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") 
137
138
139
140
141
142
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") 
143
144
145
146
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") 
147
TWODAYSAGO=$(shell date --date "now 2 days ago" +"%Y%m%d%H%M") 
148
THREEDAYSAGO=$(shell date --date "now 3 days ago" +"%Y%m%d%H%M") 
149

150
.PHONY: testclean
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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) $@
165
166
167
168
169
170
171
172
$(TESTDIR)/twoMinutesAgo: $(TESTDIR)
	touch -t $(TWOMINUTESAGO) $@
$(TESTDIR)/threeMinutesAgo: $(TESTDIR)
	touch -t $(THREEMINUTESAGO) $@
$(TESTDIR)/twoAndHalfMinutesAgo: $(TESTDIR)
	touch -t $(TWOANDHALFMINUTESAGO) $@
$(TESTDIR)/fourMinutesAgo: $(TESTDIR)
	touch -t $(FOURMINUTESAGO) $@
173
174
175
176
$(TESTDIR)/oneDayAgo: $(TESTDIR)
	touch -t $(ONEDAYAGO) $@
$(TESTDIR)/twoDaysAgo: $(TESTDIR)
	touch -t $(TWODAYSAGO) $@
177
178
179
180
$(TESTDIR)/threeDaysAgo: $(TESTDIR)
	touch -t $(THREEDAYSAGO) $@
$(TESTDIR)/oneDayOneMinuteAgo: $(TESTDIR)
	touch -t $(ONEDAYONEMINUTEAGO) $@
181
182
183
184
185
186
$(TESTDIR)/oneDayTwoMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYTWOMINUTESAGO) $@
$(TESTDIR)/oneDayThreeMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYTHREEMINUTESAGO) $@
$(TESTDIR)/oneDayFourMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYFOURMINUTESAGO) $@
187
188
189
190
$(TESTDIR)/oneDayMinusOneMinuteAgo: $(TESTDIR)
	touch -t $(ONEDAYMINUSONEMINUTEAGO) $@
$(TESTDIR)/oneDayMinusTwoMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYMINUSTWOMINUTESAGO) $@
191
192

.PHONY: testEnv
193
194
195
testEnv: $(addprefix $(TESTDIR)/, now halfDayAgo oneDayAgo twoDaysAgo \
	oneDayOneMinuteAgo oneDayMinusOneMinuteAgo oneDayMinusTwoMinutesAgo \
	threeDaysAgo twoMinutesAgo threeMinutesAgo fourMinutesAgo \
196
197
	twoAndHalfMinutesAgo oneDayTwoMinutesAgo oneDayThreeMinutesAgo \
	oneDayFourMinutesAgo)
198

199
tests: $(TESTS)
200

201
testlst: $(addprefix $(TESTRESULTDIR)/, $(addsuffix .result, $(TESTS)))
202
203
204
205
206
	@echo -ne "----\n"
	@cat $^
	

%.result: %.csbackgen.result %.find.result 
207
208
209
210
ifeq ($(CONFIG),"")
	$(warning WARNING: Variable CONFIG not set.)
	$(eval CONFIG:=$(shell echo "undefined"))
endif
211
212
	testID="$(shell basename -s .result $@ | tr -d '[:alpha:]')"; \
	if [ -z "$(shell diff $^)" ]; then \
213
		echo "TEST $${testID}: OK    ($(CONFIG))" > $@; \
214
	else \
215
		echo "TEST $${testID}: ERROR ($(CONFIG))" > $@; \
216
217
	fi

218
219
220
221
222
223
224
225
226
227
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,$^) | \
228
229
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
230
231
232
233
		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 > $@

234
235
236
237
test1: $(TESTRESULTDIR)/test1.result
$(TESTRESULTDIR)/test1.result: $(TESTRESULTDIR)/test1.csbackgen.result \
	$(TESTRESULTDIR)/test1.find.result 
$(TESTRESULTDIR)/test1.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
238
239
	$(eval CONFIG:= $(shell echo "--mtime 1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime 1"))
240
	@echo -ne "----\n"
241
	@echo -ne "TEST 1: $(CONFIG)\n"
242
	@echo -ne "----\n"
243
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
244
245
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
246
247
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | \
		sort | grep -v -e "checksumfile.cs" > $@
248
$(TESTRESULTDIR)/test1.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
249
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
250
251
252
253
254

test2: $(TESTRESULTDIR)/test2.result 
$(TESTRESULTDIR)/test2.result: $(TESTRESULTDIR)/test2.csbackgen.result \
	$(TESTRESULTDIR)/test2.find.result 
$(TESTRESULTDIR)/test2.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
255
256
	$(eval CONFIG:= $(shell echo "--mtime -1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime -1"))
257
	@echo -ne "----\n"
258
	@echo -ne "TEST 2: $(CONFIG)\n"
259
	@echo -ne "----\n"
260
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
261
262
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
263
264
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test2.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
265
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
266
267
268
269
270

test3: $(TESTRESULTDIR)/test3.result 
$(TESTRESULTDIR)/test3.result: $(TESTRESULTDIR)/test3.csbackgen.result \
	$(TESTRESULTDIR)/test3.find.result 
$(TESTRESULTDIR)/test3.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
271
272
	$(eval CONFIG:= $(shell echo "--mtime +1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime +1"))
273
	@echo -ne "----\n"
274
	@echo -ne "TEST 3: $(CONFIG)\n"
275
	@echo -ne "----\n"
276
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
277
278
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
279
280
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | \
		sort | grep -v -e "checksumfile.cs" > $@
281
$(TESTRESULTDIR)/test3.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
282
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
283
284
285
286
287

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

301
302
303
304
# --daystart related tests
test5: $(TESTRESULTDIR)/test5.result 
$(TESTRESULTDIR)/test5.result: $(TESTRESULTDIR)/test5.csbackgen.result \
	$(TESTRESULTDIR)/test5.find.result 
305
$(TESTRESULTDIR)/test5.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
306
307
	$(eval CONFIG:= $(shell echo "--daystart --mtime 0"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime 0"))
308
	@echo -ne "----\n"
309
	@echo -ne "TEST 5: $(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
316
		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 > $@
317

318
319
320
test6: $(TESTRESULTDIR)/test6.result 
$(TESTRESULTDIR)/test6.result: $(TESTRESULTDIR)/test6.csbackgen.result \
	$(TESTRESULTDIR)/test6.find.result 
321
$(TESTRESULTDIR)/test6.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
322
323
324
325
326
327
	$(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,$^) | \
328
329
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
		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,$^) | \
345
346
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
347
348
349
350
351
352
353
354
355
356
357
358
		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"
359
	@echo -ne "----\n"
360
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
361
362
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
		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,$^) | \
378
379
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
380
381
382
383
384
385
386
387
388
389
390
391
392
		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"
393
	@echo -ne "----\n"
394
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
395
396
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
		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,$^) | \
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
		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,$^) | \
428
429
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
		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,$^) | \
445
446
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
447
448
449
450
451
		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 > $@

452
453
454
455
test100: $(TESTRESULTDIR)/test100.result 
$(TESTRESULTDIR)/test100.result: $(TESTRESULTDIR)/test100.csbackgen.result \
	$(TESTRESULTDIR)/test100.find.result 
$(TESTRESULTDIR)/test100.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
456
457
458
	$(eval CONFIG:= $(shell echo "--mmin 0"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin 0"))
	@echo -ne "----\n"
459
	@echo -ne "TEST 100: $(CONFIG)\n"
460
461
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
462
463
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
464
465
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
466
$(TESTRESULTDIR)/test100.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
467
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@
468

469
# ----- END OF Makefile -----