## @configure_input@
##
## @file    Makefile
## @brief   Builds the c++ example programs
## @author  Michael Hucka
##
## <!--------------------------------------------------------------------------
## This file is part of libSBML.  Please visit http://sbml.org for more
## information about SBML, and the latest version of libSBML.
##
## Copyright (C) 2013-2016 jointly by the following organizations:
##     1. California Institute of Technology, Pasadena, CA, USA
##     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
##     3. University of Heidelberg, Heidelberg, Germany
##
## Copyright (C) 2009-2013 jointly by the following organizations: 
##     1. California Institute of Technology, Pasadena, CA, USA
##     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
##  
## Copyright (C) 2006-2008 by the California Institute of Technology,
##     Pasadena, CA, USA 
##  
## Copyright (C) 2002-2005 jointly by the following organizations: 
##     1. California Institute of Technology, Pasadena, CA, USA
##     2. Japan Science and Technology Agency, Japan
## 
## This library is free software; you can redistribute it and/or modify it
## under the terms of the GNU Lesser General Public License as published by
## the Free Software Foundation.  A copy of the license agreement is provided
## in the file named "LICENSE.txt" included with this software distribution
## and also available online as http://sbml.org/software/libsbml/license.html
## ------------------------------------------------------------------------ -->

SRCDIR     = ../../src
INCLUDEDIR = ../../src

# The values of the following variables are obtained using the libSBML
# configuration program.

top_builddir = @top_builddir@
LIBTOOL    = @LIBTOOL@
CXX        = $(LIBTOOL) --mode=link @CXX@
CXXFLAGS   = @CXXFLAGS@ -Wall

LIBS       = -lsbml

# If you are presently reading Makefile and not Makefile.in, the following
# lists may have empty values.  This is okay; it's merely a result of how
# the values are obtained when Makefile is generated from Makefile.in
# by the ../../configure program.

CPPFLAGS  += @EXPAT_CPPFLAGS@ @XERCES_CPPFLAGS@ @LIBXML_CPPFLAGS@
LDFLAGS   += @EXPAT_LDFLAGS@ @XERCES_LDFLAGS@ @LIBXML_LDFLAGS@
LIBS      += @EXPAT_LIBS@ @XERCES_LIBS@ @LIBXML_LIBS@

CPPFLAGS  += -I$(INCLUDEDIR)
LDFLAGS   += -L$(SRCDIR)
LIBS      += -lstdc++ -lm


# The rest of this Makefile remains static regardless of the values
# assigned to the variables above.

programs   = convertSBML echoSBML printSBML readSBML translateMath \
	     validateSBML printMath printUnits createExampleSBML stripPackage

all: $(programs)

convertSBML: convertSBML.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

echoSBML: echoSBML.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

stripPackage: stripPackage.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

printSBML: printSBML.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

printUnits: printUnits.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

printMath: printMath.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

readSBML: readSBML.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

translateMath: translateMath.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

validateSBML: validateSBML.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

# The following are still somewhat experimental and are not built by
# default, but are provided for interested persons.

experimental_examples = addCustomValidator callExternalValidator \
               appendAnnotation printAnnotation printNotes unsetAnnotation \
               unsetNotes createExampleSBML addCVTerms addModelHistory \
			   addingEvidenceCodes_1 addingEvidenceCodes_2 printSupported \
			   printRegisteredPackages translateL3Math

experimental: $(experimental_examples)

addCVTerms: addCVTerms.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

addModelHistory: addModelHistory.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

addingEvidenceCodes_1: addingEvidenceCodes_1.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

addingEvidenceCodes_2: addingEvidenceCodes_2.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

printSupported: printSupported.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

addCustomValidator: addCustomValidator.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

callExternalValidator: callExternalValidator.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

appendAnnotation: appendAnnotation.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

printAnnotation: printAnnotation.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

printRegisteredPackages: printRegisteredPackages.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

printNotes: printNotes.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

unsetAnnotation: unsetAnnotation.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

unsetNotes: unsetNotes.cpp util.c
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

createExampleSBML: createExampleSBML.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

translateL3Math: translateL3Math.cpp
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

clean:
	/bin/rm -f *~ $(programs) $(patsubst %,%.exe,$(programs)) \
	              $(experimental_examples) $(patsubst %,%.exe,$(experimental_examples))

distclean: clean
	/bin/rm Makefile


# The following are generic 'make' targets that are not used in
# this simple examples directory.

check dist docs install install-docs uninstall \
mostlyclean maintainer-clean installcheck dvi pdf ps info html \
distcheck:
