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