aboutsummaryrefslogtreecommitdiff
blob: 8758244ac055cf7f04ae254bf9eaa98465ba0808 (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
--- makefile.in
+++ makefile.in
@@ -1,14 +1,17 @@
 BLD = build$(QUADSUFFIX)
 
-LIBDIR = $(PREFIX)/lib$(LIBDIRSUFFIX)
-INCLUDEDIR = $(PREFIX)/include
-BINDIR = $(PREFIX)/bin
+LIBDIR = $(DESTDIR)/$(PREFIX)/lib$(LIBDIRSUFFIX)
+INCLUDEDIR = $(DESTDIR)/$(PREFIX)/include
+BINDIR = $(DESTDIR)/$(PREFIX)/bin
 
 LIB = libooptools$(QUADSUFFIX).a
 FE = lt$(QUADSUFFIX)$(EXE)
 MFE = LoopTools$(QUADSUFFIX)$(EXE)
 INCLUDE = $(BLD)/looptools.h $(BLD)/clooptools.h
 
+LIBRARY=libooptools.so
+REALNAME=$(LIBRARY).$(VER)
+
 ARGS = $(PARALLEL) \
   LIB="$(LIB)" \
   FE="$(FE)" \
@@ -16,12 +19,12 @@
   EXE="$(EXE)" \
   DEF="$(DEF)" \
   NOUNDERSCORE="$(NOUNDERSCORE)" \
-  XFC="$(FC$(QUADSUFFIX)) $(FFLAGS) $(FFLAGS-quad) -I." \
+  XFC="$(FC$(QUADSUFFIX)) $(FFLAGS) $(FFLAGS-quad) -I. -fPIC" \
   F90="$(F90)" \
   CC="$(CC)" \
-  CFLAGS="$(CFLAGS) $(CFLAGS-quad)" \
+  CFLAGS="$(CFLAGS) $(CFLAGS-quad) -fPIC" \
   CXX="$(CXX)" \
-  CXXFLAGS="$(CXXFLAGS)" \
+  CXXFLAGS="$(CXXFLAGS) -fPIC" \
   ML="$(ML)" \
   MCC="$(MCC)" \
   MCFLAGS="$(MCFLAGS)" \
@@ -32,22 +35,24 @@
   DLLTOOL="$(DLLTOOL)" \
   LDFLAGS="$(LDFLAGS)" \
   LIBPATH="$(LIBPATH)" \
-  OBJS-quad="$(OBJS-quad)"
+  OBJS-quad="$(OBJS-quad)" \
+  REALNAME="$(REALNAME)"
 
 
-default all lib frontend mma: force
+default all lib solib frontend mma: force
 	cd $(BLD) && $(MAKE) $(ARGS) $@
 
-install: lib frontend
-	-mkdir $(PREFIX)
+install: lib solib frontend
+	-mkdir $(DESTDIR)$(PREFIX)
 	-mkdir $(LIBDIR) $(BINDIR) $(INCLUDEDIR)
 	cp -p $(BLD)/$(LIB) $(LIBDIR)
 	cp -p $(INCLUDE$(QUADSUFFIX)) $(INCLUDEDIR)
-	strip $(BLD)/$(FE)
 	cp -p $(BLD)/fcc $(BLD)/$(FE) $(BINDIR)
 	rm -f $(BINDIR)/f++
 	ln -s fcc $(BINDIR)/f++
-	test ! -f $(BLD)/$(MFE) || { strip $(BLD)/$(MFE) ; cp -p $(BLD)/$(MFE) $(BINDIR); }
+	test ! -f $(BLD)/$(MFE) || { cp -p $(BLD)/$(MFE) $(BINDIR); }
+	cp -p $(BLD)/$(REALNAME) $(LIBDIR)
+	cd $(LIBDIR) && ln -s $(REALNAME) $(LIBRARY)
 
 force: $(BLD)/timestamp
 
--- src/makefile
+++ src/makefile
@@ -1,6 +1,6 @@
-default: frontend mma$(ML)
+default: frontend mma$(ML) solib
 
-all: frontend mma1
+all: frontend mma1 solib
 
 frontend: lib $(FE)
 
@@ -8,6 +8,7 @@
 
 mma0 lib: $(LIB) clooptools.h fcc
 
+solib: $(REALNAME) fcc
 
 .SUFFIXES:
 
@@ -243,6 +244,8 @@
 	$(AR) cru $(LIB) $?
 	-$(RANLIB) $(LIB)
 
+$(REALNAME): $(OBJS)
+	$(XFC) $(LDFLAGS) -shared -Wl,--soname,$(REALNAME) -o $@ $?
 
 $(FE): lt.F $(LTINC) $(LIB)
 	$(XFC) -o $(FE) lt.F $(LIB) -lpthread