# Copyright (C) 2006 International Business Machines and others.
# All Rights Reserved.
# This file is distributed under the Eclipse Public License.

# $Id: Makefile.in 1898 2013-04-09 18:06:04Z stefan $

##########################################################################
#    You can modify this example makefile to fit for your own program.   #
#    Usually, you only need to change the five CHANGEME entries below.   #
##########################################################################

# To compile other examples, either changed the following line, or
# add the argument DRIVER=problem_name to make
DRIVER = driver

# CHANGEME: This should be the name of your executable
EXE = $(DRIVER)@EXEEXT@

# CHANGEME: Here is the name of all object files corresponding to the source
#           code that you wrote in order to define the problem statement
OBJS =  $(DRIVER).@OBJEXT@ 

# extra object files that are required by some examples (we just link them into each one)
EXTRAOBJS = \
	CbcCompareUser.@OBJEXT@ \
	CbcSolver2.@OBJEXT@ \
	CbcSolver3.@OBJEXT@ \
	CbcSolverLongThin.@OBJEXT@ \
	ClpQuadInterface.@OBJEXT@ \
	CbcBranchFollow2.@OBJEXT@ \
	CbcBranchUser.@OBJEXT@ \
	CbcBranchLink.@OBJEXT@

# CHANGEME: Additional libraries
# e.g., for driver2, put -lOsiCbc here
ADDLIBS =

# CHANGEME: Additional flags for compilation (e.g., include flags)
ADDINCFLAGS =

# CHANGEME: Directory to the sources for the (example) problem definition
# files
SRCDIR = @srcdir@
VPATH = @srcdir@

##########################################################################
#  Usually, you don't have to change anything below.  Note that if you   #
#  change certain compiler options, you might have to recompile the      #
#  package.                                                              #
##########################################################################

COIN_HAS_PKGCONFIG = @COIN_HAS_PKGCONFIG_TRUE@TRUE
COIN_CXX_IS_CL = @COIN_CXX_IS_CL_TRUE@TRUE
COIN_HAS_SAMPLE = @COIN_HAS_SAMPLE_TRUE@TRUE
COIN_HAS_MIPLIB3 = @COIN_HAS_MIPLIB3_TRUE@TRUE

# C++ Compiler command
CXX = @CXX@

# C++ Compiler options
CXXFLAGS = @CXXFLAGS@

# C Compiler options
CFLAGS = @CFLAGS@

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

# Sample data directory
ifeq ($(COIN_HAS_SAMPLE), TRUE)
  ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
    CXXFLAGS += -DSAMPLEDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatasample`\"
      CFLAGS += -DSAMPLEDIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatasample`\"
  else
    CXXFLAGS += -DSAMPLEDIR=\"@SAMPLE_DATA_INSTALLED@\"
      CFLAGS += -DSAMPLEDIR=\"@SAMPLE_DATA_INSTALLED@\"
  endif
endif

# Miplib3 data directory
ifeq ($(COIN_HAS_MIPLIB3), TRUE)
  ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
    CXXFLAGS += -DMIPLIB3DIR=\"`PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --variable=datadir coindatamiplib3`\"
  else
    CXXFLAGS += -DMIPLIB3DIR=\"@MIPLIB3_DATA_INSTALLED@\"
  endif
endif

# Include directories (we use the CYGPATH_W variables to allow compilation with Windows compilers)
ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
  INCL = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --cflags cbc`
else
  INCL = @CBCLIB_CFLAGS_INSTALLED@
endif
INCL += -I@srcdir@ $(ADDINCFLAGS)

# Linker flags
ifeq ($(COIN_HAS_PKGCONFIG), TRUE)
  LIBS = `PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@ @PKG_CONFIG@ --libs cbc`
else
  ifeq ($(COIN_CXX_IS_CL), TRUE)
    LIBS = -link -libpath:`$(CYGPATH_W) @abs_lib_dir@` libCbcSolver.lib libCbc.lib libOsiCbc.lib @CBCLIB_LIBS_INSTALLED@
  else
    LIBS = -L@abs_lib_dir@ -lCbcSolver -lCbc -lOsiCbc @CBCLIB_LIBS_INSTALLED@
  endif
endif

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

# Here we list all possible generated objects or executables to delete them
CLEANFILES = $(EXTRAOBJS) \
	allCuts.@OBJEXT@ allCuts@EXEEXT@ \
	barrier.@OBJEXT@ barrier@EXEEXT@ \
	cbc_driverC_sos.@OBJEXT@ cbc_driverC_sos@EXEEXT@ \
	crew.@OBJEXT@ crew@EXEEXT@ \
	driver.@OBJEXT@ driver@EXEEXT@ \
	driver2.@OBJEXT@ driver2@EXEEXT@ \
	driver3.@OBJEXT@ driver3@EXEEXT@ \
	driver4.@OBJEXT@ driver4@EXEEXT@ \
	fast0507b.@OBJEXT@ fast0507b@EXEEXT@ \
	fast0507.@OBJEXT@ fast0507@EXEEXT@ \
	gear.@OBJEXT@ gear@EXEEXT@ \
	hotstart.@OBJEXT@ hotstart@EXEEXT@ \
	interrupt.@OBJEXT@ interrupt@EXEEXT@ \
	link.@OBJEXT@ link@EXEEXT@ \
	longthin.@OBJEXT@ longthin@EXEEXT@ \
	lotsize.@OBJEXT@ lotsize@EXEEXT@ \
	minimum.@OBJEXT@ minimum@EXEEXT@ \
	modify.@OBJEXT@ modify@EXEEXT@ \
	nway.@OBJEXT@ nway@EXEEXT@ \
	qmip.@OBJEXT@ qmip@EXEEXT@ \
	qmip2.@OBJEXT@ qmip2@EXEEXT@ \
	repeat.@OBJEXT@ repeat@EXEEXT@ \
	sample1.@OBJEXT@ sample1@EXEEXT@ \
	sample2.@OBJEXT@ sample2@EXEEXT@ \
	sample3.@OBJEXT@ sample3@EXEEXT@ \
	sample4.@OBJEXT@ sample4@EXEEXT@ \
	sample5.@OBJEXT@ sample5@EXEEXT@ \
	simpleBAB.@OBJEXT@ simpleBAB@EXEEXT@ \
	sos.@OBJEXT@ sos@EXEEXT@ \
	sudoku.@OBJEXT@ sudoku@EXEEXT@

all: $(EXE)

.SUFFIXES: .cpp .c .o .obj

$(EXE): $(OBJS) $(EXTRAOBJS)
	bla=;\
	for file in $(OBJS) $(EXTRAOBJS); do bla="$$bla `$(CYGPATH_W) $$file`"; done; \
	$(CXX) $(CXXLINKFLAGS) $(CXXFLAGS) -o $@ $$bla $(LIBS) $(ADDLIBS)

clean:
	rm -rf $(CLEANFILES) $(OBJS)

.cpp.o:
	$(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$<


.cpp.obj:
	$(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`

.c.o:
	$(CC) $(CFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$<


.c.obj:
	$(CC) $(CFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`
