blob: 4ca49d6b5d8e2161c6706e03d145a27d26ddaa36 (
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
|
--- lib/makefile.src.orig Wed Mar 4 13:32:53 1992
+++ lib/makefile.src Sat Oct 3 23:57:51 1998
@@ -26,7 +26,14 @@
vaxshort.o \
$(OPT_OBJS)
-LIBNAME = librle.a
+SOOBJS = $(OBJS:.o=.so)
+
+LIBANAME = librle.a
+.if $(PORTOBJFORMAT) == "elf"
+LIBSONAME = librle.so.1
+.else
+LIBSONAME = librle.so.1.0
+.endif
# Just rebuild the object files.
objs: $(OBJS)
@@ -37,23 +44,14 @@
# Do nothing if $(DEST) is empty (or not defined)
install: buildlib
@sh -c "if test '$(DEST)x' != x ; then \
- echo cp $(LIBNAME) $(DEST)/$(LIBNAME) ; \
- cp $(LIBNAME) $(DEST)/$(LIBNAME) ; \
+ echo cp $(LIBANAME) $(DEST)/$(LIBANAME) ; \
+ cp $(LIBANAME) $(DEST)/$(LIBANAME) ; \
+ echo cp $(LIBSONAME) $(DEST)/$(LIBSONAME) ; \
+ cp $(LIBSONAME) $(DEST)/$(LIBSONAME) ; \
+ ln -sf $(LIBSONAME) $(DEST)/librle.so ; \
if test x$(RANLIB) != x ; then \
- echo ranlib $(DEST)/$(LIBNAME) ; \
- ranlib $(DEST)/$(LIBNAME) ; \
- else \
- true ; \
- fi ; \
- if test -d $(DEST)/debug ; then \
- echo cp $(LIBNAME) $(DEST)/debug/$(LIBNAME) ; \
- if test x$(RANLIB) != x ; then \
- cp $(LIBNAME) $(DEST)/debug/$(LIBNAME) ; \
- echo ranlib $(DEST)/debug/$(LIBNAME) ; \
- else \
- true ; \
- fi ; \
- ranlib $(DEST)/debug/$(LIBNAME) ; \
+ echo ranlib $(DEST)/$(LIBANAME) ; \
+ ranlib $(DEST)/$(LIBANAME) ; \
else \
true ; \
fi ; \
@@ -63,14 +61,30 @@
touch install
# Rebuild the library from all the .o files.
-buildlib: $(OBJS)
- -rm -f $(LIBNAME)
- ar rc $(LIBNAME)
- ar q $(LIBNAME) $(OBJS)
+buildlib: $(LIBANAME) $(LIBSONAME)
+
+$(LIBANAME): $(OBJS)
+ -rm -f $@
+ ar rc $@ $?
#ifndef NO_RANLIB
- ranlib $(LIBNAME)
+ ranlib $@
#endif
- touch buildlib
+
+.SUFFIXES: .so .o
+
+.c.so:
+ $(CC) -fPIC -DPIC $(CFLAGS) -c $*.c -o $*.so
+ $(LD) -X -r $*.so
+
+.if $(PORTOBJFORMAT) == "elf"
+$(LIBSONAME): $(SOOBJS)
+ -rm -f $@
+ ld -shared -soname $@ -o $@ $>
+.else
+$(LIBSONAME): $(SOOBJS)
+ -rm -f $@
+ ld -Bshareable -o $@ $>
+.endif
# Clean up installed stuff and binaries
pristine: clean
@@ -86,9 +100,12 @@
# Get rid of everything which must be recompiled on a different computer.
clean:
-rm -f *.o
+ -rm -f *.so
-@if test x$(DEST) != x ; then \
- echo rm -f $(LIBNAME) ; \
- rm -f $(LIBNAME) ; \
+ echo rm -f $(LIBANAME) ; \
+ rm -f $(LIBANAME) ; \
+ echo rm -f $(LIBSONAME) ; \
+ rm -f $(LIBSONAME) ; \
else \
true ; \
fi
|