1 1.1 hubertf PROG= vndcompress 2 1.2.12.1 tls SRCS= main.c vndcompress.c vnduncompress.c 3 1.2.12.1 tls 4 1.2.12.1 tls LINKS= ${BINDIR}/vndcompress ${BINDIR}/vnduncompress 5 1.2.12.1 tls MLINKS= vndcompress.1 vnduncompress.1 6 1.2.12.1 tls 7 1.2.12.1 tls DPADD+= ${LIBZ} 8 1.1 hubertf LDADD+= -lz 9 1.1 hubertf 10 1.2.12.1 tls WARNS= 5 11 1.2.12.1 tls 12 1.1 hubertf .include <bsd.prog.mk> 13 1.2.12.1 tls 14 1.2.12.1 tls TESTFILES+= oneblock 15 1.2.12.1 tls XFAIL+= oneblock.in-outx 16 1.2.12.1 tls XFAIL+= oneblock.cl2-cl2x 17 1.2.12.1 tls oneblock.in: 18 1.2.12.1 tls head -c 512 < /usr/share/dict/words > ${.TARGET}.tmp \ 19 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 20 1.2.12.1 tls 21 1.2.12.1 tls TESTFILES+= tenblock 22 1.2.12.1 tls XFAIL+= tenblock.in-outx 23 1.2.12.1 tls XFAIL+= tenblock.cl2-cl2x 24 1.2.12.1 tls tenblock.in: 25 1.2.12.1 tls head -c 5120 < /usr/share/dict/words > ${.TARGET}.tmp \ 26 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 27 1.2.12.1 tls 28 1.2.12.1 tls TESTFILES+= smallfile 29 1.2.12.1 tls XFAIL+= smallfile.in-outx 30 1.2.12.1 tls XFAIL+= smallfile.cl2-cl2x 31 1.2.12.1 tls smallfile.in: 32 1.2.12.1 tls head -c 12345 < /usr/share/dict/words > ${.TARGET}.tmp \ 33 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 34 1.2.12.1 tls 35 1.2.12.1 tls CHECKS+= check-pipe 36 1.2.12.1 tls CLEANFILES+= smallfile.cl2pipe 37 1.2.12.1 tls check-pipe: .PHONY smallfile.cl2 smallfile.cl2pipe 38 1.2.12.1 tls cmp ${.ALLSRC} 39 1.2.12.1 tls smallfile.cl2pipe: smallfile.in vndcompress 40 1.2.12.1 tls head -c 54321 < /usr/share/dict/words \ 41 1.2.12.1 tls | ./vndcompress -l 12345 /dev/stdin ${.TARGET}.tmp \ 42 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 43 1.2.12.1 tls 44 1.2.12.1 tls TESTFILES+= onechunk 45 1.2.12.1 tls onechunk.in: 46 1.2.12.1 tls head -c 65536 < /usr/share/dict/words > ${.TARGET}.tmp \ 47 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 48 1.2.12.1 tls 49 1.2.12.1 tls TESTFILES+= tenchunk 50 1.2.12.1 tls tenchunk.in: 51 1.2.12.1 tls head -c 655360 < /usr/share/dict/words > ${.TARGET}.tmp \ 52 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 53 1.2.12.1 tls 54 1.2.12.1 tls TESTFILES+= extrablock 55 1.2.12.1 tls XFAIL+= extrablock.in-outx 56 1.2.12.1 tls XFAIL+= extrablock.cl2-cl2x 57 1.2.12.1 tls extrablock.in: 58 1.2.12.1 tls head -c $$((65536 + 512)) < /usr/share/dict/words > ${.TARGET}.tmp \ 59 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 60 1.2.12.1 tls 61 1.2.12.1 tls TESTFILES+= medfile 62 1.2.12.1 tls XFAIL+= medfile.in-outx 63 1.2.12.1 tls XFAIL+= medfile.cl2-cl2x 64 1.2.12.1 tls medfile.in: 65 1.2.12.1 tls head -c 123456 < /usr/share/dict/words > ${.TARGET}.tmp \ 66 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 67 1.2.12.1 tls 68 1.2.12.1 tls TESTFILES+= onetinyblock 69 1.2.12.1 tls BLOCKSIZE.onetinyblock= 512 70 1.2.12.1 tls onetinyblock.in: 71 1.2.12.1 tls head -c 512 < /usr/share/dict/words > ${.TARGET}.tmp \ 72 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 73 1.2.12.1 tls 74 1.2.12.1 tls TESTFILES+= tentinyblock 75 1.2.12.1 tls BLOCKSIZE.tentinyblock= 512 76 1.2.12.1 tls tentinyblock.in: 77 1.2.12.1 tls head -c 5120 < /usr/share/dict/words > ${.TARGET}.tmp \ 78 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 79 1.2.12.1 tls 80 1.2.12.1 tls CHECKS+= check-pipe-restart 81 1.2.12.1 tls CLEANFILES+= piperestart.in piperestart.in.tmp 82 1.2.12.1 tls CLEANFILES+= piperestart.cl2 piperestart.cl2.tmp 83 1.2.12.1 tls CLEANFILES+= piperestart.cl2restart piperestart.cl2restart.tmp 84 1.2.12.1 tls CLEANFILES+= piperestart.cl2part piperestart.cl2part.tmp 85 1.2.12.1 tls check-pipe-restart: .PHONY piperestart.cl2 piperestart.cl2restart 86 1.2.12.1 tls cmp ${.ALLSRC} 87 1.2.12.1 tls piperestart.cl2restart: piperestart.cl2part vndcompress 88 1.2.12.1 tls cp piperestart.cl2part ${.TARGET}.tmp \ 89 1.2.12.1 tls && head -c 700000 < /usr/share/dict/words \ 90 1.2.12.1 tls | ./vndcompress -l 655360 -k 1 -rR /dev/stdin ${.TARGET}.tmp \ 91 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 92 1.2.12.1 tls piperestart.cl2part: vndcompress 93 1.2.12.1 tls head -c 600000 < /usr/share/dict/words \ 94 1.2.12.1 tls | ./vndcompress -l 655360 -k 1 /dev/stdin ${.TARGET}.tmp; \ 95 1.2.12.1 tls mv -f ${.TARGET}.tmp ${.TARGET} 96 1.2.12.1 tls piperestart.in: 97 1.2.12.1 tls head -c 655360 < /usr/share/dict/words > ${.TARGET}.tmp \ 98 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 99 1.2.12.1 tls 100 1.2.12.1 tls CHECKS+= check-part 101 1.2.12.1 tls CLEANFILES+= part.orig part.cl2part part.cl2 part.out 102 1.2.12.1 tls check-part: .PHONY part.orig part.out 103 1.2.12.1 tls cmp part.orig part.out 104 1.2.12.1 tls part.cl2: part.orig part.cl2part vndcompress 105 1.2.12.1 tls cp part.cl2part ${.TARGET}.tmp \ 106 1.2.12.1 tls && ./vndcompress -s 512 -rR part.orig ${.TARGET}.tmp \ 107 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 108 1.2.12.1 tls part.cl2part: part.orig vndcompress 109 1.2.12.1 tls ./vndcompress -s 512 -p 10 part.orig ${.TARGET}.tmp \ 110 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 111 1.2.12.1 tls part.orig: 112 1.2.12.1 tls head -c 12345 < /usr/share/dict/words > ${.TARGET}.tmp \ 113 1.2.12.1 tls && mv -f ${.TARGET}.tmp ${.TARGET} 114 1.2.12.1 tls 115 1.2.12.1 tls TESTSUFFIXES+= in cl2 cl2x out outx 116 1.2.12.1 tls 117 1.2.12.1 tls TESTFORMS+= cl2 cl2x 118 1.2.12.1 tls TESTFORMS+= in out 119 1.2.12.1 tls TESTFORMS+= in outx 120 1.2.12.1 tls 121 1.2.12.1 tls .for testfile in ${TESTFILES} 122 1.2.12.1 tls . for suffix in ${TESTSUFFIXES} 123 1.2.12.1 tls CLEANFILES+= ${testfile}.${suffix} 124 1.2.12.1 tls CLEANFILES+= ${testfile}.${suffix}.tmp 125 1.2.12.1 tls . endfor 126 1.2.12.1 tls . for left right in ${TESTFORMS} 127 1.2.12.1 tls CHECKS.${testfile}+= check-${testfile}.${left}-${right} 128 1.2.12.1 tls check-${testfile}.${left}-${right}: .PHONY \ 129 1.2.12.1 tls ${testfile}.${left} ${testfile}.${right} 130 1.2.12.1 tls . if empty(XFAIL:M${testfile}.${left}-${right}) 131 1.2.12.1 tls cmp ${testfile}.${left} ${testfile}.${right} 132 1.2.12.1 tls . else 133 1.2.12.1 tls @echo '# expecting failure...' \ 134 1.2.12.1 tls && echo 'cmp ${testfile}.${left} ${testfile}.${right}' \ 135 1.2.12.1 tls && if cmp ${testfile}.${left} ${testfile}.${right}; then \ 136 1.2.12.1 tls echo 'unexpected pass!' \ 137 1.2.12.1 tls && exit 1; \ 138 1.2.12.1 tls fi 139 1.2.12.1 tls . endif 140 1.2.12.1 tls . endfor 141 1.2.12.1 tls check-${testfile}: ${CHECKS.${testfile}} 142 1.2.12.1 tls CHECKS+= check-${testfile} 143 1.2.12.1 tls .endfor 144 1.2.12.1 tls 145 1.2.12.1 tls check: .PHONY ${CHECKS} 146 1.2.12.1 tls 147 1.2.12.1 tls .SUFFIXES: .cl2 .cl2x .in .out .outx 148 1.2.12.1 tls 149 1.2.12.1 tls .in.cl2: vndcompress 150 1.2.12.1 tls ./vndcompress ${.IMPSRC} ${.TARGET} ${BLOCKSIZE.${.PREFIX}} 151 1.2.12.1 tls 152 1.2.12.1 tls .in.cl2x: 153 1.2.12.1 tls vndcompress ${.IMPSRC} ${.TARGET} ${BLOCKSIZE.${.PREFIX}} 154 1.2.12.1 tls 155 1.2.12.1 tls .cl2.out: vndcompress 156 1.2.12.1 tls ./vndcompress -d ${.IMPSRC} ${.TARGET} 157 1.2.12.1 tls 158 1.2.12.1 tls .cl2.outx: 159 1.2.12.1 tls vnduncompress ${.IMPSRC} ${.TARGET} 160