xref: /openbsd/regress/usr.bin/sed/Makefile (revision f297b04d)
1*f297b04dSotto#	$OpenBSD: Makefile,v 1.6 2017/06/12 16:58:31 otto Exp $
214274383Smillert#	$NetBSD: Makefile,v 1.1 2005/04/04 16:48:45 peter Exp $
314274383Smillert
4e47cfd50SjasperSED?=	/usr/bin/sed
514274383Smillert
6e47cfd50SjasperREGRESS_TARGETS= sedtest substitute hanoi math sierpinski negation \
7*f297b04dSotto	inplace inplace2 inplace3 commandl1 commandl2 commandc1 commandD1
8cd65ed77Smillert
9cd65ed77Smillertsedtest:
10cd65ed77Smillert	sh ${.CURDIR}/$@.sh ${SED} $@.out
11cd65ed77Smillert	diff ${.CURDIR}/$@.expected $@.out
12cd65ed77Smillert
132e665b55Sschwarzesubstitute:
142e665b55Sschwarze	sh ${.CURDIR}/$@.sh
152e665b55Sschwarze
16cd65ed77Smillerthanoi:
17cd65ed77Smillert	${SED} -f ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
18cd65ed77Smillert	diff ${.CURDIR}/$@.expected $@.out
19cd65ed77Smillert
20cd65ed77Smillertmath:
21cd65ed77Smillert	${SED} -f ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
22cd65ed77Smillert	diff ${.CURDIR}/$@.expected $@.out
23cd65ed77Smillert
24cd65ed77Smillertsierpinski:
25cd65ed77Smillert	${SED} -nf ${.CURDIR}/$@.sed ${.CURDIR}/$@.in > $@.out
26cd65ed77Smillert	diff ${.CURDIR}/$@.expected $@.out
2714274383Smillert
2845d46768Smillertnegation:
2945d46768Smillert	echo foo | ${SED} "1!!s/foo/bar/" > $@.out
3045d46768Smillert	diff ${.CURDIR}/$@.expected $@.out
3145d46768Smillert
32e47cfd50Sjasperinplace:
33e47cfd50Sjasper	cp -f ${.CURDIR}/$@.in $@.txt
34e47cfd50Sjasper	${SED} -i -f ${.CURDIR}/sierpinski.sed $@.txt
35e47cfd50Sjasper	diff ${.CURDIR}/sierpinski.expected $@.txt
36e47cfd50Sjasper
37e47cfd50Sjasperinplace2:
38e47cfd50Sjasper	cp -f ${.CURDIR}/$@.in $@.txt
39e47cfd50Sjasper	${SED} -i 's/PROG/GROP/g' $@.txt
40e47cfd50Sjasper	diff ${.CURDIR}/$@.expected $@.txt
41e47cfd50Sjasper
42e47cfd50Sjasperinplace3:
43e47cfd50Sjasper	cp -f ${.CURDIR}/$@.in $@.txt
44e47cfd50Sjasper	${SED} -i 's/#PermitRootLogin no/PermitRootLogin yes/g' $@.txt
45e47cfd50Sjasper	diff ${.CURDIR}/$@.expected $@.txt
46e47cfd50Sjasper
47*f297b04dSottocommandl1:
48*f297b04dSotto	printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
49*f297b04dSotto	diff ${.CURDIR}/$@.expected $@.out
50*f297b04dSotto
51*f297b04dSottocommandl2:
52*f297b04dSotto	printf 'abc' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
53*f297b04dSotto	diff ${.CURDIR}/$@.expected $@.out
54*f297b04dSotto
55*f297b04dSottocommandc1:
56*f297b04dSotto	printf 'abc' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
57*f297b04dSotto	diff ${.CURDIR}/$@.expected $@.out
58*f297b04dSotto
59*f297b04dSottocommandD1:
60*f297b04dSotto	printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/$@.sed > $@.out
61*f297b04dSotto	diff ${.CURDIR}/$@.expected $@.out
62*f297b04dSotto
63*f297b04dSotto
64e47cfd50SjasperCLEANFILES+=*.out lines* script* *.txt
6514274383Smillert
6614274383Smillert.include <bsd.regress.mk>
67