From: =?utf-8?b?R8O8cmthbiBTZW5nw7xu?= Date: Wed, 10 May 2017 09:48:49 +0200 Subject: fix makefile for installation to /usr instead of /usr/local This fixes the PREFIX variable for installation and the distclean part of the build system. --- Makefile | 1 + build/Makefile | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 19b857f..2bfecf7 100644 --- a/Makefile +++ b/Makefile @@ -22,3 +22,4 @@ docs: clean: @cd build; ${MAKE} clean + rm -f bin/srsplash diff --git a/build/Makefile b/build/Makefile index 0f91b95..6d6e73a 100644 --- a/build/Makefile +++ b/build/Makefile @@ -64,8 +64,7 @@ else GIZA_DIR= $(PREFIX) PLOTLIB= giza-fortran.F90 plotlib_giza.f90 PGPLOTLIBS = -L$(GIZA_DIR)/lib -lgiza $(CAIRO_LIBS) - CFLAGS= -fPIC -Wall -Wextra -O3 -g - CC = gcc + CFLAGS+= -fPIC endif endif #-------------------------------------------------------------- @@ -129,7 +128,7 @@ OMPFLAGS= # default destination for installed binaries # DESTDIR= -PREFIX=/usr/local/ +PREFIX=/usr/ # # default C compiler # @@ -162,8 +161,9 @@ endif ifeq ($(SYSTEM), gfortran) # gfortran compiler (part of gcc 4.x.x) + CC = gcc FC= gfortran - FFLAGS= -O3 -fPIC + FFLAGS= -fPIC DBLFLAGS= -fdefault-real-8 -fdefault-double-8 SYSTEMFILE= system_f2003.f90 DEBUGFLAG= -Wall -Wextra -pedantic -g -frange-check -fcheck=all -fbacktrace \ @@ -269,7 +269,7 @@ endif # # these are the flags used for linking # -LDFLAGS= $(X11_LIBS) $(PGPLOTLIBS) +LDFLAGS+= $(X11_LIBS) $(PGPLOTLIBS) PIELDFLAGS= -pie # @@ -371,7 +371,7 @@ endif %.o : %.f95 $(FC) $(FFLAGS) -c $< -o $@ %.o : %.c - $(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $< -o $@ # modules must be compiled in the correct order to check interfaces # really should include all dependencies but I am lazy @@ -629,9 +629,6 @@ sphmoments: checksystem checkfits $(OBJECTSM) checksystem: ifeq ($(KNOWN_SYSTEM), yes) - @echo "" - @echo "Compiling splash for $(SYSTEM) system..........." - @echo "" ifeq ($(ENDIAN), BIG) @echo "Flags set for conversion to BIG endian" endif @@ -649,7 +646,6 @@ checksystem: endif ifeq ($(FC),gfortran) ifeq ($(GFORTRAN_GE_4_4),true) - @echo "compiling with gfortran v$(GFORTRAN_VERSION) (OK)" else ${error gfortran v$(GFORTRAN_VERSION) is too old to compile this version of splash: please upgrade your gfortran} endif @@ -778,6 +774,7 @@ installcheck: $(MAKE) err; fi destdircheck: installcheck + mkdir -p $(DESTDIR)$(PREFIX)/bin @if test -d $(DESTDIR)$(PREFIX)/bin; then echo $(DESTDIR)$(PREFIX)/bin exists and is a directory; else \ echo; echo "*** ERROR in make install ***"; echo "$(DESTDIR)$(PREFIX)/bin is not a valid directory"; echo;\ $(MAKE) err; fi; @@ -814,7 +811,7 @@ withgiza: ../giza/lib/libgiza.a ../giza/lib/libgiza.a: @echo "Compiling local copy of giza..." - 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)" + 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)" cd ../giza; $(MAKE) $(MAKECMDFLAGS) install CC="$(CC)" CFLAGS="$(CFLAGS)" docs: doc @@ -839,9 +836,6 @@ targz: gzip splash.tar ## unit tests of various modules as I write them -.PHONY: tests - -test: test1 test2 test3 test_slicer test_prompt test-parse test1: interpolate3D_projection.o interpolate3D_xsec.o test_interpolate3D.o $(FC) $(FFLAGS) $(LDFLAGS) $(PIELDFLAGS) -o $(BINDIR)/test_interpolation3D $(TESTDIR)/test_interpolate3D.o interpolate3D_projection.o interpolate3D_xsec.o