blob: 58ac127c0592e6f3959cf32f69715f4287077711 (
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
On Darwin, create dylibs with a versioning scheme like Linux/ELF, not
like BSD/ELF.
This patch uses intentionally ELF_* vars to make it easier to diff
against the ELF Makefile.
diff --git a/lib/Makefile.darwin-lib b/lib/Makefile.darwin-lib
index c94a5e7..6a11a66 100644
--- a/lib/Makefile.darwin-lib
+++ b/lib/Makefile.darwin-lib
@@ -1,14 +1,15 @@
#
-# This is a Makefile stub which handles the creation of Darwin BSD shared
-# libraries.
+# This is a Makefile stub which handles the creation of Darwin shared
+# libraries based on the ELF scheme.
#
# In order to use this stub, the following makefile variables must be defined.
-#
-# BSDLIB_VERSION = 1.0
-# BSDLIB_IMAGE = libce
-# BSDLIB_MYDIR = et
-# BSDLIB_INSTALL_DIR = $(SHLIBDIR)
-#
+#
+# ELF_VERSION = 1.0
+# ELF_SO_VERSION = 1
+# ELF_IMAGE = libce
+# ELF_MYDIR = et
+# ELF_INSTALL_DIR = $(SHLIBDIR)
+# ELF_OTHER_LIBS = -lc
all:: image
@@ -16,36 +17,53 @@ real-subdirs:: Makefile
$(E) " MKDIR pic"
$(Q) mkdir -p pic
-BSD_LIB = $(BSDLIB_IMAGE).$(BSDLIB_VERSION).dylib
-BSDLIB_PIC_FLAG = -fPIC
+ELF_LIB = $(ELF_IMAGE).$(ELF_VERSION).dylib
+ELF_SONAME = $(ELF_IMAGE).$(ELF_SO_VERSION).dylib
-image: $(BSD_LIB)
+image: $(ELF_LIB)
$(BSD_LIB): $(OBJS)
- $(E) " GEN_BSD_SOLIB $(BSD_LIB)"
- $(Q) (cd pic; $(CC) -dynamiclib -compatibility_version 1.0 -current_version $(BSDLIB_VERSION) \
- -flat_namespace -undefined warning -o $(BSD_LIB) $(OBJS))
- $(Q) $(MV) pic/$(BSD_LIB) .
- $(Q) $(RM) -f ../$(BSD_LIB)
+ $(E) " GEN_ELF_SOLIB $(ELF_LIB)"
+ $(Q) (cd pic; $(CC) -dynamiclib -o $(ELF_LIB) $(LDFLAGS) \
+ -Wl,-install_name,$(libdir)/$(ELF_SONAME) $(OBJS) $(ELF_OTHER_LIBS))
+ $(Q) $(MV) pic/$(ELF_LIB) .
+ $(Q) $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).dylib ../$(ELF_SONAME)
$(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) \
- `echo $(my_dir) | sed -e 's;lib/;;'`/$(BSD_LIB) $(BSD_LIB))
- $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) $(BSD_LIB) $(BSDLIB_IMAGE).dylib)
+ `echo $(my_dir) | sed -e 's;lib/;;'`/$(ELF_LIB) $(ELF_LIB))
+ $(Q) (cd ..; $(LN) $(LINK_BUILD_FLAGS) ../$(ELF_SONAME))
+
+installdirs-elf-lib::
+ $(E) " MKINSTALLDIRS $(ELF_INSTALL_DIR) $(libdir)"
+ $(Q) $(MKINSTALLDIRS) $(DESTDIR)$(ELF_INSTALL_DIR) \
+ $(DESTDIR)$(libdir)
+
+installdirs:: installdirs-elf-lib
-install-shlibs install:: $(BSD_LIB)
- $(E) " INSTALL_PROGRAM $(BSDLIB_INSTALL_DIR)/$(BSD_LIB)"
- $(Q) $(INSTALL_PROGRAM) $(BSD_LIB) \
- $(DESTDIR)$(BSDLIB_INSTALL_DIR)/$(BSD_LIB)
- -$(Q) $(LDCONFIG)
+install-shlibs install:: $(ELF_LIB) installdirs-elf-lib
+ $(E) " INSTALL-ELF-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
+ $(Q) $(INSTALL_PROGRAM) $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
+ $(E) " SYMLINK $(ELF_INSTALL_DIR)/$(ELF_SONAME)"
+ $(Q) $(LN_S) -f $(ELF_LIB) $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME)
+ $(E) " SYMLINK $(libdir)/$(ELF_IMAGE).dylib"
+ $(Q) $(LN_S) -f $(ELF_SONAME) \
+ $(DESTDIR)$(libdir)/$(ELF_IMAGE).dylib
install-strip: install
+ $(E) " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
+ $(Q) $(STRIP) --strip-unneeded --remove-section=.comment \
+ --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
install-shlibs-strip: install-shlibs
+ $(E) " STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
+ @$(STRIP) --strip-unneeded --remove-section=.comment \
+ --remove-section=.note $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB)
uninstall-shlibs uninstall::
- $(RM) -f $(DESTDIR)$(BSDLIB_INSTALL_DIR)/$(BSD_LIB)
+ $(RM) -f $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) \
+ $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME) \
+ $(DESTDIR)$(libdir)/$(ELF_IMAGE).dylib
clean::
$(RM) -rf pic
- $(RM) -f $(BSD_LIB)
- $(RM) -f ../$(BSD_LIB)
- $(RM) -f ../$(BSDLIB_IMAGE).dylib
+ $(RM) -f $(ELF_LIB)
+ $(RM) -f ../$(ELF_LIB) ../$(ELF_IMAGE).dylib ../$(ELF_SONAME)
|