| 1 |
From: =?utf-8?b?R8O8cmthbiBTZW5nw7xu?= <[email protected]> |
| 2 |
Date: Wed, 10 May 2017 09:48:49 +0200 |
| 3 |
Subject: fix makefile for installation to /usr instead of /usr/local |
| 4 |
|
| 5 |
This fixes the PREFIX variable for installation and the distclean part |
| 6 |
of the build system. |
| 7 |
--- |
| 8 |
Makefile | 1 + |
| 9 |
build/Makefile | 22 ++++++++-------------- |
| 10 |
2 files changed, 9 insertions(+), 14 deletions(-) |
| 11 |
|
| 12 |
diff --git a/Makefile b/Makefile |
| 13 |
index 19b857f..2bfecf7 100644 |
| 14 |
--- a/Makefile |
| 15 |
+++ b/Makefile |
| 16 |
@@ -22,3 +22,4 @@ docs: |
| 17 |
|
| 18 |
clean: |
| 19 |
@cd build; ${MAKE} clean |
| 20 |
+ rm -f bin/srsplash |
| 21 |
diff --git a/build/Makefile b/build/Makefile |
| 22 |
index 0f91b95..6d6e73a 100644 |
| 23 |
--- a/build/Makefile |
| 24 |
+++ b/build/Makefile |
| 25 |
@@ -64,8 +64,7 @@ else |
| 26 |
GIZA_DIR= $(PREFIX) |
| 27 |
PLOTLIB= giza-fortran.F90 plotlib_giza.f90 |
| 28 |
PGPLOTLIBS = -L$(GIZA_DIR)/lib -lgiza $(CAIRO_LIBS) |
| 29 |
- CFLAGS= -fPIC -Wall -Wextra -O3 -g |
| 30 |
- CC = gcc |
| 31 |
+ CFLAGS+= -fPIC |
| 32 |
endif |
| 33 |
endif |
| 34 |
#-------------------------------------------------------------- |
| 35 |
@@ -129,7 +128,7 @@ OMPFLAGS= |
| 36 |
# default destination for installed binaries |
| 37 |
# |
| 38 |
DESTDIR= |
| 39 |
-PREFIX=/usr/local/ |
| 40 |
+PREFIX=/usr/ |
| 41 |
# |
| 42 |
# default C compiler |
| 43 |
# |
| 44 |
@@ -162,8 +161,9 @@ endif |
| 45 |
|
| 46 |
ifeq ($(SYSTEM), gfortran) |
| 47 |
# gfortran compiler (part of gcc 4.x.x) |
| 48 |
+ CC = gcc |
| 49 |
FC= gfortran |
| 50 |
- FFLAGS= -O3 -fPIC |
| 51 |
+ FFLAGS= -fPIC |
| 52 |
DBLFLAGS= -fdefault-real-8 -fdefault-double-8 |
| 53 |
SYSTEMFILE= system_f2003.f90 |
| 54 |
DEBUGFLAG= -Wall -Wextra -pedantic -g -frange-check -fcheck=all -fbacktrace \ |
| 55 |
@@ -269,7 +269,7 @@ endif |
| 56 |
# |
| 57 |
# these are the flags used for linking |
| 58 |
# |
| 59 |
-LDFLAGS= $(X11_LIBS) $(PGPLOTLIBS) |
| 60 |
+LDFLAGS+= $(X11_LIBS) $(PGPLOTLIBS) |
| 61 |
PIELDFLAGS= -pie |
| 62 |
|
| 63 |
# |
| 64 |
@@ -371,7 +371,7 @@ endif |
| 65 |
%.o : %.f95 |
| 66 |
$(FC) $(FFLAGS) -c $< -o $@ |
| 67 |
%.o : %.c |
| 68 |
- $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ |
| 69 |
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $< -o $@ |
| 70 |
|
| 71 |
# modules must be compiled in the correct order to check interfaces |
| 72 |
# really should include all dependencies but I am lazy |
| 73 |
@@ -629,9 +629,6 @@ sphmoments: checksystem checkfits $(OBJECTSM) |
| 74 |
|
| 75 |
checksystem: |
| 76 |
ifeq ($(KNOWN_SYSTEM), yes) |
| 77 |
- @echo "" |
| 78 |
- @echo "Compiling splash for $(SYSTEM) system..........." |
| 79 |
- @echo "" |
| 80 |
ifeq ($(ENDIAN), BIG) |
| 81 |
@echo "Flags set for conversion to BIG endian" |
| 82 |
endif |
| 83 |
@@ -649,7 +646,6 @@ checksystem: |
| 84 |
endif |
| 85 |
ifeq ($(FC),gfortran) |
| 86 |
ifeq ($(GFORTRAN_GE_4_4),true) |
| 87 |
- @echo "compiling with gfortran v$(GFORTRAN_VERSION) (OK)" |
| 88 |
else |
| 89 |
${error gfortran v$(GFORTRAN_VERSION) is too old to compile this version of splash: please upgrade your gfortran} |
| 90 |
endif |
| 91 |
@@ -778,6 +774,7 @@ installcheck: |
| 92 |
$(MAKE) err; fi |
| 93 |
|
| 94 |
destdircheck: installcheck |
| 95 |
+ mkdir -p $(DESTDIR)$(PREFIX)/bin |
| 96 |
@if test -d $(DESTDIR)$(PREFIX)/bin; then echo $(DESTDIR)$(PREFIX)/bin exists and is a directory; else \ |
| 97 |
echo; echo "*** ERROR in make install ***"; echo "$(DESTDIR)$(PREFIX)/bin is not a valid directory"; echo;\ |
| 98 |
$(MAKE) err; fi; |
| 99 |
@@ -814,7 +811,7 @@ withgiza: ../giza/lib/libgiza.a |
| 100 |
|
| 101 |
../giza/lib/libgiza.a: |
| 102 |
@echo "Compiling local copy of giza..." |
| 103 |
- cd ../giza; ./configure --prefix="$(PWD)/../giza" CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="" CAIRO_LIBS="$(CAIRO_LIBS)" CAIRO_CFLAGS="$(CAIRO_CFLAGS)" X11_LIBS="$(X11_LIBS)" X11_CFLAGS="$(X11_CFLAGS)" |
| 104 |
+ cd ../giza; ./configure --prefix="$(PWD)/../giza" CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="" CAIRO_LIBS="$(CAIRO_LIBS)" CAIRO_CFLAGS="$(CAIRO_CFLAGS)" X11_LIBS="$(X11_LIBS)" X11_CFLAGS="$(X11_CFLAGS) CPPFLAGS="$(CPPFLAGS)" |
| 105 |
cd ../giza; $(MAKE) $(MAKECMDFLAGS) install CC="$(CC)" CFLAGS="$(CFLAGS)" |
| 106 |
|
| 107 |
docs: doc |
| 108 |
@@ -839,9 +836,6 @@ targz: |
| 109 |
gzip splash.tar |
| 110 |
|
| 111 |
## unit tests of various modules as I write them |
| 112 |
-.PHONY: tests |
| 113 |
- |
| 114 |
-test: test1 test2 test3 test_slicer test_prompt test-parse |
| 115 |
|
| 116 |
test1: interpolate3D_projection.o interpolate3D_xsec.o test_interpolate3D.o |
| 117 |
$(FC) $(FFLAGS) $(LDFLAGS) $(PIELDFLAGS) -o $(BINDIR)/test_interpolation3D $(TESTDIR)/test_interpolate3D.o interpolate3D_projection.o interpolate3D_xsec.o |