##
## a basic makefile to build examples 
##

##
## The default type for a Zoltan global ID is "int".  This can be changed
## with compile-time flags like:
##
##   -DZOLTAN_ID_TYPE_LONG_LONG
##
## See src/include/zoltan_types.h for the valid id type macros.  If Zoltan was compiled
## with one of these flags, then these examples need to be compiled with the same flag.
##
ID_TYPE_FLAG=-DZOLTAN_ID_TYPE_LONG_LONG
##


## Location of zoltan library, also location of Zoltan_config.h if
## using the autoconf build

BLD=../../build/src

##
## Location of zoltan "src" directory (for header files)
##

SRC=../../src

# Location of zoltan header files

ZOLTAN_INCLUDE=-I$(SRC)/include

##
## For an autoconf build, the location of Zoltan_config.h
##
ZOLTAN_CONFIG_INCLUDE=-I$(BLD)/include

##
## Headers for zoltan utilities, not often used by applications
## Needed for use of Zoltan_Hash in simpleGRAPH.c
##

ZOLTAN_UTIL_INCLUDE=-I$(SRC)/zz  \
                    -I$(SRC)/par \
                    -I$(SRC)/order \
                    -I$(SRC)/tpls \
                    -I$(SRC)/lb \
                    -I$(SRC)/params \
                    -I$(SRC)/Utilities/shared

##
## If Zoltan was built with a third party library, provide the information required
## to link with that library.
##

SCOTCH=/home/lriesen/system/scotch_5.1.10a-32
PARMETIS=/home/lafisk/system/parmetis/ParMetis-3.1

TPL_LIB_DIR=-L$(PARMETIS) -L$(SCOTCH)/lib
TPL_INCLUDE=-I$(PARMETIS) -I$(SCOTCH)/include
TPL_LIBS=-lparmetis -lmetis -lptscotch -lscotch -lptscotcherr -lscotcherr

CC=mpicc

CFLAGS =$(ID_TYPE_FLAG)

EXAMPLE_NAMES= simpleBLOCK  simpleRCB simpleGRAPH simplePHG migrateGRAPH simpleHIER problemGRAPH

all:   $(EXAMPLE_NAMES)

%: %.c
	$(CC) $(CFLAGS) $(TPL_LIB_DIR)  \
        -I$(BLD)/include $(TPL_INCLUDE) $(ZOLTAN_INCLUDE) $(ZOLTAN_UTIL_INCLUDE) \
        -o $@ $< $(BLD)/libzoltan.a $(TPL_LIBS) -lm

clean:
	@rm -rf  $(EXAMPLE_NAMES)

