--- a/jdlib/Makefile
+++ b/jdlib/Makefile
@@ -2,21 +2,18 @@
 #     Coded by Diederik R. Fokkema
 #
 #     $Id$
-# 
+#
 #
 
 export SHELL=/bin/sh
-export FC = f77
-export FFLAGS = -u -O
 
-LIB = libjdqz.a
+LIB = libjdqz.so.0
+SOURCES = $(wildcard *.f)
+OBJS = $(SOURCES:.f=.o)
 
-OBJS = $(patsubst %.f,%.o,$(wildcard *.f))
+.PHONY: all
+all: ${LIB}
 
-$(LIB): $(LIB)($(OBJS)) 
-	ranlib $@
+$(LIB): $(OBJS)
+	$(FC) -fPIC ${FCFLAGS} $(OBJS) -o $@ ${LDFLAGS} -shared -Wl,-soname,libjdqz.so.0
 
-$(LIB)(jdqz.o): jdqz.f
-	$(FC) -u -O1 -c jdqz.f
-	$(AR) rv $(LIB) jdqz.o
-	-rm jdqz.o
--- a/jdtest/Makefile
+++ b/jdtest/Makefile
@@ -1,13 +1,10 @@
-FC = f77
-FFLAGS = -u -O
-
 LIBPATH = -L../jdlib
-LIBS = -ljdqz -llapack -lblas
+LIBS = -ljdqz
 SUBDIRS = ../jdlib
 OBJ = example.o
 
 all: 	$(OBJ)
-	$(FC) $(LDFLAGS) -o example $(OBJ) $(LIBPATH) $(LIBS)
+	$(FC) -fPIE $(FCFLAGS) $(LDFLAGS) -o example $(OBJ) $(LIBPATH) $(LIBS)
 
 clean:
 	-rm -f example
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,11 @@
-FC = f77
-FFLAGS = -u -O
-
 LIBPATH = -L../jdlib
-LIBS = -ljdqr -llapack -lblas
+LIBS = -ljdqr
 SUBDIRS = jdlib
 TEST    = jdtest
 
 all: 	libs jdqr
 
-jdqr: 	
+jdqr:
 	@for i in $(TEST); do (cd $$i; $(MAKE)); done
 
 libs:
