Makefile revision 1.9
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.3SriastradTESTSUFFIXES+=	in cl2 cl2x out outx
1191.3Sriastrad
1201.3SriastradTESTFORMS+=	cl2 cl2x
1211.3SriastradTESTFORMS+=	in out
1221.3SriastradTESTFORMS+=	in outx
1231.3Sriastrad
1241.3Sriastrad.for testfile in ${TESTFILES}
1251.3Sriastrad.  for suffix in ${TESTSUFFIXES}
1261.3SriastradCLEANFILES+=	${testfile}.${suffix}
1271.3SriastradCLEANFILES+=	${testfile}.${suffix}.tmp
1281.3Sriastrad.  endfor
1291.3Sriastrad.  for left right in ${TESTFORMS}
1301.3SriastradCHECKS.${testfile}+=	check-${testfile}.${left}-${right}
1311.3Sriastradcheck-${testfile}.${left}-${right}: .PHONY \
1321.3Sriastrad  ${testfile}.${left} ${testfile}.${right}
1331.3Sriastrad.    if empty(XFAIL:M${testfile}.${left}-${right})
1341.3Sriastrad	cmp ${testfile}.${left} ${testfile}.${right}
1351.3Sriastrad.    else
1361.3Sriastrad	@echo '# expecting failure...' \
1371.3Sriastrad	&& echo 'cmp ${testfile}.${left} ${testfile}.${right}' \
1381.3Sriastrad	&& if cmp ${testfile}.${left} ${testfile}.${right}; then \
1391.3Sriastrad	  echo 'unexpected pass!' \
1401.3Sriastrad	  && exit 1; \
1411.3Sriastrad	fi
1421.3Sriastrad.    endif
1431.3Sriastrad.  endfor
1441.3Sriastradcheck-${testfile}: ${CHECKS.${testfile}}
1451.3SriastradCHECKS+=	check-${testfile}
1461.3Sriastrad.endfor
1471.3Sriastrad
1481.3Sriastradcheck: .PHONY ${CHECKS}
1491.3Sriastrad
1501.3Sriastrad.SUFFIXES: .cl2 .cl2x .in .out .outx
1511.3Sriastrad
1521.3Sriastrad.in.cl2: vndcompress
1531.7Sriastrad	./vndcompress ${.IMPSRC} ${.TARGET}.tmp ${BLOCKSIZE.${.PREFIX}} \
1541.7Sriastrad	&& mv -f ${.TARGET}.tmp ${.TARGET}
1551.3Sriastrad
1561.3Sriastrad.in.cl2x:
1571.7Sriastrad	vndcompress ${.IMPSRC} ${.TARGET}.tmp ${BLOCKSIZE.${.PREFIX}} \
1581.7Sriastrad	&& mv -f ${.TARGET}.tmp ${.TARGET}
1591.3Sriastrad
1601.3Sriastrad.cl2.out: vndcompress
1611.7Sriastrad	./vndcompress -d ${.IMPSRC} ${.TARGET}.tmp \
1621.7Sriastrad	&& mv -f ${.TARGET}.tmp ${.TARGET}
1631.3Sriastrad
1641.3Sriastrad.cl2.outx:
1651.7Sriastrad	vnduncompress ${.IMPSRC} ${.TARGET}.tmp \
1661.7Sriastrad	&& mv -f ${.TARGET}.tmp ${.TARGET}
167