## @configure_input@ ## ## @file Makefile.in ## @brief Makefile template for libSBML Ruby bindings ## @author Alex Gutteridge ## @author Mike Hucka ## @author Akiya Jouraku ## ## $Id: Makefile.in 9850 2009-07-18 10:33:19Z ajouraku $ ## $HeadURL: https://sbml.svn.sourceforge.net/svnroot/sbml/trunk/libsbml/src/bindings/ruby/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/ruby # `sources' are used by the default rules to determine what needs to be # compiled. sources = libsbml_wrap.cpp # What we're building is a module for use with ruby. ifeq "$(HOST_TYPE)" "darwin" # MacOS X note: this MUST remain .bundle. libraries = libSBML.bundle # environment variable MACOSX_DEPLOYMENT_TARGET must be set to 10.3 or later # to use -undefined dynamic_lookup. macosx_version=$(shell sw_vers -productVersion | cut -d"." -f1,2) export MACOSX_DEPLOYMENT_TARGET=${macosx_version} else libraries = libSBML.$(SHAREDLIBEXT) 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 = $(RUBY_CPPFLAGS) -I../swig -I../.. SWIGFLAGS += $(RUBY_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../../ $(RUBY_LDFLAGS) extra_LIBS = -lsbml $(RUBY_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 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. ruby_test_path = test ruby_test_files = test.rb $(wildcard $(ruby_test_path)/**/Test*.rb) ruby_swig_sources = libsbml.i local.i layout_local.i local.cpp distfiles = Makefile.in libsbml_wrap.cpp README.txt $(ruby_swig_sources) $(ruby_test_files) extra_clean = build $(wildcard test.xml.*) # ----------------------------------------------------------------------------- # Primary build actions # ----------------------------------------------------------------------------- .SUFFIXES: .SUFFIXES: .i .cpp .o .obj objfiles = libsbml_wrap.$(OBJEXT) test_objfiles = $(objfiles) # The default action is to remake everything. all: Makefile swig-prereq $(libraries) # The libSBML Ruby 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 .bundle'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 \ ../swig/swigdoc.py \ $(ruby_swig_sources) ifdef USE_LAYOUT swig_sources += ../swig/layout.i endif main_sources = \ $(shell grep '%include sbml' ../swig/libsbml.i | grep -v 'libsbml-version.h' | cut -f2 -d' ' \ | cut -f2- -d'/' | sed -e '/\//s/^/..\/..\//;/\//!s/^/..\/..\/sbml\//') ifdef USE_SWIG # If swig is enabled, always rebuild the swig wrapper files. swig-prereq: $(MAKE) -$(MAKEFLAGS) 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) -$(MAKEFLAGS) libsbml_wrap.cpp; \ fi else # not USE_LAYOUT swig-prereq: @if test -n "`grep SWIGTYPE_p_Layout libsbml_wrap.cpp`"; then \ $(MAKE) -$(MAKEFLAGS) swigfiles; \ else \ $(MAKE) -$(MAKEFLAGS) libsbml_wrap.cpp; \ fi endif # USE_LAYOUT endif # USE_SWIG # The next target is for forcing re-swigging. swigfiles: ifdef USE_SWIG $(SWIG) $(SWIGFLAGS) \ $(sort $(default_includes) $(INCLUDES)) \ -c++ -ruby -o libsbml_wrap.cpp libsbml.i 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: $(swig_sources) $(main_sources) $(MAKE) -$(MAKEFLAGS) swigfiles # ----------------------------------------------------------------------------- # Checking. # ----------------------------------------------------------------------------- check: $(libraries) @echo @echo @echo Running Tests in $(thisdir) @echo ----------------------------------------------------------------- $(call libsbmlrun, $(RUBY) -I./ test.rb) @echo ----------------------------------------------------------------- @echo # ----------------------------------------------------------------------------- # Installation. # ----------------------------------------------------------------------------- install: archdir=`$(RUBY) -rrbconfig -e 's = File::SEPARATOR; a = Config::CONFIG["archdir"].squeeze(s); b = Config::CONFIG["libdir"].squeeze(s); print a.sub(/^#{b}#{s}ruby/, "$(LIBDIR)#{s}ruby#{s}site_ruby")'`; \ for i in $(libraries); do \ $(MKINSTALLDIRS) $(DESTDIR)$$archdir; \ $(INSTALL_SH) $$i $(DESTDIR)$$archdir/$$i; \ done ; \ installcheck: uninstall: -archdir=`$(RUBY) -rrbconfig -e 's = File::SEPARATOR; a = Config::CONFIG["archdir"].squeeze(s); b = Config::CONFIG["libdir"].squeeze(s); print a.sub(/^#{b}#{s}ruby/, "$(LIBDIR)#{s}ruby#{s}site_ruby")'`; \ for i in $(libraries); do \ rm $(DESTDIR)$$archdir/$$i; \ 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. # -----------------------------------------------------------------------------