blob: d1abb898dcb4840d6836ebb49338dfd096fc89ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
$NetBSD: patch-ae,v 1.12 2006/03/02 00:24:55 minskim Exp $
--- Makefile.in.orig 2005-05-08 01:11:23.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@
@@ -94,9 +97,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 \
@@ -145,6 +154,8 @@ INSTALL_TARGETS = @STATIC_INSTALL_TARGET
all: $(TARGETS)
+all-libtool: $(LIBTOOL_LIBS)
+
everything: all examples
static: $(STATIC_LIBS)
@@ -154,17 +165,31 @@ 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) \
+
libhistory.a: $(HISTOBJ) xmalloc.o
$(RM) $@
$(AR) $(ARFLAGS) $@ $(HISTOBJ) xmalloc.o
-test -n "$(RANLIB)" && $(RANLIB) $@
+libhistory.la: $(HISTOBJ:.o=.lo) xmalloc.lo
+ $(LIBTOOL) --mode=clean $(RM) $@
+ $(LIBTOOL) --mode=link $(CC) -o $@ $(HISTOBJ:.o=.lo) xmalloc.lo \
+ -rpath $(libdir) -version-info $(SHLIB_MAJOR):$(SHLIB_MINOR)
+
# 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) -o $@ ./examples/rl.c ./libreadline.a ${TERMCAP_LIB}
@@ -243,6 +268,12 @@ install-shared: installdirs install-head
uninstall-shared: maybe-uninstall-headers
-( cd shlib; ${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
-( if test -d doc ; then \
cd doc && \
|