#===========================================================================#
#                                                                           #
# This file is part of the SYMPHONY MILP Solver Framework.                  #
#                                                                           #
# SYMPHONY was jointly developed by Ted Ralphs (ted@lehigh.edu) and         #
# Laci Ladanyi (ladanyi@us.ibm.com).                                        #
#                                                                           #
# The author of this file is Menal Guzelsoy                                 #
# Modified by tkr July 6, 2010                                              #
#                                                                           #
# (c) Copyright 2006-2015 Lehigh University. All Rights Reserved.           #
#                                                                           #
# This software is licensed under the Eclipse Public License. Please see    #
# accompanying file for terms.                                              #
#                                                                           #
#===========================================================================#

# $Id: Makefile.in 726 2006-04-17 04:16:00Z andreasw $

# The following is necessary under cygwin, if native compilers are used
CYGPATH_W = @CYGPATH_W@

EXAMPLES = milp milp2 bicriteria sensitivity \
	warm_start1 warm_start2 warm_start3

##############################################################################
# If you wish to use SYMPHONY through the SYMPHONY OSI interface, 
# set USE_OSI_INTERFACE to TRUE below. This will have the examples 
# to call the OSI SYMPHONY interface routines. 
##############################################################################

USE_OSI_INTERFACE = FALSE

ifeq ($(USE_OSI_INTERFACE),TRUE)
EXAMPLES += milpOsi milpOsi2
endif

# Directory with Application files
SYMEXDIR = @SYMSRCDIR@/../Examples

# Additional compiler flags
ADDINCFLAGS =

##########################################################################
#  Usually, you don't have to change anything below.  Note that if you   #
#  change certain compiler options, you might have to recompile the      #
#  COIN package.                                                         #
##########################################################################
USE_CGL_CUTS = @USE_CGL_CUTS_TRUE@TRUE
CLP_LP_SOLVER = @CLP_LP_SOLVER_TRUE@TRUE
GLPK_LP_SOLVER = @GLPK_LP_SOLVER_TRUE@TRUE
CPLEX_LP_SOLVER = @CPLEX_LP_SOLVER_TRUE@TRUE
OSL_LP_SOLVER = @OSL_LP_SOLVER_TRUE@TRUE
SOPLEX_LP_SOLVER = @SOPLEX_LP_SOLVER_TRUE@TRUE
XPRESS_LP_SOLVER = @XPRESS_LP_SOLVER_TRUE@TRUE

COIN_HAS_PKGCONFIG = @COIN_HAS_PKGCONFIG_TRUE@TRUE
COIN_CXX_IS_CL = @COIN_CXX_IS_CL_TRUE@TRUE

VPATH = $(SYMEXDIR)

WHATTOMAKE = $(addsuffix @EXEEXT@, $(EXAMPLES))

# C++ Compiler command
CXX = @CXX@

# C++ Compiler options
CXXFLAGS = @CXXFLAGS@

# additional C++ Compiler options for linking
CXXLINKFLAGS = @RPATH_FLAGS@

# if USE_OSI_INTERFACE is TRUE, we use osi-sym to get compiler/linker flags from pkg-config, otherwise we use symphony
ifeq ($(USE_OSI_INTERFACE),TRUE)
  ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
    INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags osi-sym`
  else
    INCL = @SYMPHONYLIB_CFLAGS_INSTALLED@
  endif

  ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
    LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs osi-sym`
  else
    ifeq ($(COIN_CXX_IS_CL), TRUE)
      LIBS = -link -libpath:`$(CYGPATH_W) @abs_lib_dir@` libOsiSym.lib libSym.lib @SYMPHONYLIB_LIBS_INSTALLED@
    else
      LIBS = -L@abs_lib_dir@ -lOsiSym -lSym @SYMPHONYLIB_LIBS_INSTALLED@
    endif
  endif

  CXXFLAGS += -DUSE_OSI_INTERFACE

else
  ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
    INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags symphony`
  else
    INCL = @SYMPHONYLIB_CFLAGS_INSTALLED@
  endif

  ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
    LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs symphony`
  else
    ifeq ($(COIN_CXX_IS_CL), TRUE)
      LIBS = -link -libpath:`$(CYGPATH_W) @abs_lib_dir@` libSym.lib @SYMPHONYLIB_LIBS_INSTALLED@
    else
      LIBS = -L@abs_lib_dir@ -lSym @SYMPHONYLIB_LIBS_INSTALLED@
    endif
  endif
endif
INCL += $(ADDINCFLAGS)

all: $(WHATTOMAKE)

%@EXEEXT@: %.c
	bla=;\
	for file in $< ; do bla="$$bla `$(CYGPATH_W) $$file`"; done; \
	$(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) $(INCL) $$bla -o $@ $(LIBS)

clean:
	rm -rf $(WHATTOMAKE)
