summaryrefslogtreecommitdiff
path: root/regress/usr.bin/sed/Makefile
blob: 074adff9a8bff26ce4a906c266c279fbf08a9a24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#	$OpenBSD: Makefile,v 1.6 2017/06/12 16:58:31 otto Exp $
#	$NetBSD: Makefile,v 1.1 2005/04/04 16:48:45 peter Exp $

SED?=	/usr/bin/sed

REGRESS_TARGETS= sedtest substitute hanoi math sierpinski negation \
	inplace inplace2 inplace3 commandl1 commandl2 commandc1 commandD1

sedtest:
	sh ${.CURDIR}/$@.sh ${SED} $@.out
	diff ${.CURDIR}/$@.expected $@.out

substitute:
	sh ${.CURDIR}/$@.sh

hanoi:
	${SED} -f ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
	diff ${.CURDIR}/$@.expected $@.out

math:
	${SED} -f ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
	diff ${.CURDIR}/$@.expected $@.out

sierpinski:
	${SED} -nf ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
	diff ${.CURDIR}/$@.expected $@.out

negation:
	echo foo | ${SED} "1!!s/foo/bar/" > $@.out
	diff ${.CURDIR}/$@.expected $@.out

inplace:
	cp -f ${.CURDIR}/$@.in $@.txt
	${SED} -i -f ${.CURDIR}/sierpinski.sed $@.txt
	diff ${.CURDIR}/sierpinski.expected $@.txt

inplace2:
	cp -f ${.CURDIR}/$@.in $@.txt
	${SED} -i 's/PROG/GROP/g' $@.txt
	diff ${.CURDIR}/$@.expected $@.txt

inplace3:
	cp -f ${.CURDIR}/$@.in $@.txt
	${SED} -i 's/#PermitRootLogin no/PermitRootLogin yes/g' $@.txt
	diff ${.CURDIR}/$@.expected $@.txt

commandl1:
	printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
	diff ${.CURDIR}/$@.expected $@.out

commandl2:
	printf 'abc' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
	diff ${.CURDIR}/$@.expected $@.out

commandc1:
	printf 'abc' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
	diff ${.CURDIR}/$@.expected $@.out

commandD1:
	printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
	diff ${.CURDIR}/$@.expected $@.out


CLEANFILES+=*.out lines* script* *.txt

.include <bsd.regress.mk>