# Unix makefile for the JBIG-KIT PBM tools SHELL = /bin/sh prefix=/dev/env/DJDIR EXEEXT = .exe # Select an ANSI/ISO C compiler here, e.g. GNU gcc is recommended CC = gcc # Options for the compiler #CFLAGS = -g -O -W -Wall -Wno-unused-result -ansi -pedantic # --coverage CFLAGS = -O2 -Wall -pedantic -I../libjbig CPPFLAGS = -I../libjbig .SUFFIXES: .1 .5 .txt $(SUFFIXES) .PHONY: txt test test82 test85 clean all: pbmtojbg$(EXEEXT) jbgtopbm$(EXEEXT) pbmtojbg85$(EXEEXT) jbgtopbm85$(EXEEXT) txt txt: pbmtojbg.txt jbgtopbm.txt pbm.txt pgm.txt install: pbmtojbg$(EXEEXT) jbgtopbm$(EXEEXT) mkdir -p $(prefix)/bin mkdir -p $(prefix)/share/man/man1 mkdir -p $(prefix)/share/man/man5 /dev/env/DJDIR/bin/ginstall -c pbmtojbg$(EXEEXT) $(prefix)/bin/pbmtojbg$(EXEEXT) /dev/env/DJDIR/bin/ginstall -c jbgtopbm$(EXEEXT) $(prefix)/bin/jbgtopbm$(EXEEXT) /dev/env/DJDIR/bin/ginstall -c pbmtojbg85$(EXEEXT) $(prefix)/bin/85pbmtojbg$(EXEEXT) /dev/env/DJDIR/bin/ginstall -c jbgtopbm85$(EXEEXT) $(prefix)/bin/85jbgtopbm$(EXEEXT) /dev/env/DJDIR/bin/ginstall -c jbgtopbm.1 $(prefix)/share/man/man1/jbgtopbm.1 /dev/env/DJDIR/bin/ginstall -c pbmtojbg.1 $(prefix)/share/man/man1/pbmtojbg.1 /dev/env/DJDIR/bin/ginstall -c pbm.5 $(prefix)/share/man/man5/pbm.5 pbmtojbg$(EXEEXT): pbmtojbg.o ../libjbig/libjbig.a $(CC) $(CFLAGS) -o pbmtojbg$(EXEEXT) pbmtojbg.o -L../libjbig -ljbig jbgtopbm$(EXEEXT): jbgtopbm.o ../libjbig/libjbig.a $(CC) $(CFLAGS) -o jbgtopbm$(EXEEXT) jbgtopbm.o -L../libjbig -ljbig pbmtojbg85$(EXEEXT): pbmtojbg85.o ../libjbig/libjbig85.a $(CC) $(CFLAGS) -o pbmtojbg85$(EXEEXT) pbmtojbg85.o -L../libjbig -ljbig85 jbgtopbm85$(EXEEXT): jbgtopbm85.o ../libjbig/libjbig85.a $(CC) $(CFLAGS) -o jbgtopbm85$(EXEEXT) jbgtopbm85.o -L../libjbig -ljbig85 jbgtopbm.o: jbgtopbm.c ../libjbig/jbig.h pbmtojbg.o: pbmtojbg.c ../libjbig/jbig.h jbgtopbm85.o: jbgtopbm85.c ../libjbig/jbig85.h pbmtojbg85.o: pbmtojbg85.c ../libjbig/jbig85.h ../libjbig/libjbig.a: ../libjbig/jbig.c ../libjbig/jbig.h \ ../libjbig/jbig_ar.c ../libjbig/jbig_ar.h make -C ../libjbig libjbig.a ../libjbig/libjbig85.a: ../libjbig/jbig85.c ../libjbig/jbig85.h \ ../libjbig/jbig_ar.c ../libjbig/jbig_ar.h make -C ../libjbig libjbig85.a analyze: clang $(CPPFLAGS) --analyze *.c test: test82 test85 test82: pbmtojbg$(EXEEXT) jbgtopbm$(EXEEXT) make IMG=ccitt1 OPTIONSP= dotest1 make IMG=ccitt2 OPTIONSP= dotest1 make IMG=ccitt3 OPTIONSP= dotest1 make IMG=xvlogo "OPTIONSP=-d 3" dotest1 make IMG=sandra OPTIONSP= OPTIONSJ= dotest2g make IMG=sandra OPTIONSP=-b OPTIONSJ=-b dotest2g make IMG=sandra OPTIONSP=-q OPTIONSJ= dotest2g make IMG=sandra "OPTIONSP=-o 0" OPTIONSJ= dotest2g make IMG=sandra "OPTIONSP=-o 2" OPTIONSJ= dotest2g make IMG=multi OPTIONSP= OPTIONSJ= dotest2g make IMG=multi OPTIONSP=-b OPTIONSJ=-b dotest2g make IMG=mx "OPTIONSP=-q -s 3 -m 128" dotest1 make IMG=mx "OPTIONSP=-q -s 3 -m 128" dotest2b make IMG=mx "OPTIONSP=-q -s 3 -m 128 -p 92" dotest2b make IMG=mx "OPTIONSP=-q -Y -1" dotest2b make IMG=mx "OPTIONSP=-Y -1" dotest2b rm -f test-*.jbg test-*.pbm test-*.pgm ./jbgtopbm$(EXEEXT) ../examples/ccitt1.jbg | ./pbmtojbg > test-ccitt1.jbg cmp ../examples/ccitt1.jbg test-ccitt1.jbg rm -f test-*.jbg test-*.pbm test-*.pgm ./jbgtopbm$(EXEEXT) < ../examples/ccitt1.jbg | ./pbmtojbg - test-ccitt1.jbg cmp ../examples/ccitt1.jbg test-ccitt1.jbg rm -f test-*.jbg test-*.pbm test-*.pgm ./jbgtopbm$(EXEEXT) < ../examples/ccitt1.jbg - test-ccitt1.pbm ; \ ./pbmtojbg$(EXEEXT) test-ccitt1.pbm test-ccitt1.jbg cmp ../examples/ccitt1.jbg test-ccitt1.jbg rm -f test-*.jbg test-*.pbm test-*.pgm ./jbgtopbm$(EXEEXT) ../examples/ccitt1.jbg test-ccitt1.pbm ; \ ./pbmtojbg$(EXEEXT) test-ccitt1.pbm >test-ccitt1.jbg cmp ../examples/ccitt1.jbg test-ccitt1.jbg rm -f test-*.jbg test-*.pbm test-*.pgm @echo @echo "The pbmtools have PASSED the functional tests. Good!" @echo dotest1: ./jbgtopbm$(EXEEXT) ../examples/$(IMG).jbg test-$(IMG).pbm ./pbmtojbg$(EXEEXT) $(OPTIONSP) test-$(IMG).pbm test-$(IMG).jbg cmp test-$(IMG).jbg ../examples/$(IMG).jbg dotest2b: ./pbmtojbg$(EXEEXT) $(OPTIONSP) test-$(IMG).pbm test-$(IMG).jbg ./jbgtopbm$(EXEEXT) $(OPTIONSJ) test-$(IMG).jbg test-$(IMG)-2.pbm cmp test-$(IMG).pbm test-$(IMG)-2.pbm dotest2g: ./pbmtojbg$(EXEEXT) $(OPTIONSP) ../examples/$(IMG).pgm test-$(IMG).jbg ./jbgtopbm$(EXEEXT) $(OPTIONSJ) test-$(IMG).jbg test-$(IMG).pgm cmp test-$(IMG).pgm ../examples/$(IMG).pgm test85: pbmtojbg$(EXEEXT) jbgtopbm$(EXEEXT) pbmtojbg85$(EXEEXT) jbgtopbm85$(EXEEXT) test-t82.pbm make IMG=t82 "OPTIONSP=-p 0" dotest85 make IMG=t82 "OPTIONSP=-p 8" dotest85 make IMG=t82 "OPTIONSP=-p 8 -r" dotest85b make IMG=t82 "OPTIONSP=-p 64" dotest85 make IMG=t82 "OPTIONSP=-p 72" dotest85 make IMG=t82 "OPTIONSP=-s 2 -C c" dotest85 make IMG=t82 "OPTIONSP=-s 99999" dotest85 make IMG=t82 "OPTIONSP=-Y 9999 0" dotest85 make IMG=t82 "OPTIONSP=-Y 1951 0" dotest85 make IMG=t82 "OPTIONSP=-Y -1 127" dotest85 make IMG=t82 "OPTIONSP=-Y -1 128" dotest85 make IMG=t82 "OPTIONSP=-Y -1 1919" dotest85 make IMG=t82 "OPTIONSP=-Y -1 1920" dotest85 make IMG=t82 "OPTIONSP=-Y -1 1949" dotest85 make IMG=t82 "OPTIONSP=-Y -1 1950" dotest85 make IMG=ccitt1 dotest85 make IMG=ccitt2 dotest85 make IMG=ccitt3 dotest85 rm -f test-*.jbg test-*.jbg85 test-*.pbm @echo @echo "The T.85 pbmtools have PASSED the functional tests. Good!" @echo dotest85: test-$(IMG).pbm ./pbmtojbg85$(EXEEXT) $(OPTIONSP) test-$(IMG).pbm test-$(IMG).jbg85 ls -l test-$(IMG).jbg85 ./jbgtopbm$(EXEEXT) test-$(IMG).jbg85 test-$(IMG).pbm85 cmp test-$(IMG).pbm test-$(IMG).pbm85 rm test-$(IMG).pbm85 ./jbgtopbm85$(EXEEXT) test-$(IMG).jbg85 test-$(IMG).pbm85 cmp test-$(IMG).pbm test-$(IMG).pbm85 rm test-$(IMG).pbm85 ./jbgtopbm85$(EXEEXT) -B 1 test-$(IMG).jbg85 test-$(IMG).pbm85 cmp test-$(IMG).pbm test-$(IMG).pbm85 dotest85b: test-$(IMG).pbm ./pbmtojbg$(EXEEXT) -f $(OPTIONSP) test-$(IMG).pbm test-$(IMG).jbg85 ls -l test-$(IMG).jbg85 ./jbgtopbm$(EXEEXT) test-$(IMG).jbg85 test-$(IMG).pbm85 cmp test-$(IMG).pbm test-$(IMG).pbm85 rm test-$(IMG).pbm85 ./jbgtopbm85$(EXEEXT) test-$(IMG).jbg85 test-$(IMG).pbm85 cmp test-$(IMG).pbm test-$(IMG).pbm85 rm test-$(IMG).pbm85 ./jbgtopbm85$(EXEEXT) -B 1 test-$(IMG).jbg85 test-$(IMG).pbm85 cmp test-$(IMG).pbm test-$(IMG).pbm85 test-%.pbm: ../examples/%.jbg ./jbgtopbm$(EXEEXT) $< $@ test-t82.pbm: make -C ../libjbig tstcodec$(EXEEXT) ../libjbig/tstcodec$(EXEEXT) $@ FOPT=-c 1000 -p 300000 -m 3 fuzz: test-t82.pbm while \ ./pbmtojbg$(EXEEXT) -f test-t82.pbm | ./jbgfuzz.pl $(FOPT) && \ ./pbmtojbg$(EXEEXT) test-t82.pbm | ./jbgfuzz.pl $(FOPT) -d jbgtopbm ; \ do true; done .1.txt .5.txt: groff -man -Tascii -P -b -P -u $< >$@ clean: rm -f *.o *~ core pbmtojbg$(EXEEXT) jbgtopbm$(EXEEXT) pbmtojbg85$(EXEEXT) jbgtopbm85$(EXEEXT) rm -f test-*.jbg test-*.pbm test-*.pgm test-*.jbg85 test-*.pbm85 rm -f *.gcda *.gcno *.plist