## @configure_input@ ## ## @file Makefile.in ## @brief Makefile template for libSBML Python bindings ## @author Mike Hucka ## @author Akija Jouraku ## ## $Id: Makefile.in 9850 2009-07-18 10:33:19Z ajouraku $ ## $HeadURL: https://sbml.svn.sourceforge.net/svnroot/sbml/trunk/libsbml/src/bindings/python/Makefile.in $ ## ##*/ # ----------------------------------------------------------------------------- # Configuration variables # ----------------------------------------------------------------------------- # Some of the following are substituted automatically by `configure'. If # you are looking at "Makefile", do not edit these values; instead, run the # configure script at the top level of the src tree. It will recreate # "Makefile". include @top_srcdir@/config/makefile-common-vars.mk # `srcdir' points to the current directory, but should be set by configure. # `subdir' must be set manually to the relative dir under srcdir. Don't # set `subdir' to an absolute path, or some make actions will fail. srcdir = @srcdir@ thisdir = src/bindings/python # `sources' are used by the default rules to determine what needs to be # compiled. sources = libsbml.py libsbml_wrap.cpp # What we're building is a module for use with Python. # The leading underscore below is a Python convention. libraries = _libsbml.$(PYTHON_EXT) # environment variable MACOSX_DEPLOYMENT_TARGET must be set to 10.3 or later # to use -undefined dynamic_lookup. ifeq "$(HOST_TYPE)" "darwin" macosx_version=$(shell sw_vers -productVersion | cut -d"." -f1,2) export MACOSX_DEPLOYMENT_TARGET=${macosx_version} endif # Variables `subdirs', `headers', `sources', `libraries', `extra_CPPFLAGS', # `extra_CXXFLAGS', `extra_LDFLAGS' and `distfiles' are used by the default # rules in `makefile-common-actions.mk' included at the end. extra_CPPFLAGS += $(PYTHON_CPPFLAGS) -I../swig -I../../../include SWIGFLAGS += $(PYTHON_CPPFLAGS) -I../swig ifdef USE_LAYOUT SWIGFLAGS += -DUSE_LAYOUT extra_CPPFLAGS += -DUSE_LAYOUT endif # USE_LAYOUT # On MacOS X, compilation generates a warning about `long double'. ifeq "$(HOST_TYPE)" "darwin" extra_CPPFLAGS += -Wno-long-double endif # # -L../../ option appears first in command-line to always link # with the libSBML's shared library file in the relative path. # extra_LDFLAGS = -L../../ $(PYTHON_LDFLAGS) extra_LIBS = -lsbml $(PYTHON_LIBS) ifdef USE_EXPAT extra_CPPFLAGS += @EXPAT_CPPFLAGS@ extra_LDFLAGS += @EXPAT_LDFLAGS@ extra_LIBS += @EXPAT_LIBS@ endif ifdef USE_XERCES extra_CPPFLAGS += @XERCES_CPPFLAGS@ extra_LDFLAGS += @XERCES_LDFLAGS@ extra_LIBS += @XERCES_LIBS@ endif ifdef USE_LIBXML extra_CPPFLAGS += @LIBXML_CPPFLAGS@ extra_LDFLAGS += @LIBXML_LDFLAGS@ extra_LIBS += @LIBXML_LIBS@ endif ifdef USE_SUN_CC extra_LIBS += -lCstd endif # -fno-strict-aliasing option is added to CXXFLAGS when using GCC. # As written in the SWIG Manual (section 20.2.4), SWIG generated code could cause # crash problems when compiled by GCC with -fstrict-aliasing option (automatically # enabled when using -O2 or higher optimization in GCC 3 or later) and the option # should be disabled by adding -fno-strict-aliasing option. ifeq (GCC,$(findstring GCC,$(shell $(CXX) --version))) CXXFLAGS += -fno-strict-aliasing endif # For Linux/Unix LD_LIBRARY_PATH *may* need to contain one or more library # paths to libsbml.so, libxerces-c.so and/or libexpat.so and/or the # libsbml.so _libsbml.so generated by this Makfile. (For BSD/MacOS X # replace LD_LIBRARY_PATH with DYLD_LIBRARY_PATH.) # `distfiles' determines the files and directories included in a distribution. # `distfiles_exclude' is used to filter out specific items, so that even if # they appear in `distfiles', they will not be copied in the distribution. distfiles = \ Makefile.in \ Python_binding_Win32_expat.vcproj \ Python_binding_Win32.vcproj \ test.py \ createInclude.bat \ layout_local.i \ libsbml.i \ libsbml.py \ libsbml_wrap.cpp \ local.cpp \ local.i \ setup.cfg \ setup.py.in \ $(python_test_files) python_test_path = test python_test_files = $(wildcard $(python_test_path)/**/Test*.py) extra_clean = build $(python_test_files:.py=.pyc) $(wildcard test.xml.*) extra_distclean = libsbml.pyc setup.py # ----------------------------------------------------------------------------- # Primary build actions # ----------------------------------------------------------------------------- .SUFFIXES: .SUFFIXES: .i .cpp .py .pyc .pyo .o .obj objfiles = libsbml_wrap.$(OBJEXT) test_objfiles = $(objfiles) # The default action is to remake everything. all: Makefile swig-prereq $(libraries) # The libSBML Python API library on MacOS X has to be built as a "bundle" # rather than a .dylib library. This is different from the default rules # used elsewhere in libSBML and requires the following special value for # `platform_link_flags'. The rest of the default rules for .so's will # behave properly once this is set. ifeq "$(HOST_TYPE)" "darwin" platform_link_flags = -bundle endif # The following is for developers and maintainers. Recipients of the # library distributions shouldn't have to run SWIG because we provide the # wrapper file ready-made. This is only enabled if configure is given the # --with-swig flag. swig_sources = \ ../swig/libsbml.h \ ../swig/libsbml.i ifdef USE_LAYOUT swig_sources += ../swig/layout.i endif ifdef USE_SWIG # If swig is enabled, always rebuild the swig wrapper files. swig-prereq: $(MAKE) swigfiles else # not USE_SWIG # If USE_SWIG is *not* in effect, things get tricky. If the last run was # made with --enable-layout and this one isn't, or vice-versa, the swig # wrap files will be wrong for this run. However, you can't tell just by # looking at file mod times, so you can't use normal make dependencies. So # we do this grungy trick of looking at the file to see what's inside. ifdef USE_LAYOUT swig-prereq: @if test -z "`grep SWIGTYPE_p_Layout libsbml_wrap.cpp`"; then \ echo "The existing libsbml_wrap.cpp file lacks the layout code."; \ echo "Reconfigure --with-swig --enable-layout to correct this."; \ exit 1; \ else \ $(MAKE) libsbml_wrap.cpp libsbml.py; \ fi else # not USE_LAYOUT swig-prereq: @if test -n "`grep SWIGTYPE_p_Layout libsbml_wrap.cpp`"; then \ $(MAKE) swigfiles; \ else \ $(MAKE) libsbml_wrap.cpp libsbml.py; \ fi endif # USE_LAYOUT endif # USE_SWIG # The next target is for forcing re-swigging. swigfiles: ifdef USE_SWIG ../swig/swigdoc.py python -I../.. -D../../../docs/src ../swig/libsbml.i pydoc.i $(SWIG) $(SWIGFLAGS) \ $(sort $(default_includes) $(INCLUDES)) \ -c++ -python -o libsbml_wrap.cpp libsbml.i mv libsbml.py libsbml.pyc echo 'from __future__ import generators' > libsbml.py cat libsbml.pyc >> libsbml.py else echo "Reconfigure --with-swig in order to rebuild libsbml_wrap.cpp" exit 1 endif # The following are the normal dependency rules. libsbml_wrap.cpp libsbml.py: $(swig_sources) $(MAKE) swigfiles setup.py: setup.py.in cd $(TOP_BUILDDIR) && $(SHELL) ./config.status $(thisdir)/setup.py # ----------------------------------------------------------------------------- # Checking. # ----------------------------------------------------------------------------- test_subdir_path = test/sbml:test/xml:test/annotation:test/math ifdef USE_LIBCHECK check: $(libraries) @echo @echo @echo Running Tests in $(thisdir) @echo ----------------------------------------------------------------- $(call libsbmlrun, env PYTHONPATH=.:$(test_subdir_path) $(PYTHON) ./test.py) @echo ----------------------------------------------------------------- @echo All tests passed @echo else check:; @echo Please first rerun 'configure' with the --with-check flag; exit 1 endif # ----------------------------------------------------------------------------- # Tags. # ----------------------------------------------------------------------------- tags: etags ctags # ----------------------------------------------------------------------------- # Installation. # ----------------------------------------------------------------------------- # Take account of DESDIR if it was assigned when the make was invoked ifneq "$(DESTDIR)" "" root = --root "$(DESTDIR)" endif installed_files_list = installed-files.txt # In order to avoid MACOSX_DEPLOYMENT_TARGET mismatch error on Mac OS X, # environment variable MACOSX_DEPLOYMENT_TARGET is set to '' at # install-time. Python distutils sets proper value to # MACOSX_DEPLOYMENT_TARGET if the environment variable is set to ''. ifeq (, $(shell $(PYTHON) setup.py install --help | grep "\--install-layout.*known values: deb")) install-cmd = setup.py install --record $(installed_files_list) --skip-build --prefix=$(prefix) $(root) else install-cmd = setup.py install --record $(installed_files_list) --skip-build --install-layout=deb --prefix=$(prefix) $(root) endif install: setup.py create-build-dir ifeq "$(HOST_TYPE)" "darwin" env MACOSX_DEPLOYMENT_TARGET='' $(PYTHON) $(install-cmd) else $(PYTHON) $(install-cmd) endif create-build-dir: $(libraries) mkdir -p build build/libsbml echo "libsbml" > build/libsbml.pth cp $(libraries) build/libsbml cp libsbml.py build/libsbml installcheck: uninstall: for i in `cat $(installed_files_list)`; do \ d=`dirname $$i`; f=`echo $$i | sed 's,.*/,,'`; \ find $$d -name "$$f" -o -name "libsbml.pth" | xargs -t /bin/rm -f ; \ done ; \ # ----------------------------------------------------------------------------- # Creating distribution (for libSBML maintainers only) # ----------------------------------------------------------------------------- dist: libsbml_wrap.cpp dist-normal distcheck: distcheck-normal # ----------------------------------------------------------------------------- # Miscellaneous # ----------------------------------------------------------------------------- include @top_srcdir@/config/makefile-common-actions.mk # ----------------------------------------------------------------------------- # End. # -----------------------------------------------------------------------------