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