Makefile.am
5.43 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#############################################################################
# Makefile for ctools Python extension module #
# ------------------------------------------------------------------------- #
# Copyright (C) 2011-2016 Juergen Knoedlseder #
# ------------------------------------------------------------------------- #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# ------------------------------------------------------------------------- #
# This Makefile will build the Python interface files (*.py) and the Python #
# wrapper files using SWIG (if available; otherwise we have to make sure #
# the the files exist already). The Python distutils are used to build and #
# install the Python modules (see file setup.py.in). #
# #
# Process this file with automake to produce Makefile.in. #
#############################################################################
# Works only if Python is available
if WITH_PYTHON
# Test scripts to be distributed in $(pyexecdir)/ctools/tests
testscripts = ctools/tests/__init__.py \
../test/testing.py \
../test/test_python_ctools.py \
../test/test_ctobssim.py \
../test/test_ctselect.py \
../test/test_ctbin.py \
../test/test_ctlike.py \
../test/test_cttsmap.py \
../test/test_ctmodel.py \
../test/test_ctskymap.py \
../test/test_ctexpcube.py \
../test/test_ctpsfcube.py \
../test/test_ctedispcube.py \
../test/test_ctbkgcube.py \
../test/test_ctmapcube.py \
../test/test_ctcubemask.py \
../test/test_ctbutterfly.py \
../test/test_ctulimit.py \
../test/test_cterror.py \
../test/test_pipelines.py
testdata = ../test/data/crab.xml \
../test/data/crab_events.fits.gz \
../test/data/crab_cntmap.fits.gz \
../test/data/exclusion.reg
testirf = ../test/irf/cta_dummy_irf.dat
# Distribute scripts
EXTRA_DIST = $(testscripts) $(testdata) $(testirf)
testscriptsdir = $(pyexecdir)/ctools/tests
testscripts_DATA = $(testscripts)
testdatadir = $(pyexecdir)/ctools/tests/data
testdata_DATA = $(testdata)
testirfdir = $(pyexecdir)/ctools/tests/irf
testirf_DATA = $(testirf)
# Set SWIG interface filename
SWIG_INTERFACE = ctools/tools.i
# Dependencies. Obtain the list of dependencies by executing ls.
DEPFILES = $(shell ls *.Pi 2> /dev/null)
include $(DEPFILES)
# Define the targets that should be built before anything else.
# These are honored by 'make all', 'make check' and 'make install'.
if HAVE_SWIG
BUILT_SOURCES = ctools/tools_wrap.cpp ctools/tools.py
endif
# Set files to be removed in clean. We remove only the SWIG interface files
# if SWIG is available to rebuild them.
if HAVE_SWIG
CLEAN_FILES = $(BUILT_SOURCES)
endif
CLEANFILES = $(CLEAN_FILES) $(DEPFILES)
# Set SWIG compile command
SWIGCOMPILE = $(SWIG) -c++ -python -Wall -I$(prefix)/share/gammalib/swig -I$(GAMMALIB)/share/gammalib/swig
all-local: build
# We build the python extension twice since the install step needs the result
# in a specific directory and the test make check has no access to the name
# of this specific directory. So we build one instance for checking, the other
# for installation. If we could get the name built by distutils we could avoid
# this.
build: ctools/tools_wrap.cpp ctools/tools.py
$(PYTHON) setup.py build
if IS_ELCAPITAN
-for f in build/ctools/ctools/_*.so; do \
echo "Post process module "$$f; \
install_name_tool -change $(libdir)/libctools.1.dylib @rpath/libctools.1.dylib $$f; \
install_name_tool -change $(libdir)/libgamma.1.dylib @rpath/libgamma.1.dylib $$f; \
install_name_tool -add_rpath $(libdir) $$f; \
install_name_tool -add_rpath $(abs_top_srcdir)/src/.libs $$f; \
done
endif
install-exec-local:
$(PYTHON) setup.py install --prefix=$(prefix)
clean-local:
rm -rf build _tools.so
# Rule for building Python wrappers using SWIG.
if HAVE_SWIG
ctools/tools.py: ctools/tools_wrap.cpp
ctools/tools_wrap.cpp: $(SWIG_INTERFACE)
if $(SWIGCOMPILE) -MMD -MF "tools.Tpi" -o ctools/tools_wrap.cpp $<; \
then mv -f "tools.Tpi" "tools.Pi"; else rm -f "tools.Tpi"; exit 1; fi
endif # HAVE_SWIG
endif # WITH_PYTHON