--- Makefile.in	2000-05-10 15:39:03.000000000 +0200
+++ Makefile.in	2006-03-15 09:04:18.000000000 +0100
@@ -2,6 +2,8 @@
       sha.c shahl.c rmd160.c rmd160hl.c
 OBJ = $(SRC:.c=.o)
 
+PREFIX	= @prefix@
+INCDIR	= @includedir@
 CC      = @CC@
 CFLAGS  = -O3 -fPIC -I.
 RANLIB  = @RANLIB@
@@ -15,10 +17,10 @@
 OUTDIR=$(PWD)/..
 SRCDIR=$(PWD)
 
-all:	libmd.so.1.0 md2.3 md4.3 md5.3 libmd.a docs
+all:	libmd.1.0.dylib md2.3 md4.3 md5.3 libmd.a docs
 
 clean:
-	rm -f *.o core libmd.a libmd.so* md[245]hl.c md[245].3\
+	rm -f *.o core libmd.a libmd.*dylib md[245]hl.c md[245].3\
         shahl.c rmd160hl.c mddriver
 	(cd docs;make clean)
 
@@ -31,18 +33,18 @@
 test:	mddriver
 	./mddriver
 
-install:	libmd.so.1.0 libmd.so.1 libmd.so
-	mkdir -p $(BUILDROOT)/usr/include
-	mkdir -p $(BUILDROOT)/usr/lib
-	mkdir -p $(BUILDROOT)/usr/man/man3
-	$(INSTALL) -g root -o root -m 644 md2.h md4.h md5.h sha.h rmd160.h \
-		   $(BUILDROOT)/usr/include
-	$(INSTALL) -g root -o root -m 644 md2.3 md4.3 md5.3 \
-		   $(BUILDROOT)/usr/man/man3
-	$(INSTALL) -g root -o root -m 755 libmd.so.1.0 $(BUILDROOT)/usr/lib
-	$(INSTALL) -g root -o root -m 755 libmd.so.1 $(BUILDROOT)/usr/lib
-	$(INSTALL) -g root -o root -m 755 libmd.so $(BUILDROOT)/usr/lib
-	$(INSTALL) -g root -o root -m 755 libmd.a $(BUILDROOT)/usr/lib
+install:	libmd.1.0.dylib libmd.1.dylib libmd.dylib
+	mkdir -p $(DESTDIR)$(INCDIR)
+	mkdir -p $(DESTDIR)$(PREFIX)/lib
+	mkdir -p $(DESTDIR)$(PREFIX)/share/man/man3
+	$(INSTALL) -m 644 md2.h md4.h md5.h sha.h rmd160.h \
+		   $(DESTDIR)$(INCDIR)
+	$(INSTALL) -m 644 md2.3 md4.3 md5.3 \
+		   $(DESTDIR)$(PREFIX)/share/man/man3
+	$(INSTALL) -m 755 libmd.1.0.dylib $(DESTDIR)$(PREFIX)/lib
+	$(INSTALL) -m 755 libmd.1.dylib $(DESTDIR)$(PREFIX)/lib
+	$(INSTALL) -m 755 libmd.dylib $(DESTDIR)$(PREFIX)/lib
+	$(INSTALL) -m 755 libmd.a $(DESTDIR)$(PREFIX)/lib
 
 binary:	install
 	@echo Creating binary .tar.bz2 in directory $(OUTDIR)/
@@ -50,15 +52,15 @@
 	bzip2 -9f $(OUTDIR)/libmd-$(VERS)-$(OSTYPE).tar
 
 tarball: mrproper
-	@echo Creating source .tar.bz2 in directory $(OUTDIR)/
+	@echo Creating.dyliburce .tar.bz2 in directory $(OUTDIR)/
 	cd .. && tar cf $(OUTDIR)/libmd-$(VERS).tar libmd-$(VERS)/
 	bzip2 -9f $(OUTDIR)/libmd-$(VERS).tar
 
-libmd.so.1:
-	$(LN_S) libmd.so.1.0 libmd.so.1
+libmd.1.dylib:
+	$(LN_S) libmd.1.0.dylib libmd.1.dylib
 
-libmd.so:
-	$(LN_S) libmd.so.1.0 libmd.so
+libmd.dylib:
+	$(LN_S) libmd.1.0.dylib libmd.dylib
 
 md2hl.c: mdXhl.c
 	sed -e 's/mdX/md2/g' -e 's/MDX/MD2/g' $? > $@
@@ -87,15 +89,15 @@
 	sed -e 's/mdX/md5/g' -e 's/MDX/MD5/g' $? > $@
 	cat md5.copyright >> $@
 
-libmd.so.1.0:	$(OBJ)
-	$(CC) -shared -o libmd.so.1.0 $(OBJ)
+libmd.1.0.dylib:	$(OBJ)
+	$(CC) -dynamiclib -o libmd.1.0.dylib $(OBJ) -install_name $(PREFIX)/lib/$@ -current_version $(VERS)
 
 libmd.a:	$(OBJ)
 	rm -f libmd.a
 	$(AR) rulv libmd.a $(OBJ)
 	$(RANLIB) libmd.a
 
-mddriver:	mddriver.o libmd.so version.o
+mddriver:	mddriver.o libmd.dylib version.o
 	$(CC) -fPIC -O3 -o mddriver mddriver.o version.o -L. -lmd
 
 version.o:	version.c
