--- Makefile.common.orig	Sat Jan  5 09:10:54 2002
+++ Makefile.common	Sun Jan  6 00:00:00 2002
@@ -175,9 +175,12 @@
 
 $(LIBOBJECTS): %.o: $(SRCSUBDIR)/%.c $(HEADERLINKS)
 # Note that the user may have configured -I options into CFLAGS.
+	$(CC) -c $(INCLUDE) $(CFLAGS) $(CDEBUG) -o $@ $<
+
+$(SHLIBOBJECTS): %.lo: $(SRCSUBDIR)/%.c $(HEADERLINKS)
 	$(CC) -c $(INCLUDE) $(CFLAGS) $(CFLAGS_SHLIB) $(CDEBUG) -o $@ $<
 
-SONAME = lib$(LIBROOT).so.$(MAJ)
+SONAME = lib$(LIBROOT).so.$(SOVER)
 
 ifeq ($(NETPBMLIBTYPE),unixshared)
 # The libxxx.so link is needed to link the executables.
@@ -187,13 +190,10 @@
 # The $(SONAME) link is only needed to test the programs without
 # installing the libraries (in that case, you also need to direct the 
 # dynamic linker to the source directories, e.g. set LD_LIBRARY_PATH).
-$(SONAME): lib$(LIBROOT).$(NETPBMLIBSUFFIX).$(MAJ).$(MIN)
-	rm -f $@
-	$(SYMLINK) $< $@
-lib$(LIBROOT).$(NETPBMLIBSUFFIX).$(MAJ).$(MIN): \
-    $(LIBOBJECTS) $(LIBOBJECTS_X) $(LIBLIBS) $(LIBOPT)
-	$(LD) $(LDSHLIB) -o $@ $(LIBOBJECTS) $(LIBOBJECTS_X) \
-          `$(LIBOPT) $(LIBLIBS)` -lc $(CDEBUG)
+$(SONAME): \
+    $(SHLIBOBJECTS) $(LIBOBJECTS_X) $(LIBLIBS) $(LIBOPT)
+	$(LD) $(LDSHLIB) -o $@ $(SHLIBOBJECTS) $(LIBOBJECTS_X) \
+          `$(LIBOPT) $(LIBLIBS)` $(LDFLAGS) $(CDEBUG)
 endif
 
 ifeq ($(NETPBMLIBTYPE),dll)
@@ -282,7 +282,7 @@
 install.merge.common: $(MERGENAME) $(NOMERGEBINARIES) install.script
 	cd $(INSTALLBINARIES) ; rm -f $(BINARIES) $(MERGE_ALIASES)
 ifneq ($(MERGENAME)x,x)
-	$(INSTALL) -c $(STRIPFLAG) -m $(INSTALL_PERM_BIN) \
+	${BSD_INSTALL_PROGRAM} \
             $(MERGENAME) $(INSTALLBINARIES)
 	cd $(INSTALLBINARIES) ; \
 	   for i in $(MERGEBINARIES) $(MERGE_ALIASES) ; \
@@ -292,7 +292,7 @@
 ifneq ($(NOMERGEBINARIES)x,x)
 	for x in $(NOMERGEBINARIES); \
         do \
-           $(INSTALL) -c $(STRIPFLAG) -m $(INSTALL_PERM_BIN) \
+           ${BSD_INSTALL_PROGRAM} \
                $$x $(INSTALLBINARIES); \
 	done
 endif
@@ -303,7 +303,7 @@
 # Make and Install know that pbmmake.exe counts as pbmmake.
 	for x in $(BINARIES); \
 	do \
-	   $(INSTALL) -c $(STRIPFLAG) -m $(INSTALL_PERM_BIN) \
+	   ${BSD_INSTALL_PROGRAM} \
                $$x $(INSTALLBINARIES); \
 	done
 
@@ -312,7 +312,7 @@
 ifneq ($(SCRIPTS)x,x)
 	for x in $(SCRIPTS); \
 	do \
-	   $(INSTALL) -c -m $(INSTALL_PERM_BIN) $(SRCSUBDIR)/$$x \
+	   ${BSD_INSTALL_SCRIPT} $(SRCSUBDIR)/$$x \
                $(INSTALLSCRIPTS); \
 	done
 endif
@@ -349,7 +349,7 @@
 # directory when you compile your programs.
 	for x in $(INTERFACE_HEADERS); \
 	do \
-	   $(INSTALL) -c -m $(INSTALL_PERM_HDR) $(SRCSUBDIR)/$$x \
+	   ${BSD_INSTALL_DATA} $(SRCSUBDIR)/$$x \
                $(INSTALLHDRS); \
 	done
 
@@ -357,7 +357,7 @@
 #
 .PHONY: install.staticlib
 install.staticlib: lib$(LIBROOT).$(STATICLIBSUFFIX) 
-	$(INSTALL) -c -m $(INSTALL_PERM_LIBS) $< $(INSTALLSTATICLIBS)/$<
+	${BSD_INSTALL_DATA} $< $(INSTALLSTATICLIBS)/$<
 
 # Install a shared library stub -- the ".so" file used at link time to
 # prepare a program for dynamically linking a library at run time 
@@ -367,7 +367,7 @@
 install.sharedlibstub: 
 	cd $(INSTALLSTATICLIBS) ; \
           rm -f lib$(LIBROOT).$(NETPBMLIBSUFFIX); \
-          $(SYMLINK) $(INSTALLLIBS)/lib$(LIBROOT).$(NETPBMLIBSUFFIX).$(MAJ) \
+          $(SYMLINK) $(SONAME) \
             lib$(LIBROOT).$(NETPBMLIBSUFFIX)
 else
 # I have no idea what link-time stuff is required for other library types.
@@ -381,12 +381,9 @@
 .PHONY: install.lib.common
 ifeq ($(NETPBMLIBTYPE),unixshared)
 # install a Unix-style shared library
-install.lib.common: lib$(LIBROOT).$(NETPBMLIBSUFFIX).$(MAJ).$(MIN) 
-	cd $(INSTALLLIBS) ; rm -f lib$(LIBROOT).$(NETPBMLIBSUFFIX).$(MAJ).*
-	$(INSTALL) -c -m $(INSTALL_PERM_LIBD) $< $(INSTALLLIBS)
-	cd $(INSTALLLIBS) ; \
-          rm -f lib$(LIBROOT).$(NETPBMLIBSUFFIX).$(MAJ); \
-          $(SYMLINK) $< lib$(LIBROOT).$(NETPBMLIBSUFFIX).$(MAJ)
+install.lib.common: $(SONAME)
+	cd $(INSTALLLIBS) ; rm -f $(SONAME)
+	${BSD_INSTALL_DATA} $< $(INSTALLLIBS)
 endif
 ifeq ($(NETPBMLIBTYPE),dll)
 #install a Windows DLL shared library
