38f0ab
--- jbigkit/pbmtools/Makefile.shlib	2008-08-25 23:26:39.000000000 +0100
38f0ab
+++ jbigkit/pbmtools/Makefile	2008-09-03 16:41:20.000000000 +0100
38f0ab
@@ -5,23 +5,23 @@
38f0ab
 CC = gcc
38f0ab
 
38f0ab
 # Options for the compiler
38f0ab
-CFLAGS = -g -Wall -ansi -pedantic -I../libjbig # --coverage
38f0ab
+CFLAGS ?= -g -Wall -ansi -pedantic -I../libjbig # --coverage
38f0ab
 
38f0ab
 .SUFFIXES: .1 .5 .txt $(SUFFIXES)
38f0ab
 
38f0ab
 all: pbmtojbg jbgtopbm pbmtojbg85 jbgtopbm85 \
38f0ab
-	pbmtojbg.txt jbgtopbm.txt pbm.txt pgm.txt
38f0ab
+#	pbmtojbg.txt jbgtopbm.txt pbm.txt pgm.txt
38f0ab
 
38f0ab
-pbmtojbg: pbmtojbg.o ../libjbig/libjbig.a
38f0ab
+pbmtojbg: pbmtojbg.o ../libjbig/libjbig.so
38f0ab
 	$(CC) $(CFLAGS) -o pbmtojbg pbmtojbg.o -L../libjbig -ljbig
38f0ab
 
38f0ab
-jbgtopbm: jbgtopbm.o ../libjbig/libjbig.a
38f0ab
+jbgtopbm: jbgtopbm.o ../libjbig/libjbig.so
38f0ab
 	$(CC) $(CFLAGS) -o jbgtopbm jbgtopbm.o -L../libjbig -ljbig
38f0ab
 
38f0ab
-pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig85.a
38f0ab
+pbmtojbg85: pbmtojbg85.o ../libjbig/libjbig85.so
38f0ab
 	$(CC) $(CFLAGS) -o pbmtojbg85 pbmtojbg85.o -L../libjbig -ljbig85
38f0ab
 
38f0ab
-jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig85.a
38f0ab
+jbgtopbm85: jbgtopbm85.o ../libjbig/libjbig85.so
38f0ab
 	$(CC) $(CFLAGS) -o jbgtopbm85 jbgtopbm85.o -L../libjbig -ljbig85
38f0ab
 
38f0ab
 jbgtopbm.o: jbgtopbm.c ../libjbig/jbig.h
38f0ab
@@ -29,13 +29,13 @@ pbmtojbg.o: pbmtojbg.c ../libjbig/jbig.h
38f0ab
 jbgtopbm85.o: jbgtopbm85.c ../libjbig/jbig85.h
38f0ab
 pbmtojbg85.o: pbmtojbg85.c ../libjbig/jbig85.h
38f0ab
 
38f0ab
-../libjbig/libjbig.a: ../libjbig/jbig.c ../libjbig/jbig.h \
38f0ab
+../libjbig/libjbig.so: ../libjbig/jbig.c ../libjbig/jbig.h \
38f0ab
 	../libjbig/jbig_ar.c ../libjbig/jbig_ar.h
38f0ab
-	make -C ../libjbig libjbig.a
38f0ab
+	make -C ../libjbig libjbig.so
38f0ab
 
38f0ab
-../libjbig/libjbig85.a: ../libjbig/jbig85.c ../libjbig/jbig85.h \
38f0ab
+../libjbig/libjbig85.so: ../libjbig/jbig85.c ../libjbig/jbig85.h \
38f0ab
 	../libjbig/jbig_ar.c ../libjbig/jbig_ar.h
38f0ab
-	make -C ../libjbig libjbig85.a
38f0ab
+	make -C ../libjbig libjbig85.so
38f0ab
 
38f0ab
 test: test82 test85
38f0ab
 
38f0ab
--- jbigkit/libjbig/Makefile.shlib	2008-08-30 18:20:52.000000000 +0100
38f0ab
+++ jbigkit/libjbig/Makefile	2008-09-03 16:40:43.000000000 +0100
38f0ab
@@ -5,25 +5,27 @@
38f0ab
 CC = gcc
38f0ab
 
38f0ab
 # Options for the compiler: A high optimization level is suggested
38f0ab
-CFLAGS = -g -O -Wall -ansi -pedantic # --coverage
38f0ab
+CFLAGS ?= -g -O -Wall -ansi -pedantic # --coverage
38f0ab
+PICFLAGS := -fPIC -DPIC
38f0ab
 
38f0ab
-all: libjbig.a tstcodec tstcodec85
38f0ab
+all: libjbig.so.$(VERSION) tstcodec tstcodec85
38f0ab
 
38f0ab
-tstcodec: tstcodec.o jbig.o jbig_ar.o
38f0ab
-	$(CC) $(CFLAGS) -o tstcodec $+
38f0ab
+tstcodec: tstcodec.o libjbig.so
38f0ab
+	$(CC) $(CFLAGS) -o tstcodec $< -L. -ljbig
38f0ab
 
38f0ab
-tstcodec85: tstcodec85.o jbig85.o jbig_ar.o
38f0ab
-	$(CC) $(CFLAGS) -o tstcodec85 $+
38f0ab
+tstcodec85: tstcodec85.o libjbig85.so
38f0ab
+	$(CC) $(CFLAGS) -o tstcodec85 $^ -L. -ljbig
38f0ab
 
38f0ab
-libjbig.a: jbig.o jbig_ar.o
38f0ab
-	rm -f libjbig.a
38f0ab
-	ar rc libjbig.a jbig.o jbig_ar.o
38f0ab
-	-ranlib libjbig.a
38f0ab
+%.so: %.so.$(VERSION)
38f0ab
+	ln -sf $< $@
38f0ab
 
38f0ab
-libjbig85.a: jbig85.o jbig_ar.o
38f0ab
-	rm -f libjbig85.a
38f0ab
-	ar rc libjbig85.a jbig85.o jbig_ar.o
38f0ab
-	-ranlib libjbig85.a
38f0ab
+libjbig.so.$(VERSION): jbig.o jbig_ar.o
38f0ab
+	$(CC) $(CFLAGS) -shared -Wl,-soname,$@ -o $@ $^
38f0ab
+
38f0ab
+libjbig85.so.$(VERSION): jbig85.o jbig_ar.o
38f0ab
+	$(CC) $(CFLAGS) -shared -Wl,-soname,$@ -o $@ $^
38f0ab
+
38f0ab
+jbig.o jbig85.o jbig_ar.o: CFLAGS += $(PICFLAGS)
38f0ab
 
38f0ab
 jbig.o: jbig.c jbig.h jbig_ar.h
38f0ab
 jbig85.o: jbig85.c jbig85.h jbig_ar.h
38f0ab
@@ -37,12 +39,12 @@ jbig.pot: jbig.c
38f0ab
 	  --msgid-bugs-address='http://www.cl.cam.ac.uk/~mgk25/jbigkit/' $+
38f0ab
 
38f0ab
 test: tstcodec tstcodec85
38f0ab
-	./tstcodec
38f0ab
-	./tstcodec85
38f0ab
+	LD_LIBRARY_PATH=`pwd` ./tstcodec
38f0ab
+	LD_LIBRARY_PATH=`pwd` ./tstcodec85
38f0ab
 
38f0ab
 t82test.pbm: tstcodec
38f0ab
-	./tstcodec $@
38f0ab
+	LD_LIBRARY_PATH=`pwd` ./tstcodec $@
38f0ab
 
38f0ab
 clean:
38f0ab
 	rm -f *.{o,gcda,gcno,gcov} *~ core gmon.out dbg_d\=??.pbm t82test.pbm
38f0ab
-	rm -f tstcodec tstcodec85
38f0ab
+	rm -f tstcodec tstcodec85 *.so *.so.$(VERSION)
38f0ab
--- jbigkit/Makefile.shlib	2008-08-30 21:40:22.000000000 +0100
38f0ab
+++ jbigkit/Makefile	2008-09-03 16:40:43.000000000 +0100
38f0ab
@@ -11,24 +11,25 @@ CCFLAGS = -O2 -W
38f0ab
 CFLAGS = $(CCFLAGS) -I../libjbig
38f0ab
 
38f0ab
 VERSION=2.0
38f0ab
+export VERSION CFLAGS CC
38f0ab
 
38f0ab
 all: lib pbm
38f0ab
 	@echo "Enter 'make test' in order to start some automatic tests."
38f0ab
 
38f0ab
 lib:
38f0ab
-	(cd libjbig;  make "CC=$(CC)" "CFLAGS=$(CFLAGS)")
38f0ab
+	make -C libjbig
38f0ab
 
38f0ab
 pbm: lib
38f0ab
-	(cd pbmtools; make "CC=$(CC)" "CFLAGS=$(CFLAGS)")
38f0ab
+	make -C pbmtools
38f0ab
 
38f0ab
 test: lib pbm
38f0ab
-	(cd libjbig;  make "CC=$(CC)" "CFLAGS=$(CFLAGS)" test)
38f0ab
-	(cd pbmtools; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" test)
38f0ab
+	LD_LIBRARY_PATH=`pwd`/libjbig make -C libjbig test
38f0ab
+	LD_LIBRARY_PATH=`pwd`/libjbig make -C pbmtools test
38f0ab
 
38f0ab
 clean:
38f0ab
 	rm -f *~ core
38f0ab
-	(cd libjbig; make clean)
38f0ab
-	(cd pbmtools; make clean)
38f0ab
+	make -C libjbig clean
38f0ab
+	make -C pbmtools clean
38f0ab
 
38f0ab
 distribution: clean
38f0ab
 	rm -f libjbig/libjbig*.a