xref: /openbsd-src/regress/usr.bin/diff/Makefile (revision babcc32b9d5053b7f9bfa9807d09add574e1d946)
1# $OpenBSD: Makefile,v 1.8 2017/07/06 21:33:45 bluhm Exp $
2
3DIFF?=		diff
4PATCH?=		patch
5PATCHFLAGS=	-sb
6CLEANFILES=	*.copy *.patch *.orig
7
8REGRESS_TARGETS=     t1  t2  t3  t4  t5  t6  t7  t8  t9 \
9		t10 t11 t12 t13 t14 t15
10
11# Skip the cmp(1) part for ed(1) style diffs for these tests
12EDSKIPCMP=t7 t10 t12
13
14# .1 and .2: 	input files
15
16# t1: two empty files
17# t2: basic editing
18# t3: one empty, other contains text
19# t4: one contains text, other empty
20# t5: files are the same
21# t6: one file with no newline at end, other does contain newline
22# t7: one file with newline at end, the other not
23# t8: revision 1.1 and 1.54 of kern_malloc.c
24# t9: revision 1.1 and 1.104 of vfs_syscalls.c
25# t10: two files with no end of line at the end, line in second file is longer
26# t11: rev 1.3 and 1.36 of usr.bin/ed/ed.1.
27# t12: rev 1.1 and 1.2 of sbin/isakmpd/regress/hmac/Makefile.
28# t13: a case to check the single dot on a line handling for ed(1) patches.
29# t14: a case to ensure unified diffs ignoring whitespace produce valid output
30#      when extra lines and no newline at end of file1
31# t15: a case to ensure unified diffs ignoring whitespace produce valid output
32#      when fewer lines and no newline at end of file1
33
34.SUFFIXES: .1 .2
35
36.1:
37	@cp ${.CURDIR}/${*}.1 ${*}.copy
38	@cp ${.CURDIR}/${*}.1 ${*}.c.copy
39	@cp ${.CURDIR}/${*}.1 ${*}.u.copy
40	@cp ${.CURDIR}/${*}.1 ${*}.e.copy
41	@${DIFF}  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.patch || true
42	@${DIFF} -c  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.c.patch || true
43	@${DIFF} -u  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.u.patch || true
44	@${DIFF} -e  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.e.patch || true
45	@${PATCH} ${PATCHFLAGS} ${*}.copy ${*}.patch || true
46	@${PATCH} ${PATCHFLAGS} ${*}.c.copy ${*}.c.patch || true
47	@${PATCH} ${PATCHFLAGS} ${*}.u.copy ${*}.u.patch || true
48	@${PATCH} ${PATCHFLAGS} ${*}.e.copy ${*}.e.patch || true
49	@cmp -s ${.CURDIR}/${*}.2 ${*}.copy || \
50		(echo "XXX ${*} standard diff failed" && false)
51	@cmp -s ${.CURDIR}/${*}.2 ${*}.c.copy || \
52		(echo "XXX ${*} context diff failed" && false)
53	@cmp -s ${.CURDIR}/${*}.2 ${*}.u.copy || \
54		(echo "XXX ${*} unified diff failed" && false)
55	@( echo ${EDSKIPCMP} | grep -q '[[:<:]]${*}[[:>:]]' ) || \
56		cmp -s ${.CURDIR}/${*}.2 ${*}.e.copy || \
57		(echo "XXX ${*} ed diff failed" && false)
58
59t14.1 t15.1:
60	@cp ${.CURDIR}/${*}.1 ${*}.uw.copy
61	@${DIFF} -uw  ${.CURDIR}/${*}.1 ${.CURDIR}/${*}.2 > ${*}.uw.patch || true
62	@${PATCH} ${PATCHFLAGS} ${*}.uw.copy ${*}.uw.patch || true
63	@cmp -s ${.CURDIR}/${*}.2 ${*}.uw.copy || \
64		(echo "XXX ${*} unified diff ignoring whitespace failed" && false)
65
66.include <bsd.regress.mk>
67