Makefile revision 1.10
1PROG= vndcompress 2SRCS= main.c offtab.c utils.c vndcompress.c vnduncompress.c 3 4LINKS= ${BINDIR}/vndcompress ${BINDIR}/vnduncompress 5MLINKS= vndcompress.1 vnduncompress.1 6 7DPADD+= ${LIBZ} 8LDADD+= -lz 9 10WARNS= 5 11 12.include <bsd.prog.mk> 13 14TESTFILES+= oneblock 15XFAIL+= oneblock.in-outx 16XFAIL+= oneblock.cl2-cl2x 17oneblock.in: 18 head -c 512 < /usr/share/dict/words > ${.TARGET}.tmp \ 19 && mv -f ${.TARGET}.tmp ${.TARGET} 20 21TESTFILES+= tenblock 22XFAIL+= tenblock.in-outx 23XFAIL+= tenblock.cl2-cl2x 24tenblock.in: 25 head -c 5120 < /usr/share/dict/words > ${.TARGET}.tmp \ 26 && mv -f ${.TARGET}.tmp ${.TARGET} 27 28TESTFILES+= smallfile 29XFAIL+= smallfile.in-outx 30XFAIL+= smallfile.cl2-cl2x 31smallfile.in: 32 head -c 12345 < /usr/share/dict/words > ${.TARGET}.tmp \ 33 && mv -f ${.TARGET}.tmp ${.TARGET} 34 35CHECKS+= check-pipe 36CLEANFILES+= smallfile.cl2pipe 37check-pipe: .PHONY smallfile.cl2 smallfile.cl2pipe 38 cmp ${.ALLSRC} 39smallfile.cl2pipe: smallfile.in vndcompress 40 head -c 54321 < /usr/share/dict/words \ 41 | ./vndcompress -l 12345 /dev/stdin ${.TARGET}.tmp \ 42 && mv -f ${.TARGET}.tmp ${.TARGET} 43 44TESTFILES+= onechunk 45onechunk.in: 46 head -c 65536 < /usr/share/dict/words > ${.TARGET}.tmp \ 47 && mv -f ${.TARGET}.tmp ${.TARGET} 48 49TESTFILES+= tenchunk 50tenchunk.in: 51 head -c 655360 < /usr/share/dict/words > ${.TARGET}.tmp \ 52 && mv -f ${.TARGET}.tmp ${.TARGET} 53 54TESTFILES+= extrablock 55XFAIL+= extrablock.in-outx 56XFAIL+= extrablock.cl2-cl2x 57extrablock.in: 58 head -c $$((65536 + 512)) < /usr/share/dict/words > ${.TARGET}.tmp \ 59 && mv -f ${.TARGET}.tmp ${.TARGET} 60 61TESTFILES+= medfile 62XFAIL+= medfile.in-outx 63XFAIL+= medfile.cl2-cl2x 64medfile.in: 65 head -c 123456 < /usr/share/dict/words > ${.TARGET}.tmp \ 66 && mv -f ${.TARGET}.tmp ${.TARGET} 67 68TESTFILES+= onetinyblock 69BLOCKSIZE.onetinyblock= 512 70onetinyblock.in: 71 head -c 512 < /usr/share/dict/words > ${.TARGET}.tmp \ 72 && mv -f ${.TARGET}.tmp ${.TARGET} 73 74TESTFILES+= tentinyblock 75BLOCKSIZE.tentinyblock= 512 76tentinyblock.in: 77 head -c 5120 < /usr/share/dict/words > ${.TARGET}.tmp \ 78 && mv -f ${.TARGET}.tmp ${.TARGET} 79 80CHECKS+= check-pipe-restart 81CLEANFILES+= piperestart.in piperestart.in.tmp 82CLEANFILES+= piperestart.cl2 piperestart.cl2.tmp 83CLEANFILES+= piperestart.cl2restart piperestart.cl2restart.tmp 84CLEANFILES+= piperestart.cl2part piperestart.cl2part.tmp 85check-pipe-restart: .PHONY piperestart.cl2 piperestart.cl2restart 86 cmp ${.ALLSRC} 87piperestart.cl2restart: piperestart.cl2part vndcompress 88 cp piperestart.cl2part ${.TARGET}.tmp \ 89 && head -c 700000 < /usr/share/dict/words \ 90 | ./vndcompress -l 655360 -k 1 -rR /dev/stdin ${.TARGET}.tmp \ 91 && mv -f ${.TARGET}.tmp ${.TARGET} 92# The following rule uses ; and not && on purpose: vndcompress is 93# supposed to fail (and it is even OK to interrupt!) so we can restart 94# and fill in the rest. 95piperestart.cl2part: vndcompress 96 head -c 600000 < /usr/share/dict/words \ 97 | ./vndcompress -l 655360 -k 1 /dev/stdin ${.TARGET}.tmp; \ 98 mv -f ${.TARGET}.tmp ${.TARGET} 99piperestart.in: 100 head -c 655360 < /usr/share/dict/words > ${.TARGET}.tmp \ 101 && mv -f ${.TARGET}.tmp ${.TARGET} 102 103CHECKS+= check-part 104CLEANFILES+= part.orig part.cl2part part.cl2 part.out 105check-part: .PHONY part.orig part.out 106 cmp part.orig part.out 107part.cl2: part.orig part.cl2part vndcompress 108 cp part.cl2part ${.TARGET}.tmp \ 109 && ./vndcompress -s 512 -rR part.orig ${.TARGET}.tmp \ 110 && mv -f ${.TARGET}.tmp ${.TARGET} 111part.cl2part: part.orig vndcompress 112 ./vndcompress -s 512 -p 10 part.orig ${.TARGET}.tmp \ 113 && mv -f ${.TARGET}.tmp ${.TARGET} 114part.orig: 115 head -c 12345 < /usr/share/dict/words > ${.TARGET}.tmp \ 116 && mv -f ${.TARGET}.tmp ${.TARGET} 117 118TESTFILES+= smallwindow 119smallwindow.in: 120 head -c 655360 < /usr/share/dict/words > ${.TARGET}.tmp \ 121 && mv -f ${.TARGET}.tmp ${.TARGET} 122smallwindow.cl2: smallwindow.in 123 ./vndcompress -w 1 ${.IMPSRC} ${.TARGET}.tmp \ 124 && mv -f ${.TARGET}.tmp ${.TARGET} 125smallwindow.out: smallwindow.cl2 126 ./vndcompress -w 1 -d ${.IMPSRC} ${.TARGET}.tmp \ 127 && mv -f ${.TARGET}.tmp ${.TARGET} 128 129CHECKS+= check-pipewindow 130check-pipewindow: smallwindow.cl2 131 @echo '# expecting failure...' 132 if cat smallwindow.cl2 | ./vndcompress -w 1 -d /dev/stdin /dev/null; \ 133 then \ 134 echo 'unexpected pass!' && exit 1; \ 135 fi 136 137# These checks don't work unless RLIMIT_AS (i.e., ulimit -v) actually 138# works! Apparently it doesn't... 139 140# CHECKS+= check-ulimit 141# check-ulimit: 142# @echo '# expecting failure...' 143# if head -c 1073741824 < /dev/zero \ 144# | (ulimit -v 20000 && \ 145# ./vndcompress -l 1g -s 512 /dev/stdin /dev/null); then \ 146# echo 'unexpected pass!' && exit 0; \ 147# fi 148 149# CHECKS+= check-ulimit-window 150# check-ulimit-window: 151# head -c 1073741824 < /dev/zero \ 152# | (ulimit -v 20000 && \ 153# ./vndcompress -w 1 -l 1g -s 512 /dev/stdin /dev/null) 154 155TESTSUFFIXES+= in cl2 cl2x out outx 156 157TESTFORMS+= cl2 cl2x 158TESTFORMS+= in out 159TESTFORMS+= in outx 160 161.for testfile in ${TESTFILES} 162. for suffix in ${TESTSUFFIXES} 163CLEANFILES+= ${testfile}.${suffix} 164CLEANFILES+= ${testfile}.${suffix}.tmp 165. endfor 166. for left right in ${TESTFORMS} 167CHECKS.${testfile}+= check-${testfile}.${left}-${right} 168check-${testfile}.${left}-${right}: .PHONY \ 169 ${testfile}.${left} ${testfile}.${right} 170. if empty(XFAIL:M${testfile}.${left}-${right}) 171 cmp ${testfile}.${left} ${testfile}.${right} 172. else 173 @echo '# expecting failure...' \ 174 && echo 'cmp ${testfile}.${left} ${testfile}.${right}' \ 175 && if cmp ${testfile}.${left} ${testfile}.${right}; then \ 176 echo 'unexpected pass!' \ 177 && exit 1; \ 178 fi 179. endif 180. endfor 181check-${testfile}: ${CHECKS.${testfile}} 182CHECKS+= check-${testfile} 183.endfor 184 185check: .PHONY ${CHECKS} 186 187.SUFFIXES: .cl2 .cl2x .in .out .outx 188 189# XXX These tests should automatically try different window sizes, but 190# that is tricky to express in make. 191 192.in.cl2: vndcompress 193 ./vndcompress ${.IMPSRC} ${.TARGET}.tmp ${BLOCKSIZE.${.PREFIX}} \ 194 && mv -f ${.TARGET}.tmp ${.TARGET} 195 196.in.cl2x: 197 vndcompress ${.IMPSRC} ${.TARGET}.tmp ${BLOCKSIZE.${.PREFIX}} \ 198 && mv -f ${.TARGET}.tmp ${.TARGET} 199 200.cl2.out: vndcompress 201 ./vndcompress -d ${.IMPSRC} ${.TARGET}.tmp \ 202 && mv -f ${.TARGET}.tmp ${.TARGET} 203 204.cl2.outx: 205 vnduncompress ${.IMPSRC} ${.TARGET}.tmp \ 206 && mv -f ${.TARGET}.tmp ${.TARGET} 207