Makefile revision 1.10
11.3SriastradPROG= vndcompress 21.6SriastradSRCS= main.c offtab.c utils.c vndcompress.c vnduncompress.c 31.3Sriastrad 41.3SriastradLINKS= ${BINDIR}/vndcompress ${BINDIR}/vnduncompress 51.3SriastradMLINKS= vndcompress.1 vnduncompress.1 61.1Shubertf 71.3SriastradDPADD+= ${LIBZ} 81.1ShubertfLDADD+= -lz 91.1Shubertf 101.8SriastradWARNS= 5 111.8Sriastrad 121.1Shubertf.include <bsd.prog.mk> 131.3Sriastrad 141.3SriastradTESTFILES+= oneblock 151.3SriastradXFAIL+= oneblock.in-outx 161.3SriastradXFAIL+= oneblock.cl2-cl2x 171.3Sriastradoneblock.in: 181.3Sriastrad head -c 512 < /usr/share/dict/words > ${.TARGET}.tmp \ 191.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 201.3Sriastrad 211.3SriastradTESTFILES+= tenblock 221.3SriastradXFAIL+= tenblock.in-outx 231.3SriastradXFAIL+= tenblock.cl2-cl2x 241.3Sriastradtenblock.in: 251.3Sriastrad head -c 5120 < /usr/share/dict/words > ${.TARGET}.tmp \ 261.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 271.3Sriastrad 281.3SriastradTESTFILES+= smallfile 291.3SriastradXFAIL+= smallfile.in-outx 301.3SriastradXFAIL+= smallfile.cl2-cl2x 311.3Sriastradsmallfile.in: 321.3Sriastrad head -c 12345 < /usr/share/dict/words > ${.TARGET}.tmp \ 331.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 341.3Sriastrad 351.3SriastradCHECKS+= check-pipe 361.3SriastradCLEANFILES+= smallfile.cl2pipe 371.3Sriastradcheck-pipe: .PHONY smallfile.cl2 smallfile.cl2pipe 381.3Sriastrad cmp ${.ALLSRC} 391.3Sriastradsmallfile.cl2pipe: smallfile.in vndcompress 401.3Sriastrad head -c 54321 < /usr/share/dict/words \ 411.3Sriastrad | ./vndcompress -l 12345 /dev/stdin ${.TARGET}.tmp \ 421.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 431.3Sriastrad 441.3SriastradTESTFILES+= onechunk 451.3Sriastradonechunk.in: 461.3Sriastrad head -c 65536 < /usr/share/dict/words > ${.TARGET}.tmp \ 471.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 481.3Sriastrad 491.3SriastradTESTFILES+= tenchunk 501.3Sriastradtenchunk.in: 511.3Sriastrad head -c 655360 < /usr/share/dict/words > ${.TARGET}.tmp \ 521.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 531.3Sriastrad 541.3SriastradTESTFILES+= extrablock 551.3SriastradXFAIL+= extrablock.in-outx 561.3SriastradXFAIL+= extrablock.cl2-cl2x 571.3Sriastradextrablock.in: 581.3Sriastrad head -c $$((65536 + 512)) < /usr/share/dict/words > ${.TARGET}.tmp \ 591.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 601.3Sriastrad 611.3SriastradTESTFILES+= medfile 621.3SriastradXFAIL+= medfile.in-outx 631.3SriastradXFAIL+= medfile.cl2-cl2x 641.3Sriastradmedfile.in: 651.3Sriastrad head -c 123456 < /usr/share/dict/words > ${.TARGET}.tmp \ 661.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 671.3Sriastrad 681.3SriastradTESTFILES+= onetinyblock 691.3SriastradBLOCKSIZE.onetinyblock= 512 701.3Sriastradonetinyblock.in: 711.3Sriastrad head -c 512 < /usr/share/dict/words > ${.TARGET}.tmp \ 721.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 731.3Sriastrad 741.3SriastradTESTFILES+= tentinyblock 751.3SriastradBLOCKSIZE.tentinyblock= 512 761.3Sriastradtentinyblock.in: 771.3Sriastrad head -c 5120 < /usr/share/dict/words > ${.TARGET}.tmp \ 781.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 791.3Sriastrad 801.3SriastradCHECKS+= check-pipe-restart 811.3SriastradCLEANFILES+= piperestart.in piperestart.in.tmp 821.3SriastradCLEANFILES+= piperestart.cl2 piperestart.cl2.tmp 831.3SriastradCLEANFILES+= piperestart.cl2restart piperestart.cl2restart.tmp 841.3SriastradCLEANFILES+= piperestart.cl2part piperestart.cl2part.tmp 851.3Sriastradcheck-pipe-restart: .PHONY piperestart.cl2 piperestart.cl2restart 861.3Sriastrad cmp ${.ALLSRC} 871.3Sriastradpiperestart.cl2restart: piperestart.cl2part vndcompress 881.3Sriastrad cp piperestart.cl2part ${.TARGET}.tmp \ 891.3Sriastrad && head -c 700000 < /usr/share/dict/words \ 901.3Sriastrad | ./vndcompress -l 655360 -k 1 -rR /dev/stdin ${.TARGET}.tmp \ 911.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 921.9Sriastrad# The following rule uses ; and not && on purpose: vndcompress is 931.9Sriastrad# supposed to fail (and it is even OK to interrupt!) so we can restart 941.9Sriastrad# and fill in the rest. 951.3Sriastradpiperestart.cl2part: vndcompress 961.3Sriastrad head -c 600000 < /usr/share/dict/words \ 971.3Sriastrad | ./vndcompress -l 655360 -k 1 /dev/stdin ${.TARGET}.tmp; \ 981.3Sriastrad mv -f ${.TARGET}.tmp ${.TARGET} 991.3Sriastradpiperestart.in: 1001.3Sriastrad head -c 655360 < /usr/share/dict/words > ${.TARGET}.tmp \ 1011.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1021.3Sriastrad 1031.3SriastradCHECKS+= check-part 1041.3SriastradCLEANFILES+= part.orig part.cl2part part.cl2 part.out 1051.3Sriastradcheck-part: .PHONY part.orig part.out 1061.3Sriastrad cmp part.orig part.out 1071.3Sriastradpart.cl2: part.orig part.cl2part vndcompress 1081.3Sriastrad cp part.cl2part ${.TARGET}.tmp \ 1091.3Sriastrad && ./vndcompress -s 512 -rR part.orig ${.TARGET}.tmp \ 1101.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1111.3Sriastradpart.cl2part: part.orig vndcompress 1121.3Sriastrad ./vndcompress -s 512 -p 10 part.orig ${.TARGET}.tmp \ 1131.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1141.3Sriastradpart.orig: 1151.3Sriastrad head -c 12345 < /usr/share/dict/words > ${.TARGET}.tmp \ 1161.3Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1171.3Sriastrad 1181.10SriastradTESTFILES+= smallwindow 1191.10Sriastradsmallwindow.in: 1201.10Sriastrad head -c 655360 < /usr/share/dict/words > ${.TARGET}.tmp \ 1211.10Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1221.10Sriastradsmallwindow.cl2: smallwindow.in 1231.10Sriastrad ./vndcompress -w 1 ${.IMPSRC} ${.TARGET}.tmp \ 1241.10Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1251.10Sriastradsmallwindow.out: smallwindow.cl2 1261.10Sriastrad ./vndcompress -w 1 -d ${.IMPSRC} ${.TARGET}.tmp \ 1271.10Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1281.10Sriastrad 1291.10SriastradCHECKS+= check-pipewindow 1301.10Sriastradcheck-pipewindow: smallwindow.cl2 1311.10Sriastrad @echo '# expecting failure...' 1321.10Sriastrad if cat smallwindow.cl2 | ./vndcompress -w 1 -d /dev/stdin /dev/null; \ 1331.10Sriastrad then \ 1341.10Sriastrad echo 'unexpected pass!' && exit 1; \ 1351.10Sriastrad fi 1361.10Sriastrad 1371.10Sriastrad# These checks don't work unless RLIMIT_AS (i.e., ulimit -v) actually 1381.10Sriastrad# works! Apparently it doesn't... 1391.10Sriastrad 1401.10Sriastrad# CHECKS+= check-ulimit 1411.10Sriastrad# check-ulimit: 1421.10Sriastrad# @echo '# expecting failure...' 1431.10Sriastrad# if head -c 1073741824 < /dev/zero \ 1441.10Sriastrad# | (ulimit -v 20000 && \ 1451.10Sriastrad# ./vndcompress -l 1g -s 512 /dev/stdin /dev/null); then \ 1461.10Sriastrad# echo 'unexpected pass!' && exit 0; \ 1471.10Sriastrad# fi 1481.10Sriastrad 1491.10Sriastrad# CHECKS+= check-ulimit-window 1501.10Sriastrad# check-ulimit-window: 1511.10Sriastrad# head -c 1073741824 < /dev/zero \ 1521.10Sriastrad# | (ulimit -v 20000 && \ 1531.10Sriastrad# ./vndcompress -w 1 -l 1g -s 512 /dev/stdin /dev/null) 1541.10Sriastrad 1551.3SriastradTESTSUFFIXES+= in cl2 cl2x out outx 1561.3Sriastrad 1571.3SriastradTESTFORMS+= cl2 cl2x 1581.3SriastradTESTFORMS+= in out 1591.3SriastradTESTFORMS+= in outx 1601.3Sriastrad 1611.3Sriastrad.for testfile in ${TESTFILES} 1621.3Sriastrad. for suffix in ${TESTSUFFIXES} 1631.3SriastradCLEANFILES+= ${testfile}.${suffix} 1641.3SriastradCLEANFILES+= ${testfile}.${suffix}.tmp 1651.3Sriastrad. endfor 1661.3Sriastrad. for left right in ${TESTFORMS} 1671.3SriastradCHECKS.${testfile}+= check-${testfile}.${left}-${right} 1681.3Sriastradcheck-${testfile}.${left}-${right}: .PHONY \ 1691.3Sriastrad ${testfile}.${left} ${testfile}.${right} 1701.3Sriastrad. if empty(XFAIL:M${testfile}.${left}-${right}) 1711.3Sriastrad cmp ${testfile}.${left} ${testfile}.${right} 1721.3Sriastrad. else 1731.3Sriastrad @echo '# expecting failure...' \ 1741.3Sriastrad && echo 'cmp ${testfile}.${left} ${testfile}.${right}' \ 1751.3Sriastrad && if cmp ${testfile}.${left} ${testfile}.${right}; then \ 1761.3Sriastrad echo 'unexpected pass!' \ 1771.3Sriastrad && exit 1; \ 1781.3Sriastrad fi 1791.3Sriastrad. endif 1801.3Sriastrad. endfor 1811.3Sriastradcheck-${testfile}: ${CHECKS.${testfile}} 1821.3SriastradCHECKS+= check-${testfile} 1831.3Sriastrad.endfor 1841.3Sriastrad 1851.3Sriastradcheck: .PHONY ${CHECKS} 1861.3Sriastrad 1871.3Sriastrad.SUFFIXES: .cl2 .cl2x .in .out .outx 1881.3Sriastrad 1891.10Sriastrad# XXX These tests should automatically try different window sizes, but 1901.10Sriastrad# that is tricky to express in make. 1911.10Sriastrad 1921.3Sriastrad.in.cl2: vndcompress 1931.7Sriastrad ./vndcompress ${.IMPSRC} ${.TARGET}.tmp ${BLOCKSIZE.${.PREFIX}} \ 1941.7Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1951.3Sriastrad 1961.3Sriastrad.in.cl2x: 1971.7Sriastrad vndcompress ${.IMPSRC} ${.TARGET}.tmp ${BLOCKSIZE.${.PREFIX}} \ 1981.7Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 1991.3Sriastrad 2001.3Sriastrad.cl2.out: vndcompress 2011.7Sriastrad ./vndcompress -d ${.IMPSRC} ${.TARGET}.tmp \ 2021.7Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 2031.3Sriastrad 2041.3Sriastrad.cl2.outx: 2051.7Sriastrad vnduncompress ${.IMPSRC} ${.TARGET}.tmp \ 2061.7Sriastrad && mv -f ${.TARGET}.tmp ${.TARGET} 207