summaryrefslogtreecommitdiffstats
path: root/build/linux/Makefile.in
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-09-15 16:38:08 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-09-15 16:38:08 +0200
commitaa31a06235496c0d808e57c8ce914cb4b640bc6e (patch)
tree33385e828ddca0b2857bac9e3dac4dd3723a3eee /build/linux/Makefile.in
parentf6aa2db83dfea89f9d2cfc6fcbd3da141ee77e02 (diff)
parent00a1c6118b2d64b867c8e640c295462bcccfc7c9 (diff)
downloadastra-aa31a06235496c0d808e57c8ce914cb4b640bc6e.tar.gz
astra-aa31a06235496c0d808e57c8ce914cb4b640bc6e.tar.bz2
astra-aa31a06235496c0d808e57c8ce914cb4b640bc6e.tar.xz
astra-aa31a06235496c0d808e57c8ce914cb4b640bc6e.zip
Merge branch 'master' into parallel_vec
Diffstat (limited to 'build/linux/Makefile.in')
-rw-r--r--build/linux/Makefile.in239
1 files changed, 177 insertions, 62 deletions
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in
index 2af705f..d7d6488 100644
--- a/build/linux/Makefile.in
+++ b/build/linux/Makefile.in
@@ -1,10 +1,19 @@
+install_type=@INSTALL_TYPE@
+
cuda=@HAVECUDA@
matlab=@HAVEMATLAB@
python=@HAVEPYTHON@
boostutf=@HAVEBOOSTUTF@
-
+macos=@IS_MACOS@
MATLAB_ROOT=@MATLAB_ROOT@
+octave=@HAVEOCTAVE@
+
+MKDIR=mkdir -p
+CXX=@CXX@
+LD=@CXX@
+SHELL=@SHELL@
+INSTALL_SH=$(SHELL) $(srcdir)/install-sh
TARGETS=libastra.la
@@ -16,10 +25,15 @@ ifeq ($(python),yes)
TARGETS+=py
endif
+ifeq ($(octave),yes)
+TARGETS+=oct
+endif
+
all: $(TARGETS)
prefix=@prefix@
exec_prefix=@exec_prefix@
+datarootdir=@datarootdir@
srcdir=@srcdir@
abs_top_builddir=@abs_top_builddir@
@@ -36,7 +50,10 @@ CXXFLAGS+=-g -O3 -Wall -Wshadow
LIBS+=-lpthread
LDFLAGS+=-g
-CPPFLAGS+=@CPPFLAGS_OS@
+CXXFLAGS+=@CXXFLAGS_OS@
+LDFLAGS+=@LDFLAGS_OS@
+
+BOOSTUTF_LIBS=@LIBS_BOOSTUTF@
ifeq ($(cuda),yes)
CPPFLAGS += @CPPFLAGS_CUDA@ -DASTRA_CUDA
@@ -47,47 +64,39 @@ NVCC = @NVCC@
endif
ifeq ($(matlab),yes)
+# TODO: Do we also want -fopenmp for octave?
CPPFLAGS+=-I$(MATLAB_ROOT)/extern/include -DMATLAB_MEX_FILE
+ifeq ($(macos),no)
CXXFLAGS+=-fopenmp
LDFLAGS+=-fopenmp
endif
+endif
+
+# MODLDFLAGS are the base LDFLAGS for matlab, octave, python modules
+MODLDFLAGS=$(LDFLAGS) -L$(abs_top_builddir)/.libs
+ifeq ($(install_type),module)
+MODLDFLAGS+=-Wl,-rpath,'\$$ORIGIN'
+endif
ifeq ($(python),yes)
PYTHON = @PYTHON@
-PYLIBDIR = $(shell $(PYTHON) -c 'from distutils.sysconfig import get_config_var; import six; six.print_(get_config_var("LIBDIR"))')
-PYINCDIR = $(shell $(PYTHON) -c 'from distutils.sysconfig import get_python_inc; import six; six.print_(get_python_inc())')
+PYINCDIR := $(shell $(PYTHON) -c 'from __future__ import print_function; from distutils.sysconfig import get_python_inc; print(get_python_inc())')
PYLIBVER = `basename $(PYINCDIR)`
CPPFLAGS += -DASTRA_PYTHON -I$(PYINCDIR)
PYCPPFLAGS := $(CPPFLAGS)
PYCPPFLAGS += -I../include
-PYLDFLAGS = $(LDFLAGS)
-PYLDFLAGS += -L$(abs_top_builddir)/.libs
+PYLDFLAGS = $(MODLDFLAGS)
+MODPYLIBS=-l$(PYLIBVER)
endif
# This is below where PYCPPFLAGS copies CPPFLAGS. The python code is built
# from a different directory, so these relative includes would be wrong.
CPPFLAGS+=-I$(srcdir)/../.. -I$(srcdir)/../../include -I$(srcdir)/../../lib/include
-BOOST_CPPFLAGS=
-BOOST_LDFLAGS=
-
-BOOSTUTF_LIBS=@LIBS_BOOSTUTF@
-
-
-CPPFLAGS+=$(BOOST_CPPFLAGS)
-LDFLAGS+=$(BOOST_LDFLAGS)
-
-
-MKDIR=mkdir -p
-CXX=@CXX@
-LD=@CXX@
-SHELL=@SHELL@
-INSTALL_SH=$(SHELL) $(srcdir)/install-sh
-
ifeq ($(matlab),yes)
MEXFLAGS = -cxx
-MEXLDFLAGS='$$LDFLAGS $(LDFLAGS)'
-MEXLIBS = -L.libs -lut
+MEXLDFLAGS=\$$LDFLAGS $(MODLDFLAGS)
+MEXLIBS = -lut
MEXSUFFIX = @MEXSUFFIX@
MEX = @MEX@
@@ -95,14 +104,20 @@ ifeq ($(cuda),yes)
MEXFLAGS += -DASTRA_CUDA
endif
-ifeq ($(python),yes)
-MEXPYLDFLAGS='$$LDFLAGS $(LDFLAGS) -L$(PYLIBDIR)'
-MEXPYLIBS=$(MEXLIBS) -l$(PYLIBVER)
+endif
+
+
+ifeq ($(octave),yes)
+OCTLDFLAGS:=$(MODLDFLAGS)
+CPPFLAGS += @OCTAVE_CPPFLAGS@
+ifeq ($(cuda),yes)
+OCTFLAGS=-DASTRA_CUDA
+else
+OCTFLAGS=
endif
endif
-LIBDIR=/usr/local/lib
DEPDIR=.deps
@@ -190,7 +205,10 @@ CUDA_CXX_OBJECTS=\
src/CudaFDKAlgorithm3D.lo \
src/CudaSirtAlgorithm3D.lo \
src/CudaBackProjectionAlgorithm3D.lo \
- src/CudaForwardProjectionAlgorithm3D.lo
+ src/CudaForwardProjectionAlgorithm3D.lo \
+ src/Float32Data3DGPU.lo \
+ src/Float32ProjectionData3DGPU.lo \
+ src/Float32VolumeData3DGPU.lo
CUDA_OBJECTS=\
cuda/2d/algo.lo \
@@ -258,47 +276,79 @@ MATLAB_MEX=\
matlab/mex/astra_mex_data3d_c.$(MEXSUFFIX) \
matlab/mex/astra_mex_direct_c.$(MEXSUFFIX)
+OCTAVE_CXX_OBJECTS=\
+ matlab/mex/octave_support.o
+
+OCTAVE_MEX=\
+ matlab/mex/astra_mex_algorithm_c.mex \
+ matlab/mex/astra_mex_data2d_c.mex \
+ matlab/mex/astra_mex_c.mex \
+ matlab/mex/astra_mex_matrix_c.mex \
+ matlab/mex/astra_mex_projector_c.mex \
+ matlab/mex/astra_mex_projector3d_c.mex \
+ matlab/mex/astra_mex_log_c.mex \
+ matlab/mex/astra_mex_data3d_c.mex \
+ matlab/mex/astra_mex_direct_c.mex
+
ifeq ($(python),yes)
MATLAB_MEX+=matlab/mex/astra_mex_plugin_c.$(MEXSUFFIX)
+OCTAVE_MEX+=matlab/mex/astra_mex_plugin_c.mex
endif
+
OBJECT_DIRS = src/ tests/ cuda/2d/ cuda/3d/ matlab/mex/ ./
DEPDIRS = $(addsuffix $(DEPDIR),$(OBJECT_DIRS))
-include $(wildcard $(addsuffix /*.d,$(DEPDIRS)))
LIBDIRS = $(addsuffix .libs,./ src/ cuda/2d/ cuda/3d/)
+SONAME=$(shell . ${abs_top_builddir}/libastra.la; echo $$dlname)
ifeq ($(matlab),yes)
mex: $(MATLAB_MEX)
%.$(MEXSUFFIX): %.o $(MATLAB_CXX_OBJECTS) libastra.la
- $(MEX) LDFLAGS=$(MEXLDFLAGS) $(MEXFLAGS) $(LIBS) $(MEXLIBS) -lastra -output $* $*.o $(MATLAB_CXX_OBJECTS)
+ $(MEX) LDFLAGS="$(MEXLDFLAGS)" $(MEXFLAGS) $(LIBS) $(MEXLIBS) -lastra -output $* $*.o $(MATLAB_CXX_OBJECTS)
+ifeq ($(install_type),module)
+ifeq ($(macos),yes)
+ @# tell macOS dynamic loader to look in mex directory for libastra.0.dylib
+ @# CHECKME: some versions of otool return a two-line output for otool -DX?
+ @# (xcode 8.2.1 / macos 10.11.6 ?)
+ install_name_tool -change `otool -DX .libs/$(SONAME) | tail -n 1` @loader_path/$(SONAME) $@
+endif
+endif
ifeq ($(python),yes)
matlab/mex/astra_mex_plugin_c.$(MEXSUFFIX): matlab/mex/astra_mex_plugin_c.o $(MATLAB_CXX_OBJECTS) libastra.la
- $(MEX) LDFLAGS=$(MEXPYLDFLAGS) $(MEXFLAGS) $(LIBS) $(MEXPYLIBS) -lastra -output matlab/mex/astra_mex_plugin_c $< $(MATLAB_CXX_OBJECTS)
+ $(MEX) LDFLAGS="$(MEXLDFLAGS)" $(MEXFLAGS) $(LIBS) $(MEXLIBS) $(MODPYLIBS) -lastra -output matlab/mex/astra_mex_plugin_c $< $(MATLAB_CXX_OBJECTS)
endif
endif
ifeq ($(python),yes)
py: libastra.la
$(MKDIR) python/build
- $(MKDIR) python/finalbuild
- # Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++.
- cd $(srcdir)/../../python; CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build install \
- --install-base=$(abs_top_builddir)/python/finalbuild --install-headers=$(abs_top_builddir)/python/finalbuild --install-purelib=$(abs_top_builddir)/python/finalbuild \
- --install-platlib=$(abs_top_builddir)/python/finalbuild --install-scripts=$(abs_top_builddir)/python/finalbuild --install-data=$(abs_top_builddir)/python/finalbuild
-
-python-root-install: libastra.la
- $(MKDIR) python/build
- # Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++.
- cd $(srcdir)/../../python; CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build install
+# TODO: Avoid writing into source dir
+ ln -s $(abs_top_builddir)/.libs/$(SONAME) $(srcdir)/../../python/astra
+# Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++.
+ (cd $(srcdir)/../../python; ASTRA_INSTALL_LIBRARY_AS_DATA=$(PYPKGDATA) CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS='${PYLDFLAGS}' $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build) || (rm $(srcdir)/../../python/astra/$(SONAME); false)
+ rm $(srcdir)/../../python/astra/$(SONAME)
endif
+ifeq ($(octave),yes)
+oct: $(OCTAVE_MEX)
+
+%.mex: %.o $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS) libastra.la
+ mkoctfile --mex $(OCTFLAGS) $(OCTLDFLAGS) $(LIBS) -lastra --output $* $*.o $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS)
+
+ifeq ($(python),yes)
+matlab/mex/astra_mex_plugin_c.mex: matlab/mex/astra_mex_plugin_c.o $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS) libastra.la
+ mkoctfile --mex $(OCTFLAGS) $(OCTLDFLAGS) $(LIBS) $(MODPYLIBS) -lastra --output matlab/mex/astra_mex_plugin_c $< $(MATLAB_CXX_OBJECTS) $(OCTAVE_CXX_OBJECTS)
+endif
+endif
+
libastra.la: $(ALL_OBJECTS)
- ./libtool --mode=link --tag=CXX $(LD) -rpath $(LIBDIR) -o $@ $(LDFLAGS) $(LIBS) $+
+ ./libtool --mode=link --tag=CXX $(LD) -rpath @libdir@ -o $@ $(LDFLAGS) $(LIBS) $+
%.o: %.cpp
$(MKDIR) $(*D)/$(DEPDIR)
@@ -321,12 +371,13 @@ ifeq ($(gen_static_libs),yes)
@$(NVCC) $(NVCCFLAGS) -c $(<) -o $*.o >/dev/null 2>&1
endif
@# Generate a .d file, and change the target name in it from .o to .lo
+ @# CUDA 5.5's nvcc doesn't have the -MT option we would like to use.
@$(NVCC) $(NVCCFLAGS) -M $(<) -odir $(*D) -o $(*D)/$(DEPDIR)/$(*F).d2
@sed '1s/\.o :/.lo :/' < $(*D)/$(DEPDIR)/$(*F).d2 > $(*D)/$(DEPDIR)/$(*F).d
@rm -f $(*D)/$(DEPDIR)/$(*F).d2
@# Generate empty targets for all dependencies listed in the .d file.
@# This mimics gcc's -MP option.
- @for x in `cat $(*D)/$(DEPDIR)/$(*F).d`; do if test a$$x != a: -a a$$x != a\\; then echo -e "\n$$x:\n" >> $(*D)/$(DEPDIR)/$(*F).d; fi; done
+ @for x in `cat $(*D)/$(DEPDIR)/$(*F).d`; do if test a$$x != a: -a a$$x != a\\; then (echo; echo "$$x:") >> $(*D)/$(DEPDIR)/$(*F).d; fi; done
@# Generate a fake libtool .lo file
@echo "# $*.lo - a libtool object file" > $*.lo
@echo "# Generated by" `./libtool --version | head -n 1` >> $*.lo
@@ -377,43 +428,107 @@ distclean: clean
rm -rf $(srcdir)/autom4te.cache
rm -f $(srcdir)/configure Makefile
-install: install-libraries install-matlab install-python
-
install-libraries: libastra.la
$(INSTALL_SH) -m 755 -d @libdir@
./libtool --mode=install $(INSTALL_SH) -m 644 libastra.la @libdir@
./libtool --mode=finish @libdir@
-ifeq ($(matlab),yes)
-# TODO: This install location doesn't work well for /usr or /usr/local
-install-matlab: $(MATLAB_MEX)
- $(INSTALL_SH) -m 755 -d @prefix@/matlab
- $(INSTALL_SH) -m 755 -d @prefix@/matlab/mex
- $(INSTALL_SH) -m 755 -d @prefix@/matlab/tools
- $(INSTALL_SH) -m 644 $(MATLAB_MEX) @prefix@/matlab/mex
- $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/tools/*.m @prefix@/matlab/tools
-# TODO: docs
+
+# ------------------------
+# INSTALLATION
+# ------------------------
+
+ifeq ($(install_type),prefix)
+# libraries into @libdir@, python into site-packages, mex into @datadir@
+install: install-libraries install-matlab install-python-site-packages install-octave
+
+PYPKGDATA=
+MATLABBASE=@datadir@/astra/matlab
+OCTAVEBASE=@datadir@/astra/octave
+endif
+
+ifeq ($(install_type),dir)
+# everything into @prefix@
+install: install-libraries install-matlab install-python install-octave
+
+PYPKGDATA=
+MATLABBASE=@prefix@/matlab
+OCTAVEBASE=@prefix@/octave
+PYTHONBASE=@prefix@/python
+endif
+
+ifeq ($(install_type),module)
+# python into site-packages, mex into @datadir@
+# library copied into python/mex directories
+# modules built with rpath=$ORIGIN
+install: install-matlab install-python-site-packages install-octave
+
+PYPKGDATA=$(SONAME)
+MATLABBASE=@prefix@/matlab
+OCTAVEBASE=@prefix@/octave
+
+install-matlab-so: libastra.la
+ $(INSTALL_SH) -m 755 -d $(MATLABBASE)/mex
+ $(INSTALL_SH) -m 755 $(abs_top_builddir)/.libs/$(SONAME) $(MATLABBASE)/mex
+install-octave-so: libastra.la
+ $(INSTALL_SH) -m 755 -d $(OCTAVEBASE)/mex
+ $(INSTALL_SH) -m 755 $(abs_top_builddir)/.libs/$(SONAME) $(OCTAVEBASE)/mex
else
-install-matlab:
+install-matlab-so:
+install-octave-so:
endif
+
+
ifeq ($(python),yes)
-# TODO: This install location doesn't work well for /usr or /usr/local
install-python: py
+ $(MKDIR) python/finalbuild
+ # Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++.
+ cd $(srcdir)/../../python; ASTRA_INSTALL_LIBRARY_AS_DATA=$(PYPKGDATA) CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build install \
+ --install-base=$(abs_top_builddir)/python/finalbuild --install-headers=$(abs_top_builddir)/python/finalbuild --install-purelib=$(abs_top_builddir)/python/finalbuild \
+ --install-platlib=$(abs_top_builddir)/python/finalbuild --install-scripts=$(abs_top_builddir)/python/finalbuild --install-data=$(abs_top_builddir)/python/finalbuild
$(INSTALL_SH) -m 755 -d @prefix@/python
$(INSTALL_SH) -m 755 -d @prefix@/python/astra
- $(INSTALL_SH) -m 644 python/finalbuild/astra/*.so @prefix@/python/astra
+ $(INSTALL_SH) -m 755 -d @prefix@/python/astra/plugins
+ $(INSTALL_SH) -m 755 python/finalbuild/astra/*.so @prefix@/python/astra
$(INSTALL_SH) -m 644 python/finalbuild/astra/*.py @prefix@/python/astra
+ $(INSTALL_SH) -m 644 python/finalbuild/astra/plugins/*.py @prefix@/python/astra/plugins
$(INSTALL_SH) -m 644 python/finalbuild/*.egg-info @prefix@/python/
- @echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
- @echo "To use ASTRA in Python, add @prefix@/python/ to your PYTHONPATH"
- @echo "and @libdir@ to your LD_LIBRARY_PATH."
- @echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
# TODO: docs
+
+install-python-site-packages: py
+# Note: setting CC to CXX is intentional. Python uses CC for compilation even if input is C++.
+ cd $(srcdir)/../../python; ASTRA_INSTALL_LIBRARY_AS_DATA=$(PYPKGDATA) CXX="${CXX}" CC="${CXX}" CPPFLAGS="${PYCPPFLAGS}" LDFLAGS="${PYLDFLAGS}" $(PYTHON) builder.py build --build-base=$(abs_top_builddir)/python/build install
else
+install-python-site-packages:
install-python:
endif
+ifeq ($(matlab),yes)
+install-matlab: $(MATLAB_MEX) install-matlab-so
+ $(INSTALL_SH) -m 755 -d $(MATLABBASE)
+ $(INSTALL_SH) -m 755 -d $(MATLABBASE)/mex
+ $(INSTALL_SH) -m 755 -d $(MATLABBASE)/tools
+ $(INSTALL_SH) -m 755 $(MATLAB_MEX) $(MATLABBASE)/mex
+ $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/tools/*.m $(MATLABBASE)/tools
+# TODO: docs
+else
+install-matlab:
+endif
+
+
+ifeq ($(octave),yes)
+install-octave: $(OCTAVE_MEX) install-octave-so
+ $(INSTALL_SH) -m 755 -d $(OCTAVEBASE)
+ $(INSTALL_SH) -m 755 -d $(OCTAVEBASE)/mex
+ $(INSTALL_SH) -m 755 -d $(OCTAVEBASE)/tools
+ $(INSTALL_SH) -m 755 $(OCTAVE_MEX) $(OCTAVEBASE)/mex
+ $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/tools/*.m $(OCTAVEBASE)/tools
+# TODO: docs
+else
+install-octave:
+endif
+
Makefile: $(srcdir)/Makefile.in config.status
CONFIG_HEADERS= CONFIG_LINKS= CONFIG_FILES=$@ $(SHELL) ./config.status
@@ -426,7 +541,7 @@ $(srcdir)/configure: $(srcdir)/configure.ac
@echo "configure.ac has been changed. Regenerating configure script"
cd $(srcdir) && $(SHELL) ./autogen.sh
-.PHONY: all mex test clean distclean install install-libraries py python-root-install install-python
+.PHONY: all mex test clean distclean install install-libraries py install-python-site-packages install-python install-octave install-matlab-so install-octave-so
# don't remove intermediate files:
.SECONDARY: