2014-11-05 12:41:07 +01:00

97 lines
3.1 KiB
Plaintext

$NetBSD: patch-ae,v 1.17 2014/03/12 10:04:50 wiz Exp $
Pass -no-undefined to libtool for building shared library.
--- Makefile.in.orig 2014-01-27 14:52:00.000000000 +0000
+++ Makefile.in
@@ -18,6 +18,9 @@
RL_LIBRARY_VERSION = @LIBVERSION@
RL_LIBRARY_NAME = readline
+SHLIB_MAJOR = @SHLIB_MAJOR@
+SHLIB_MINOR = @SHLIB_MINOR@
+
PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@
@@ -78,6 +81,7 @@ CTAGS = ctags -tw
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@ -DRL_LIBRARY_VERSION='"$(RL_LIBRARY_VERSION)"'
CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@ -no-undefined
DEFS = @DEFS@ @CROSS_COMPILE@
LOCAL_DEFS = @LOCAL_DEFS@
@@ -100,9 +104,15 @@ GCC_LINT_CFLAGS = $(XCCFLAGS) $(GCC_LINT
${RM} $@
$(CC) -c $(CCFLAGS) $<
+.SUFFIXES: .lo
+.c.lo:
+ ${RM} $@
+ $(LIBTOOL) --mode=compile $(CC) -c $(CCFLAGS) $<
+
# The name of the main library target.
LIBRARY_NAME = libreadline.a
STATIC_LIBS = libreadline.a libhistory.a
+LIBTOOL_LIBS = libreadline.la libhistory.la
# The C code source files for this library.
CSOURCES = $(srcdir)/readline.c $(srcdir)/funmap.c $(srcdir)/keymaps.c \
@@ -160,6 +170,8 @@ INSTALL_TARGETS = @STATIC_INSTALL_TARGET
all: $(TARGETS)
+all-libtool: $(LIBTOOL_LIBS)
+
everything: all examples
static: $(STATIC_LIBS)
@@ -169,17 +181,33 @@ libreadline.a: $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
-test -n "$(RANLIB)" && $(RANLIB) $@
+libreadline.la: $(OBJECTS:.o=.lo)
+ $(LIBTOOL) --mode=clean $(RM) $@
+ $(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS:.o=.lo) $(TERMCAP_LIB) \
+ -rpath $(libdir) -version-info $(SHLIB_MAJOR):$(SHLIB_MINOR) \
+ $(LDFLAGS)
+
libhistory.a: $(HISTOBJ) xmalloc.o xfree.o
$(RM) $@
$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o xfree.o
-test -n "$(RANLIB)" && $(RANLIB) $@
+libhistory.la: $(HISTOBJ:.o=.lo) xmalloc.lo xfree.lo
+ $(LIBTOOL) --mode=clean $(RM) $@
+ $(LIBTOOL) --mode=link $(CC) -o $@ $(HISTOBJ:.o=.lo) xmalloc.lo xfree.lo \
+ -rpath $(libdir) -version-info $(SHLIB_MAJOR):$(SHLIB_MINOR) \
+ $(LDFLAGS)
+
# Since tilde.c is shared between readline and bash, make sure we compile
# it with the right flags when it's built as part of readline
tilde.o: tilde.c
rm -f $@
$(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c $(srcdir)/tilde.c
+tilde.lo: tilde.c
+ $(LIBTOOL) --mode=clean rm -f $@
+ $(LIBTOOL) --mode=compile $(CC) $(CCFLAGS) -DREADLINE_LIBRARY -c $(srcdir)/tilde.c
+
readline: $(OBJECTS) readline.h rldefs.h chardefs.h ./libreadline.a
$(CC) $(CCFLAGS) -DREADLINE_LIBRARY -o $@ $(top_srcdir)/examples/rl.c ./libreadline.a ${TERMCAP_LIB}
@@ -264,6 +292,12 @@ install-examples: installdirs install-he
uninstall-examples: maybe-uninstall-headers
-( cd examples; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
+install-libtool: installdirs $(LIBTOOL_LIBS) install-headers install-doc
+ -$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libreadline.la
+ $(LIBTOOL) --mode=install $(INSTALL) libreadline.la $(DESTDIR)$(libdir)
+ -$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libhistory.la
+ $(LIBTOOL) --mode=install $(INSTALL) libhistory.la $(DESTDIR)$(libdir)
+
install-doc: installdirs
$(INSTALL_DATA) $(OTHER_DOCS) $(DESTDIR)$(docdir)
-( if test -d doc ; then \