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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
$NetBSD: patch-ab,v 1.6 1999/09/19 04:24:54 jlam Exp $
--- ./Makefile.shlib.orig Fri Jul 16 18:46:16 1999
+++ ./Makefile.shlib Sat Sep 18 17:34:59 1999
@@ -50,6 +50,7 @@
# on a platform where we don't know how to build a shared library.
shlib :=
install-shlib-dep :=
+lib_to_install := lib$(NAME).a
# For each platform we support shlibs on, set shlib and install-shlib-dep,
# and update flags as needed to build a shared lib. Note we depend on
@@ -64,7 +65,7 @@
endif
ifeq ($(PORTNAME), freebsd)
- ifdef BSD_SHLIB
+ ifneq $(BSD_SHLIB),)
install-shlib-dep := install-shlib
ifdef ELF_SYSTEM
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
@@ -78,7 +79,8 @@
endif
ifeq ($(PORTNAME), bsd)
- ifdef BSD_SHLIB
+ ifneq ($(BSD_SHLIB),)
+ ifeq ($(LIBTOOL),)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
ifdef ELF_SYSTEM
@@ -87,11 +89,16 @@
LDFLAGS_SL := -x -Bshareable -Bforcearchive
endif
CFLAGS += $(CFLAGS_SL)
- endif
+ else
+ lalib := lib$(NAME).la
+ lib_to_install := $(lalib)
+ LIBTOOL_FLAGS += -rpath $(LIBDIR) -version-info $(SO_MAJOR_VERSION):$(SO_MINOR_VERSION)
+ endif # !LIBTOOL
+ endif # BSD_SHLIB
endif
ifeq ($(PORTNAME), bsdi)
- ifdef BSD_SHLIB
+ ifneq ($(BSD_SHLIB),)
ifeq ($(DLSUFFIX), .so)
install-shlib-dep := install-shlib
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
@@ -183,7 +190,7 @@
# Default target definition. Note shlib is empty if not building a shlib.
-all: lib$(NAME).a $(shlib)
+all: $(lib_to_install) $(shlib)
# Rules to build regular and shared libraries
@@ -197,6 +204,21 @@
$(RANLIB) $@
endif
+ifneq ($(LIBTOOL),)
+ifneq ($(PORTNAME), win)
+
+ifeq ($(CXXLIB), true)
+LINKER= CXX
+else
+LINKER= CC
+endif
+
+$(lalib): $(OBJS)
+ $($(LINKER)) $(CPPFLAGS) $($(LINKER)FLAGS) -o $@ $(OBJS:.o=.lo) $(LIBTOOL_FLAGS)
+
+endif
+endif
+
ifneq ($(shlib),)
ifneq ($(PORTNAME), win)
@@ -228,8 +250,8 @@
.PHONY: all install-lib install-shlib
-install-lib: lib$(NAME).a
- $(INSTALL) $(INSTL_LIB_OPTS) lib$(NAME).a $(LIBDIR)/lib$(NAME).a
+install-lib: $(lib_to_install)
+ $(INSTALL) $(INSTL_LIB_OPTS) $(lib_to_install) $(LIBDIR)
install-shlib: $(shlib)
$(INSTALL) $(INSTL_SHLIB_OPTS) $(shlib) $(LIBDIR)/$(shlib)
@@ -251,4 +273,8 @@
.PHONY: clean-shlib
clean-shlib:
+ifneq ($(LIBTOOL),)
+ $(LIBTOOL) rm -rf $(lalib)
+else
rm -f $(shlib) lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) lib$(NAME)$(DLSUFFIX)
+endif
|