1## @configure_input@
2##
3## @file    Makefile.in
4## @brief   Makefile template for libSBML Python bindings
5## @author  Mike Hucka
6## @author  Akija Jouraku
7##
8## <!--------------------------------------------------------------------------
9## This file is part of libSBML.  Please visit http://sbml.org for more
10## information about SBML, and the latest version of libSBML.
11##
12## Copyright (C) 2013-2018 jointly by the following organizations:
13##     1. California Institute of Technology, Pasadena, CA, USA
14##     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
15##     3. University of Heidelberg, Heidelberg, Germany
16##
17## Copyright (C) 2009-2013 jointly by the following organizations:
18##     1. California Institute of Technology, Pasadena, CA, USA
19##     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
20##
21## Copyright (C) 2006-2008 by the California Institute of Technology,
22##     Pasadena, CA, USA
23##
24## Copyright (C) 2002-2005 jointly by the following organizations:
25##     1. California Institute of Technology, Pasadena, CA, USA
26##     2. Japan Science and Technology Agency, Japan
27##
28## This library is free software; you can redistribute it and/or modify it
29## under the terms of the GNU Lesser General Public License as published by
30## the Free Software Foundation.  A copy of the license agreement is provided
31## in the file named "LICENSE.txt" included with this software distribution
32## and also available online as http://sbml.org/software/libsbml/license.html
33## ------------------------------------------------------------------------ -->
34
35
36# -----------------------------------------------------------------------------
37# Configuration variables
38# -----------------------------------------------------------------------------
39# Some of the following are substituted automatically by `configure'.  If
40# you are looking at "Makefile", do not edit these values; instead, run the
41# configure script at the top level of the src tree.  It will recreate
42# "Makefile".
43
44include @top_srcdir@/config/makefile-common-vars.mk
45
46# `srcdir' points to the current directory, but should be set by configure.
47# `subdir' must be set manually to the relative dir under srcdir.  Don't
48# set `subdir' to an absolute path, or some make actions will fail.
49
50srcdir  = @srcdir@
51thisdir = src/bindings/python
52
53# In the normal core C++/C libSBML code, `sources' are used by the default
54# rules to determine what needs to be compiled.  In these language
55# bindings, the variable is not used by default rules, and everything is
56# handled explicitly below.  However, to maintain some resemblance to the
57# other libSBML build organization, we still use the name `sources'.
58
59sources       = libsbml.py libsbml_wrap.cpp libsbml_wrap.h
60
61extra_sources = libsbml.i                            \
62                libsbml-doxygen.py                   \
63                local.cpp                            \
64                local.i                              \
65                local-downcast-extension-layout.cpp  \
66                local-downcast-extension-l3v2extendedmath.cpp  \
67                local-downcast-extension.cpp.in      \
68                local-downcast-namespaces.cpp.in     \
69                local-downcast-astplugins.cpp.in     \
70                local-downcast-astplugins-l3v2extendedmath.cpp     \
71                local-downcast-namespaces-layout.cpp \
72                local-downcast-namespaces-l3v2extendedmath.cpp \
73                local-downcast-converters.cpp.in     \
74                local-downcast-converters-layout.cpp \
75                local-downcast-plugins-layout.cpp    \
76                local-downcast-plugins-l3v2extendedmath.cpp    \
77                local-downcast-plugins.cpp.in        \
78                local-downcast-packages-layout.cpp   \
79                local-downcast-packages-l3v2extendedmath.cpp   \
80                local-downcast.cpp.in                \
81                local-contrib.i                      \
82                pydoc-normal.i                       \
83                pydoc-doxygen.i
84
85# `libraries' is what we're building: a module for use with Python.
86# (The leading underscore in the name below is a Python convention.)
87
88libraries = _libsbml.$(PYTHON_EXT)
89
90# The SWIG interface files should not need to be regenerated for recipients
91# of the libSBML distributions; only developers should need to regenerate
92# them.  The conditions for this are handled later below.
93
94swig_sources = ../swig/libsbml.h ../swig/libsbml.i local.i
95
96
97# If we're building 64-bit binaries, but are not running under 10.6, the
98# version of python will probably be 32 bit instead of 64 bit.
99
100ifdef USE_UNIVBINARY
101  ifneq "$(MACOS_VERSION)" "10.6"
102  ifneq "$(MACOS_VERSION)" "10.7"
103  ifneq "$(MACOS_VERSION)" "10.8"
104  ifneq "$(MACOS_VERSION)" "10.9"
105    filtered_cflags   = $(shell echo '$(CFLAGS)'   | sed -e "s/-arch x86_64//g")
106    filtered_cppflags = $(shell echo '$(CPPFLAGS)' | sed -e "s/-arch x86_64//g")
107    filtered_cxxflags = $(shell echo '$(CXXFLAGS)' | sed -e "s/-arch x86_64//g")
108    filtered_ldflags  = $(shell echo '$(LDFLAGS)'  | sed -e "s/-arch x86_64//g")
109
110    CFLAGS   := $(filtered_cflags)
111    CPPFLAGS := $(filtered_cppflags)
112    CXXFLAGS := $(filtered_cxxflags)
113    LDFLAGS  := $(filtered_ldflags)
114  endif
115  endif
116  endif
117  endif
118endif
119
120# Variables `subdirs', `headers', `sources', `libraries', `extra_CPPFLAGS',
121# `extra_CXXFLAGS', `extra_LDFLAGS' and `distfiles' are used by the default
122# rules in `makefile-common-actions.mk' included at the end.
123
124extra_CPPFLAGS += $(PYTHON_CPPFLAGS) -I../swig -I../../../include
125SWIGFLAGS      += $(PYTHON_CPPFLAGS) -I../swig
126
127# SBML package plug-ins
128ifdef USE_COMP
129  SWIGFLAGS      += -DUSE_COMP
130  SWIGDOCDEFINES += --define USE_COMP
131endif # USE_COMP
132
133ifdef USE_FBC
134  SWIGFLAGS      += -DUSE_FBC
135  SWIGDOCDEFINES += --define USE_FBC
136endif # USE_FBC
137
138ifdef USE_GROUPS
139  SWIGFLAGS      += -DUSE_GROUPS
140  SWIGDOCDEFINES += --define USE_GROUPS
141endif # USE_GROUPS
142
143ifdef USE_LAYOUT
144  SWIGFLAGS      += -DUSE_LAYOUT
145  SWIGDOCDEFINES += --define USE_LAYOUT
146endif # USE_LAYOUT
147
148ifdef USE_QUAL
149  SWIGFLAGS      += -DUSE_QUAL
150  SWIGDOCDEFINES += --define USE_QUAL
151endif # USE_QUAL
152
153ifdef USE_MULTI
154  SWIGFLAGS      += -DUSE_MULTI
155  SWIGDOCDEFINES += --define USE_MULTI
156endif # USE_MULTI
157
158ifdef USE_RENDER
159  SWIGFLAGS      += -DUSE_RENDER
160  SWIGDOCDEFINES += --define USE_RENDER
161endif # USE_RENDER
162
163ifdef USE_L3V2EXTENDEDMATH
164  SWIGFLAGS      += -DUSE_L3V2EXTENDEDMATH
165  SWIGDOCDEFINES += --define USE_L3V2EXTENDEDMATH
166endif # USE_L3V2EXTENDEDMATH
167
168# On MacOS X, compilation generates a warning about `long double'.
169
170ifeq "$(HOST_TYPE)" "darwin"
171  ifdef HAS_GCC_WNO_LONG_DOUBLE
172    extra_CPPFLAGS += -Wno-long-double
173  endif
174endif
175
176extra_LDFLAGS  += $(PYTHON_LDFLAGS)
177extra_LIBS     += ../../libsbml.la $(PYTHON_LIBS)
178
179ifdef USE_EXPAT
180  extra_CPPFLAGS += @EXPAT_CPPFLAGS@
181  extra_LDFLAGS  += @EXPAT_LDFLAGS@
182  extra_LIBS     += @EXPAT_LIBS@
183endif
184
185ifdef USE_XERCES
186  extra_CPPFLAGS += @XERCES_CPPFLAGS@
187  extra_LDFLAGS  += @XERCES_LDFLAGS@
188  extra_LIBS     += @XERCES_LIBS@
189endif
190
191ifdef USE_LIBXML
192  extra_CPPFLAGS += @LIBXML_CPPFLAGS@
193  extra_LDFLAGS  += @LIBXML_LDFLAGS@
194  extra_LIBS     += @LIBXML_LIBS@
195endif
196
197# -fno-strict-aliasing option is added to CXXFLAGS when using GCC.  As
198# written in the SWIG Manual (section 20.2.4), SWIG generated code could
199# cause crash problems when compiled by GCC with -fstrict-aliasing option
200# (automatically enabled when using -O2 or higher optimization in GCC 3 or
201# later) and the option should be disabled by adding -fno-strict-aliasing
202# option.
203
204ifeq (GCC,$(findstring GCC,$(shell $(CXX) --version)))
205      CXXFLAGS += -fno-strict-aliasing
206endif
207
208# `distfiles' determines the files and directories included in a distribution.
209# `distfiles_exclude' is used to filter out specific items, so that even if
210# they appear in `distfiles', they will not be copied in the distribution.
211
212distfiles =							  \
213            Makefile.in						  \
214            CMakeLists.txt					  \
215            add_version.cmake					  \
216            patch-python.cmake					  \
217            setup.py.cmake					  \
218            test.py						  \
219            local-doc-extras.i					  \
220            local-packages.i.in					  \
221            local-layout.i					  \
222            local-l3v2extendedmath.i					  \
223            setup.cfg						  \
224            setup.py.in						  \
225            doc-converter/argparse.py				  \
226            doc-converter/prettytable.py			  \
227            doc-converter/prettytable-0.7.2/COPYING		  \
228            doc-converter/prettytable-0.7.2/README		  \
229            doc-converter/prettytable-0.7.2/README-LIBSBML.txt    \
230            doc-converter/prettytable-0.7.2/prettytable-0.7.2.zip \
231            doc-converter/rewrite_pydoc.py			  \
232            doc-converter/README.txt				  \
233            $(sources)						  \
234            $(extra_sources)					  \
235            $(python_test_files)
236
237python_test_path = test
238python_test_files = $(wildcard $(python_test_path)/**/Test*.py)
239
240extra_clean =			      \
241	build			      \
242	$(python_test_files:.py=.pyc) \
243	$(wildcard test.xml.*)
244
245extra_distclean =		      \
246	$(installed_files_list)	      \
247	libsbml.py		      \
248	libsbml.pyc		      \
249	libsbml-doxygen.py	      \
250	local-downcast-extension.i    \
251	local-downcast-extension.cpp  \
252	local-downcast-namespaces.i   \
253	local-downcast-namespaces.cpp \
254	local-packages.i	      \
255	local-downcast-plugins.cpp    \
256	local-downcast.cpp	      \
257	pydoc-doxygen.i		      \
258	pydoc-normal.i		      \
259	setup.py
260
261# We generate _libsbml.$(PYTHON_EXT) (C++ library for Python bindings) with
262# an object file in this directory (libsbml_wrap.o) and other object files
263# in sub directories in 'src' directory (src/sbml, src/common, ... ) instead
264# of linking a shared library of libSBML (libsbml.$(SHAREDLIBEXT)).
265
266# All directories that contain *.{c,cpp} (implementation) files of libSBML need
267# to be listed in the following 'otherdirs' variable.
268
269otherdirs = ../../sbml/common ../../sbml/util ../../sbml/xml \
270	        ../../sbml/math ../../sbml/validator ../../sbml/validator/constraints \
271	        ../../sbml/units ../../sbml/annotation ../../sbml/compress \
272            ../../sbml/ ../../sbml/extension ../../sbml/conversion
273
274
275ifdef USE_COMP
276  otherdirs += ../../sbml/packages/comp/common \
277               ../../sbml/packages/comp/extension \
278               ../../sbml/packages/comp/sbml \
279               ../../sbml/packages/comp/util \
280               ../../sbml/packages/comp/validator \
281               ../../sbml/packages/comp/validator/constraints
282endif
283ifdef USE_FBC
284  otherdirs += ../../sbml/packages/fbc/common \
285               ../../sbml/packages/fbc/extension \
286               ../../sbml/packages/fbc/sbml \
287               ../../sbml/packages/fbc/util \
288               ../../sbml/packages/fbc/validator \
289               ../../sbml/packages/fbc/validator/constraints
290endif
291ifdef USE_GROUPS
292  otherdirs += ../../sbml/packages/groups/common \
293               ../../sbml/packages/groups/extension \
294               ../../sbml/packages/groups/sbml \
295               ../../sbml/packages/groups/validator \
296               ../../sbml/packages/groups/validator/constraints
297endif
298ifdef USE_LAYOUT
299  otherdirs += ../../sbml/packages/layout/common \
300               ../../sbml/packages/layout/extension \
301               ../../sbml/packages/layout/sbml \
302               ../../sbml/packages/layout/util \
303               ../../sbml/packages/layout/validator \
304               ../../sbml/packages/layout/validator/constraints
305endif
306ifdef USE_QUAL
307  otherdirs += ../../sbml/packages/qual/common \
308               ../../sbml/packages/qual/extension \
309               ../../sbml/packages/qual/sbml \
310               ../../sbml/packages/qual/validator \
311               ../../sbml/packages/qual/validator/constraints
312endif
313ifdef USE_MULTI
314  otherdirs += ../../sbml/packages/multi/common \
315               ../../sbml/packages/multi/extension \
316               ../../sbml/packages/multi/sbml \
317               ../../sbml/packages/multi/validator \
318               ../../sbml/packages/multi/validator/constraints
319endif
320ifdef USE_RENDER
321  otherdirs += ../../sbml/packages/render/common \
322               ../../sbml/packages/render/extension \
323               ../../sbml/packages/render/sbml \
324               ../../sbml/packages/render/validator \
325               ../../sbml/packages/render/validator/constraints
326endif
327ifdef USE_L3V2EXTENDEDMATH
328  otherdirs += ../../sbml/packages/l3v2extendedmath/common \
329               ../../sbml/packages/l3v2extendedmath/extension \
330               ../../sbml/packages/l3v2extendedmath/validator \
331               ../../sbml/packages/l3v2extendedmath/validator/constraints
332endif
333
334objfiles  = libsbml_wrap.lo $(wildcard $(addsuffix /*.lo,$(otherdirs)))
335
336# Environment variable MACOSX_DEPLOYMENT_TARGET must be set to 10.3 or later
337# to use -undefined dynamic_lookup.
338
339ifeq "$(HOST_TYPE)" "darwin"
340  export MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION)
341%.so: $(objfiles)
342	$(call link_dl_lib,$@)
343endif
344
345# The libSBML Python API library on MacOS X has to be built as a "bundle"
346# rather than a .dylib library.  This is different from the default rules
347# used elsewhere in libSBML and requires the following special value for
348# `platform_link_flags'.  The rest of the default rules for .so's will
349# behave properly once this is set.
350
351ifeq "$(HOST_TYPE)" "darwin"
352  platform_link_flags = -bundle
353endif
354
355# For Linux/Unix LD_LIBRARY_PATH *may* need to contain one or more library
356# paths to libsbml.so, libxerces-c.so and/or libexpat.so and/or the
357# libsbml.so _libsbml.so generated by this Makfile.  (For BSD/MacOS X
358# replace LD_LIBRARY_PATH with DYLD_LIBRARY_PATH.)
359
360
361# -----------------------------------------------------------------------------
362# Primary build actions
363# -----------------------------------------------------------------------------
364
365.SUFFIXES:
366.SUFFIXES: .i .cpp .py .pyc .pyo .o .obj .lo .la
367
368# The default action is to remake everything.
369
370ifdef USE_PYTHON
371  all: Makefile libsbml.py libsbml_wrap.cpp $(libraries)
372else
373  all:
374	@echo
375	@echo "Reconfigure libSBML using --with-python to enable Python support.";
376	@echo
377	@exit 1
378endif
379
380setup.py: setup.py.in
381	cd $(TOP_BUILDDIR) && $(SHELL) ./config.status $(thisdir)/setup.py
382
383# Rummage through ../swig/libsbml.i to figure out the core libSBML files that
384# are our dependencies.
385
386main_sources = \
387  $(shell grep '%include sbml' ../swig/libsbml.i | grep -v 'libsbml-version.h' \
388    | cut -f2- -d'/' | sed -e 's,^,../../sbml/,g')
389
390# Recreate SWIG files when one of the following conditions is true:
391#
392#  (1) libsbml_wrap.cpp does not exist
393#  (2) libsbml_wrap.cpp exists, but the file is not consistent with the
394#       current USE_LAYOUT, USE_COMP, etc., values.
395#
396# If the last run was made with a package flag like --enable-layout, and this
397# run isn't, or vice-versa, the swig wrap files will be wrong for this run.
398# However, you can't tell just by looking at file mod times, so you can't use
399# normal make dependencies.  So we do this grungy trick of looking inside
400# libsbml_wrap.cpp to see what's inside.
401#
402# The check_foo macros works as follows.  They return a non-empty string
403# "do_reswig" if re-swig'ing is called for, and this string is a phony make
404# target declared below.  When check_layout is used as a dependency of
405# libsbml_wrap.cpp via a call like this,
406#
407#  libsbml_wrap.cpp: $(shell $(call check_layout)) ...other dependencies...
408#   ...ACTIONS...
409#
410# what will happen is either check_layout will return nothing, in which
411# case the dependency is satisfied and no swig'ing needs to be done, or
412# it will return "do_reswig", a phony target that is never satisfied,
413# in which case the ...ACTIONS... will be executed.
414
415.PHONY: do_reswig
416
417ifdef USE_COMP
418  define check_comp
419    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
420    if test -z "`grep getListOfSubmodels libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
421  endef
422else
423  define check_comp
424    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
425    if test -n "`grep getListOfSubmodels libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
426  endef
427endif
428
429ifdef USE_FBC
430  define check_fbc
431    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
432    if test -z "`grep ListOfFluxBounds libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
433  endef
434else
435  define check_fbc
436    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
437    if test -n "`grep ListOfFluxBounds libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
438  endef
439endif
440
441ifdef USE_GROUPS
442  define check_groups
443    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
444    if test -z "`grep ListOfGroups libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
445  endef
446else
447  define check_groups
448    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
449    if test -n "`grep ListOfGroups libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
450  endef
451endif
452
453ifdef USE_LAYOUT
454  define check_layout
455    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
456    if test -z "`grep getListOfLayouts libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
457  endef
458else
459  define check_layout
460    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
461    if test -n "`grep getListOfLayouts libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
462  endef
463endif
464
465ifdef USE_QUAL
466  define check_qual
467    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
468    if test -z "`grep ListOfQualitativeSpecies libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
469  endef
470else
471  define check_qual
472    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
473    if test -n "`grep ListOfQualitativeSpecies libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
474  endef
475endif
476
477ifdef USE_MULTI
478  define check_multi
479    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
480    if test -z "`grep ListOfSpeciesFeatures libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
481  endef
482else
483  define check_multi
484    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
485    if test -n "`grep ListOfSpeciesFeatures libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
486  endef
487endif
488ifdef USE_RENDER
489  define check_render
490    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
491    if test -z "`grep ListOfGlobalRenderInformation libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
492  endef
493else
494  define check_render
495    if test ! -f libsbml_wrap.cpp; then echo "do_reswig"; exit; fi; \
496    if test -n "`grep ListOfGlobalRenderInformation libsbml_wrap.cpp`"; then echo "do_reswig"; fi;
497  endef
498endif
499ifdef USE_L3V2EXTENDEDMATH
500  define check_l3v2extendedmath
501    if test ! -f LibSBML_wrap.cxx; then echo "do_reswig"; exit; fi;
502  endef
503else
504  define check_l3v2extendedmath
505    if test ! -f LibSBML_wrap.cxx; then echo "do_reswig"; exit; fi;
506  endef
507endif
508
509libsbml.py: libsbml_wrap.cpp
510
511# Generate the documentation files.  pydoc-normal.i is used to create the
512# help strings that are incorporated into the Python code, so that users
513# can use the interactive "help" function in Python.
514
515pydoc-doxygen.i: $(swig_sources) $(main_sources) ../swig/swigdoc.py \
516  doc-converter/rewrite_pydoc.py ../swig/libsbml.i
517	touch ../../../docs/src/libsbml-converters.txt && ../swig/swigdoc.py --language python --top ../../.. $(SWIGDOCDEFINES) \
518		--extra ../../../docs/src/libsbml-converters.txt \
519		--master ../swig/libsbml.i --output pydoc-doxygen.i
520
521pydoc-normal.i: pydoc-doxygen.i
522	./doc-converter/rewrite_pydoc.py -f pydoc-doxygen.i -o pydoc-normal.i \
523		-i ../../../docs/src/common-text -g ../../../docs/src/common-graphics
524
525# Swig gets run twice, once with documentation strings whose format are
526# suitable for use within Python (e.g., for the 'help' command), and once
527# with documentation strings suitable for use with our Doxygen-based
528# document generation system in ../../../docs/src/.
529
530libsbml_wrap.cpp: pydoc-doxygen.i pydoc-normal.i $(swig_sources) \
531  $(main_sources) $(shell $(call check_layout)) $(shell $(call check_comp)) \
532  $(shell $(call check_fbc)) $(shell $(call check_qual)) \
533  $(shell $(call check_groups)) $(shell $(call check_multi)) \
534  $(shell $(call check_render)) $(shell $(call check_l3v2extendedmath))
535	@top_srcdir@/config/chk_swig_version.sh || exit
536	mv pydoc-doxygen.i pydoc.i
537	$(SWIG) $(SWIGFLAGS) $(sort $(default_includes) $(INCLUDES)) \
538		 -DGENERATING_DOCS -c++ -python -o libsbml_wrap.cpp libsbml.i
539	mv pydoc.i pydoc-doxygen.i
540	mv libsbml.py libsbml-doxygen.py
541	mv pydoc-normal.i pydoc.i
542	$(SWIG) $(SWIGFLAGS) $(sort $(default_includes) $(INCLUDES)) \
543		-c++ -python -o libsbml_wrap.cpp libsbml.i
544	mv pydoc.i pydoc-normal.i
545	mv libsbml.py libsbml.pyc
546	echo 'from __future__ import generators' > libsbml.py
547	cat libsbml.pyc >> libsbml.py
548	if $(SWIG) -version | grep -q '1.3.39' ; then \
549	  mv libsbml_wrap.cpp libsbml_wrap.cpp.org; \
550	  sed -e \
551	  's/PyBytes_AsStringAndSize(str, \&cstr, \&len);/PyBytes_AsStringAndSize(str, \&cstr, (Py_ssize_t*)\&len);/' \
552	  libsbml_wrap.cpp.org > libsbml_wrap.cpp; \
553	fi
554
555
556# -----------------------------------------------------------------------------
557# Checking.
558# -----------------------------------------------------------------------------
559
560test_subdir_path = test/sbml:test/xml:test/annotation:test/math:test/layout
561
562check: $(libraries) $(shell $(call check_layout)) \
563  $(shell $(call check_fbc)) $(shell $(call check_comp)) \
564  $(shell $(call check_qual)) $(shell $(call check_groups)) \
565  $(shell $(call check_multi)) $(shell $(call check_render)) \
566  $(shell $(call check_l3v2extendedmath))
567	@echo
568	@echo
569	@echo Running Tests in $(thisdir)
570	@echo -----------------------------------------------------------------
571	$(call libsbmlrun, env PYTHONPATH=.:$(test_subdir_path) $(PYTHON) ./test.py)
572	@echo -----------------------------------------------------------------
573	@echo All tests passed
574	@echo
575
576#
577# 'make test-files' will reconstruct the test files.  This is not made part
578# of 'make check' (yet).
579#
580
581test-files:
582	$(call test_translator,p,xml math annotation sbml,test)
583
584
585# -----------------------------------------------------------------------------
586# Tags.
587# -----------------------------------------------------------------------------
588
589tags: etags ctags
590
591
592# -----------------------------------------------------------------------------
593# Installation.
594# -----------------------------------------------------------------------------
595
596# Take account of DESDIR if it was assigned when the make was invoked
597
598ifneq "$(DESTDIR)" ""
599  root = --root "$(DESTDIR)"
600endif
601
602installed_files_list = installed-files.txt
603
604# In order to avoid MACOSX_DEPLOYMENT_TARGET mismatch error on Mac OS X,
605# environment variable MACOSX_DEPLOYMENT_TARGET is set to '' at
606# install-time.  Python distutils sets proper value to
607# MACOSX_DEPLOYMENT_TARGET if the environment variable is set to ''.
608
609ifeq (, $(shell $(PYTHON) setup.py install --help | grep "\--install-layout.*known values: deb"))
610  install-cmd = setup.py install --record $(installed_files_list) --skip-build --prefix=$(prefix) $(root)
611else
612  install-cmd = setup.py install --record $(installed_files_list) --skip-build --prefix=$(prefix) --install-layout=deb $(root)
613endif
614
615install: setup.py create-build-dir
616ifeq "$(HOST_TYPE)" "darwin"
617	env MACOSX_DEPLOYMENT_TARGET='' $(PYTHON) $(install-cmd)
618else
619	$(PYTHON) $(install-cmd)
620endif
621
622create-build-dir: $(libraries)
623	mkdir -p build build/libsbml
624	echo "libsbml" > build/libsbml.pth
625	cp $(libraries)  build/libsbml
626	cp libsbml.py    build/libsbml/__init__.py
627
628installcheck:
629
630uninstall:
631	for i in `cat $(installed_files_list)`; do \
632	  d=`dirname $$i`; f=`echo $$i | sed 's,.*/,,'`; \
633	  find $$d -name "$$f" -o -name "libsbml.pth" | xargs -t /bin/rm -f ; \
634	done ; \
635
636
637# -----------------------------------------------------------------------------
638# Creating distribution (for libSBML maintainers only)
639# -----------------------------------------------------------------------------
640
641dist: libsbml_wrap.cpp dist-normal
642
643distcheck: distcheck-normal
644
645
646# -----------------------------------------------------------------------------
647# Miscellaneous
648# -----------------------------------------------------------------------------
649
650include @top_srcdir@/config/makefile-common-actions.mk
651
652
653# -----------------------------------------------------------------------------
654# End.
655# -----------------------------------------------------------------------------
656