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

# $Id$

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

# CHANGEME: This should be the name of your executable
EXE = mcf

# 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 = 	Member/MCF3.o \
	Member/MCF3_var.o \
	Member/MCF3_data.o \
	TM/MCF3_tm.o \
	LP/MCF3_lp.o

# CHANGEME: Additional include directories for compilation. Note that no
# include directory needs to be listed here for headers from COIN.
USER_INCDIRS = include $(CPLEX_H) /usr/lib/openmpi/include

##########################################################################
#  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.                                                         #
##########################################################################

# C++ Compiler command
CXX = mpiCC

# C++ Compiler options
CXXFLAGS = -g -O2 -pipe -Wall

# additional C++ Compiler options for linking
CXXLINKFLAGS =  -Wl,--rpath -Wl,/usr/lib

# Directory with COIN header files
COININCDIR = /usr/include/coin

# Directory with COIN libraries
COINLIBDIR = /usr/lib

# Libraries necessary to link with Clp
LIBS = \
	-L$(COINLIBDIR) \
	-lBcp \
	-lOsiClp \
	-lOsi \
	-lClp \
	-lCoinUtils \
	`cat /cgl_addlibs.txt` \
	`cat /osi_addlibs.txt` \
	`cat /clp_addlibs.txt` \
	`cat /coinutils_addlibs.txt`

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

# Necessary Include dirs (we use the CYGPATH_W variables to allow
# compilation with Windows compilers)
INCL = `for i in $(USER_INCDIRS) $(COININCDIR); do $(CYGPATH_W) $$i | sed -e 's/^/-I/'; done`

all: $(EXE)

.SUFFIXES: .cpp .c .o .obj

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

clean:
	rm -rf $(EXE) $(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`
