xref: /openbsd/regress/usr.bin/diff/Makefile (revision 404b540a)
1# $OpenBSD: Makefile,v 1.5 2003/08/10 18:32:44 otto Exp $
2
3REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13
4
5DIFF=diff
6PATCH=patch
7PATCHOPTIONS=-sb
8
9# Skip the cmp(1) part for ed(1) style diffs for these tests
10EDSKIPCMP=t7 t10 t12
11
12# .1 and .2: 	input files
13
14# t1: two empty files
15# t2: basic editing
16# t3: one empty, other contains text
17# t4: one contains text, other empty
18# t5: files are the same
19# t6: one file with no newline at end, other does contain newline
20# t7: one file with newline at end, the other not
21# t8: revisison 1.1 and 1.54 of kern_malloc.c
22# t9: revisison 1.1 and 1.104 of vfs_syscalls.c
23# t10: two files with no end of line at the end, line in second file is longer
24# t11: rev 1.3 and 1.36 of usr.bin/ed/ed.1.
25# t12: rev 1.1 and 1.2 of sbin/isakmpd/regress/hmac/Makefile.
26# t13: a case to check the single dot on a line handling for ed(1) patches.
27
28.SUFFIXES: .1 .2
29
30all: clean ${REGRESS_TARGET}
31
32.1:
33	@cp ${.CURDIR}/${*}.1 ${*}.copy
34	@cp ${.CURDIR}/${*}.1 ${*}.c.copy
35	@cp ${.CURDIR}/${*}.1 ${*}.u.copy
36	@cp ${.CURDIR}/${*}.1 ${*}.e.copy
37	@${DIFF}  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.patch || true
38	@${DIFF} -c  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.c.patch || true
39	@${DIFF} -u  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.u.patch || true
40	@${DIFF} -e  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.e.patch || true
41	@${PATCH} ${PATCHOPTIONS} ${*}.copy ${*}.patch || true
42	@${PATCH} ${PATCHOPTIONS} ${*}.c.copy ${*}.c.patch || true
43	@${PATCH} ${PATCHOPTIONS} ${*}.u.copy ${*}.u.patch || true
44	@${PATCH} ${PATCHOPTIONS} ${*}.e.copy ${*}.e.patch || true
45	@cmp -s ${.CURDIR}/${*}.2 ${*}.copy || \
46		(echo "XXX ${*} standard diff failed" && false)
47	@cmp -s ${.CURDIR}/${*}.2 ${*}.c.copy || \
48		(echo "XXX ${*} context diff failed" && false)
49	@cmp -s ${.CURDIR}/${*}.2 ${*}.u.copy || \
50		(echo "XXX ${*} unified diff failed" && false)
51	@( echo ${EDSKIPCMP} | grep -q '[[:<:]]${*}[[:>:]]' ) || \
52		cmp -s ${.CURDIR}/${*}.2 ${*}.e.copy || \
53		(echo "XXX ${*} ed diff failed" && false)
54
55# Clean all files generated
56clean:
57	rm -f *.copy *.patch *.orig
58
59.include <bsd.regress.mk>
60