$NetBSD: patch-ae,v 1.2 2000/01/15 18:39:30 jlam Exp $

--- mk-1st.awk.orig	Sat May  9 17:54:02 1998
+++ mk-1st.awk	Sat Jan 15 11:24:46 2000
@@ -208,10 +208,16 @@
 			}
 			else
 			{
+				if ( $2 == "c++" ) {
+					cplusplus="--cplusplus"
+					compile="CXX"
+				} else {
+					cplusplus=""
+					compile="CC"
+				}
 				end_name = lib_name;
 				printf "../lib/%s : $(%s_OBJS)\n", lib_name, OBJS
-				printf "\t$(AR) $(AR_OPTS) $@ $?\n"
-				printf "\t$(RANLIB) $@\n"
+				printf "\tcd ../lib && $(LIBTOOL) %s $(%s) -o %s $(%s_OBJS:.o=.lo) -rpath $(INSTALL_PREFIX)$(libdir) -version-info $(NCURSES_MAJOR):$(NCURSES_MINOR)\n", cplusplus, compile, lib_name, OBJS
 				if ( target == "vxworks" )
 				{
 					printf "\t$(LD) $(LD_OPTS) $? -o $(@:.a=.o)\n"
@@ -220,15 +226,8 @@
 				print  "install \\"
 				print  "install.libs \\"
 				printf "install.%s :: $(INSTALL_PREFIX)$(libdir) ../lib/%s\n", name, lib_name
-				printf "\t@echo installing ../lib/%s as $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, lib_name
-				printf "\t$(INSTALL_DATA) ../lib/%s $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name, lib_name
-				if ( overwrite == "yes" && lib_name == "libncurses.a" )
-				{
-					printf "\t@echo linking libcurses.a to libncurses.a \n"
-					printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/libcurses.a \n"
-					printf "\t(cd $(INSTALL_PREFIX)$(libdir) && $(LN_S) libncurses.a libcurses.a)\n"
-				}
-				printf "\t$(RANLIB) $(INSTALL_PREFIX)$(libdir)/%s\n", lib_name
+				printf "\t@echo installing ../lib/%s in $(INSTALL_PREFIX)$(libdir)\n", lib_name
+				printf "\tcd ../lib && $(LIBTOOL) %s $(INSTALL_DATA) %s $(INSTALL_PREFIX)$(libdir)\n", cplusplus, lib_name
 				if ( target == "vxworks" )
 				{
 					printf "\t@echo installing ../lib/lib%s.o as $(INSTALL_PREFIX)$(libdir)/lib%s.o\n", name, name
@@ -239,12 +238,7 @@
 				print  "uninstall.libs \\"
 				printf "uninstall.%s ::\n", name
 				printf "\t@echo uninstalling $(INSTALL_PREFIX)$(libdir)/%s \n", lib_name
-				printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/%s\n", lib_name
-				if ( overwrite == "yes" && lib_name == "libncurses.a" )
-				{
-					printf "\t@echo linking libcurses.a to libncurses.a \n"
-					printf "\t-@rm -f $(INSTALL_PREFIX)$(libdir)/libcurses.a \n"
-				}
+				printf "\t-@$(LIBTOOL) rm -f $(INSTALL_PREFIX)$(libdir)/%s\n", lib_name
 				if ( target == "vxworks" )
 				{
 					printf "\t@echo uninstalling $(INSTALL_PREFIX)$(libdir)/lib%s.o\n", name
@@ -253,7 +247,7 @@
 			}
 			print ""
 			print "clean ::"
-			printf "\t-rm -f ../lib/%s\n", lib_name
+			printf "\t-cd ../lib && $(LIBTOOL) rm -f %s\n", lib_name
 			print ""
 			print "mostlyclean::"
 			printf "\t-rm -f $(%s_OBJS)\n", OBJS
