1diff --git a/src/Makefile b/src/Makefile
2index 84e4e88..56ca676 100644
3--- a/src/Makefile
4+++ b/src/Makefile
5@@ -58,7 +58,7 @@ ifeq ($(G5),TRUE)
6 #MACHINE_SPECIFIC_FLAGS = -mpowerpc -mpowerpc64 -m64
7 endif
8
9-CCFLAGS = -Wa,-W -O3 $(OPENMP_FLAG) -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
10+CCFLAGS = $(CXXFLAGS) $(OPENMP_FLAG) $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS)
11 #CCFLAGS = -Wa,-W -O3 $(OPENMP_FLAG) $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
12 #CCFLAGS = -Wa,-W -O2 -fno-exceptions -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MACHINE_SPECIFIC_FLAGS) $(EXTRA)
13
14@@ -68,12 +68,12 @@ CCFLAGS = -Wa,-W -O3 $(OPENMP_FLAG) -Wno-deprecated $(PREPROCESSOR_DEFINE) $(MA
15
16 ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
17 #location of pari.h.
18- LOCATION_PARI_H = /usr/local/include/pari #usual location
19+ LOCATION_PARI_H = $(PARI_PREFIX)/include/pari #usual location
20
21 #location of libpari.a or of libpari.so
22 #depending on whether static or dynamic libraries are being used.
23 #On mac os x it's the former, on linux I think usually the latter.
24- LOCATION_PARI_LIBRARY = /usr/local/lib #usual location
25+ LOCATION_PARI_LIBRARY = $(PARI_PREFIX)/lib #usual location
26 else
27 #supplied as a dummy so as to avoid more ifeq's below
28 LOCATION_PARI_H = .
29@@ -89,24 +89,24 @@ INCLUDEFILES= -I../include
30
31 ifeq ($(OS_NAME),Darwin)
32 LDFLAGS2 =
33- DYN_OPTION=dynamiclib
34+ DYN_OPTION=-dynamiclib
35 else
36- LDFLAGS1 = -Xlinker -export-dynamic #not sure why pari calls these when linking but on the web I found
37+ LDFLAGS1 = #not sure why pari calls these when linking but on the web I found
38 #'Libtool provides the `-export-dynamic' link flag (see section Link mode), which does this declaration.
39 #You need to use this flag if you are linking a shared library that will be dlopened'
40 #see notes below
41 #ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
42- LDFLAGS2 = $(LDFLAGS1) -Xlinker -rpath -Xlinker $(LOCATION_PARI_LIBRARY)
43+ LDFLAGS2 = $(LDFLAGS)
44 #else
45 # LDFLAGS2 = $(LDFLAGS1)
46 #endif
47- DYN_OPTION=shared
48+ DYN_OPTION=$(LDFLAGS) -shared -Wl,-soname,libLfunction.so
49 endif
50
51 ifeq ($(PARI_DEFINE),-DINCLUDE_PARI)
52- LDFLAGS = $(LDFLAGS2) -L$(LOCATION_PARI_LIBRARY) -lpari
53+ MYLDFLAGS = $(LDFLAGS2) -L$(LOCATION_PARI_LIBRARY) -lpari
54 else
55- LDFLAGS = $(LDFLAGS2)
56+ MYLDFLAGS = $(LDFLAGS2)
57 endif
58
59
60@@ -129,7 +129,8 @@ endif
61 #become clear which libraries the computer can find.
62
63
64-INSTALL_DIR= /usr/local
65+INSTALL_DIR= $(DESTDIR)
66+LIB_DIR ?=lib
67
68 #object files for the libLfunction library
69 OBJ_L = Lglobals.o Lgamma.o Lriemannsiegel.o Lriemannsiegel_blfi.o Ldokchitser.o
70@@ -141,9 +142,8 @@ OBJECTS = $(OBJ3)
71
72 all:
73 # make print_vars
74- make libLfunction.so
75- make lcalc
76- make examples
77+ ${MAKE} libLfunction.so
78+ ${MAKE} lcalc
79 # make find_L
80 # make test
81
82@@ -151,7 +151,7 @@ print_vars:
83 @echo OS_NAME = $(OS_NAME)
84
85 lcalc: $(OBJECTS)
86- $(CC) $(CCFLAGS) $(INCLUDEFILES) $(OBJECTS) $(LDFLAGS) -o lcalc $(GMP_FLAGS)
87+ $(CC) $(CCFLAGS) $(INCLUDEFILES) $(OBJECTS) $(MYLDFLAGS) -o lcalc $(GMP_FLAGS)
88
89 examples:
90 $(CC) $(CCFLAGS) $(INCLUDEFILES) example_programs/example.cc libLfunction.so -o example_programs/example $(GMP_FLAGS)
91@@ -262,15 +262,18 @@ Lcommandline.o: ../include/Lcommandline_values_zeros.h
92
93
94 libLfunction.so: $(OBJ_L)
95- g++ -$(DYN_OPTION) -o libLfunction.so $(OBJ_L)
96+ g++ $(DYN_OPTION) -o libLfunction.so $(OBJ_L)
97
98 clean:
99 rm -f *.o lcalc libLfunction.so example_programs/example
100
101 install:
102- cp -f lcalc $(INSTALL_DIR)/bin/.
103- cp -f libLfunction.so $(INSTALL_DIR)/lib/.
104- cp -rf ../include $(INSTALL_DIR)/include/Lfunction
105+ install -d $(INSTALL_DIR)/bin
106+ install -d $(INSTALL_DIR)/$(LIB_DIR)
107+ install -d $(INSTALL_DIR)/include/Lfunction
108+ install lcalc $(INSTALL_DIR)/bin
109+ install libLfunction.so $(INSTALL_DIR)/$(LIB_DIR)
110+ install -m 644 -t $(INSTALL_DIR)/include/Lfunction ../include/*.h
111
112
113 SRCS = Lcommandline.cc Lcommandline_elliptic.cc Lcommandline_globals.cc Lcommandline_misc.cc Lcommandline_numbertheory.cc Lcommandline_twist.cc Lcommandline_values_zeros.cc Lgamma.cc Lglobals.cc Lmisc.cc Lriemannsiegel.cc Lriemannsiegel_blfi.cc cmdline.c