diff -uNr LAPACK.ORIG/BLAS/SRC/Makefile LAPACK/BLAS/SRC/Makefile
--- LAPACK.ORIG/BLAS/SRC/Makefile	2005-05-26 21:32:12.000000000 +0900
+++ LAPACK/BLAS/SRC/Makefile	2005-05-26 21:34:23.000000000 +0900
@@ -1,5 +1,43 @@
-clean:
-	rm -f *.o libblas.a libblas.so*
+#--
+# Package name, version No., etc.
+#--
+PACKAGENAME = blas
+MAJVER      = 3
+MINVER      = 0.3
+REV         = $(MAJVER).$(MINVER)
+LIBBASENAME = lib$(PACKAGENAME)
+
+DESTDIR     =
+
+ifeq ($(shell uname),Darwin)
+#--
+# MacOS X 10.4
+#--
+FC        = gfortran
+FFLAGS    = -O
+OPTS      = -ftree-vectorize
+LD        = $(FC)
+SOEXT     = dylib
+SOFLAGS   = -dynamiclib -undefined dynamic_lookup -install_name 
+SONAME    = $(LIBBASENAME).$(MAJVER).$(SOEXT)
+SOLIBNAME = $(LIBBASENAME).$(REV).$(SOEXT)
+LIBNAME   = $(LIBBASENAME).a
+INSTALLDIR  = /usr/local/lib
+else
+#--
+# Linux, etc., using g77
+#--
+FC        = g77
+FFLAGS    = -O -fPIC
+OPTS      =
+LD        = $(FC)
+SOEXT     = so
+SOFLAGS   = -shared -Wl,-sonmae,
+SONAME    = $(LIBBASENAME).$(SOEXT).$(MAJVER)
+SOLIBNAME = $(LIBBASENAME).$(SOEXT).$(REV)
+LIBNAME   = $(LIBBASENAME).a
+INSTALLDIR  = /usr/lib
+endif
 
 OBJS=	caxpy.o ccopy.o cdotc.o cdotu.o cgbmv.o cgemm.o cgemv.o \
 	cgerc.o cgeru.o chbmv.o chemm.o chemv.o cher.o cher2.o \
@@ -24,8 +62,30 @@
 	ztrsv.o  
 
 static: $(OBJS)
-	ar ruv libblas.a $(OBJS)
-	ranlib libblas.a
+	ar ruv $(LIBNAME) $(OBJS)
+	ranlib $(LIBNAME)
 
 shared: $(OBJS)
-	cc -shared -Wl,-soname,libblas.so.3 -o libblas.so.3.0.3 *.o -lm -lg2c -lc
+	$(LD) $(SOFLAGS)$(SONAME) -o $(SOLIBNAME) *.o
+
+install: $(LIBNAME) libdir
+	install -m 755 $(LIBNAME) $(DESTDIR)$(INSTALLDIR)
+
+install.so: $(SOLIBNAME) libdir
+	install -m 755 $(SOLIBNAME) $(DESTDIR)$(INSTALLDIR)
+	ln -sf $(SOLIBNAME) $(DESTDIR)$(INSTALLDIR)/$(SONAME)
+	ln -sf $(SOLIBNAME) $(DESTDIR)$(INSTALLDIR)/$(LIBBASENAME).$(SOEXT)
+
+libdir:
+	if [ ! -d $(DESTDIR)$(INSTALLDIR) ]; then \
+		mkdir -p $(DESTDIR)$(INSTALLDIR); \
+	fi
+
+clean:
+	rm -f *.o lib*.$(SOEXT) lib*.a
+
+.f.o:
+	$(FC) $(FFLAGS) $(OPTS) -c $<
+
+.PHONY: libdir install install.so
+
diff -uNr LAPACK.ORIG/SRC/Makefile LAPACK/SRC/Makefile
--- LAPACK.ORIG/SRC/Makefile	2005-05-26 21:32:12.000000000 +0900
+++ LAPACK/SRC/Makefile	2005-05-26 21:32:13.000000000 +0900
@@ -1,5 +1,43 @@
-clean:
-	rm -f *.o liblapack*
+#--
+# Package name, version No., etc.
+#--
+PACKAGENAME = lapack
+MAJVER      = 3
+MINVER      = 0.3
+REV         = $(MAJVER).$(MINVER)
+LIBBASENAME = lib$(PACKAGENAME)
+
+DESTDIR     =
+
+ifeq ($(shell uname),Darwin)
+#--
+# MacOS X 10.4
+#--
+FC        = gfortran
+FFLAGS    = -O
+OPTS      = -ftree-vectorize
+LD        = $(FC)
+SOEXT     = dylib
+SOFLAGS   = -dynamiclib -undefined dynamic_lookup -install_name 
+SONAME    = $(LIBBASENAME).$(MAJVER).$(SOEXT)
+SOLIBNAME = $(LIBBASENAME).$(REV).$(SOEXT)
+LIBNAME   = $(LIBBASENAME).a
+INSTALLDIR  = /usr/local/lib
+else
+#--
+# Linux, etc., using g77
+#--
+FC        = g77
+FFLAGS    = -O -fPIC
+OPTS      =
+LD        = $(FC)
+SOEXT     = so
+SOFLAGS   = -shared -Wl,-sonmae,
+SONAME    = $(LIBBASENAME).$(SOEXT).$(MAJVER)
+SOLIBNAME = $(LIBBASENAME).$(SOEXT).$(REV)
+LIBNAME   = $(LIBBASENAME).a
+INSTALLDIR  = /usr/lib
+endif
 
 OBJS=	cbdsqr.o cgbbrd.o cgbcon.o cgbequ.o cgbrfs.o cgbsv.o \
 	cgbsvx.o cgbtf2.o cgbtrf.o cgbtrs.o cgebak.o cgebal.o \
@@ -219,8 +257,29 @@
 	zupmtr.o
 
 static: $(OBJS)
-	ar ruv liblapack.a $(OBJS)
-	ranlib liblapack.a
+	ar ruv $(LIBNAME) $(OBJS)
+	ranlib $(LIBNAME)
 
 shared: $(OBJS)
-	cc -shared -Wl,-soname,liblapack.so.3 -o liblapack.so.3.0.3 *.o -L.. -lblas -lm -lg2c -lc
+	$(LD) $(SOFLAGS)$(SONAME) -o $(SOLIBNAME) *.o -L../BLAS/SRC -lblas
+
+install: $(LIBNAME) libdir
+	install -m 755 $(LIBNAME) $(DESTDIR)$(INSTALLDIR)
+
+install.so: $(SOLIBNAME) libdir
+	install -m 755 $(SOLIBNAME) $(DESTDIR)$(INSTALLDIR)
+	ln -sf $(SOLIBNAME) $(DESTDIR)$(INSTALLDIR)/$(SONAME)
+	ln -sf $(SOLIBNAME) $(DESTDIR)$(INSTALLDIR)/$(LIBBASENAME).$(SOEXT)
+
+libdir:
+	if [ ! -d $(DESTDIR)$(INSTALLDIR) ]; then \
+		mkdir -p $(DESTDIR)$(INSTALLDIR); \
+	fi
+
+clean:
+	rm -f *.o lib*.$(SOEXT) lib*.a
+
+.f.o:
+	$(FC) $(FFLAGS) $(OPTS) -c $<
+
+.PHONY: libdir install install.so
