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