summaryrefslogtreecommitdiff
blob: 36b03c0663af53342c8859bc01382dc91a2ff652 (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
diff -ruN make/linux/Makefile.org make/linux/Makefile
--- make/linux/Makefile.org	2005-02-06 19:11:15.000000000 +0100
+++ make/linux/Makefile	2005-02-15 21:02:39.589581560 +0100
@@ -51,6 +51,8 @@
 
 # Names
 LIBRARY=libebml.a
+LIBRARY_SO=libebml.so
+LIBRARY_SO_VER=libebml.so.0
 
 # source-files
 sources:=$(wildcard ${SRC_DIR}*$(EXTENSION))
@@ -60,26 +62,36 @@
 
 # object files; replace .cxx extension with .o
 objects:=$(patsubst %$(EXTENSION),%.o,$(sources))
+objects_so:=$(patsubst %$(EXTENSION),%.lo,$(sources))
 
 WARNINGFLAGS=-Wall -Wno-unknown-pragmas -ansi -fno-gnu-keywords -Wshadow
 COMPILEFLAGS=$(WARNINGFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(DEBUGFLAGS) $(INCLUDE)
 DEPENDFLAGS  = $(CXXFLAGS) $(INCLUDE)
 
-all: $(LIBRARY)
+all: $(LIBRARY) $(LIBRARY_SO)
 
-lib library: $(LIBRARY)
+lib library: $(LIBRARY) $(LIBRARY_SO)
 
 # Build rules
 %.o: %$(EXTENSION)
 	$(CXX) -c $(COMPILEFLAGS) -o $@ $<
 
+%.lo: %$(EXTENSION)
+	$(CXX) -c $(COMPILEFLAGS) -fPIC -o $@ $<
+
 $(LIBRARY): $(objects)
 	$(AR) $@ $(objects)
 	$(RANLIB) $@
 
+$(LIBRARY_SO): $(objects_so)
+	$(CXX) -shared -Wl,-soname,$(LIBRARY_SO_VER) -o $(LIBRARY_SO_VER) $(objects_so)
+	ln -s $(LIBRARY_SO_VER) $(LIBRARY_SO)
+
 clean:
 	rm -f $(objects)
 	rm -f $(LIBRARY)
+	rm -f $(LIBRARY_SO)
+	rm -f $(LIBRARY_SO_VER)
 	rm -f CORE
 
 distclean dist-clean: clean
@@ -95,9 +107,11 @@
 		$(CXX) $(DEPENDFLAGS) -MM -MT $$o $$i >> .depend ; \
 	done
 
-install: $(LIBRARY)
+install: $(LIBRARY) $(LIBRARY_SO)
 	$(INSTALL) $(INSTALL_DIR_OPTS) -d $(libdir)
 	$(INSTALL) $(INSTALL_OPTS_LIB) $(LIBRARY) $(libdir)
+	$(INSTALL) $(INSTALL_OPTS_LIB) $(LIBRARY_SO_VER) $(libdir)
+	ln -s $(LIBRARY_SO_VER) $(libdir)/$(LIBRARY_SO)
 	$(INSTALL) $(INSTALL_DIR_OPTS) -d $(includedir)
 	for i in $(INCLUDE_DIR)/*.h; do \
 		$(INSTALL) $(INSTALL_OPTS) $$i $(includedir) ; \