# switches that control the behavior fo this makefile
# attention: no space after 1 / 0, else you will get link problems:
# the evaluation program htr-eval will only build with PARALLEL=0
PARALLEL=0
GRAPHICS=0

PT_MAKEHOME=/home/mwojtkow/P3Ttoolkit-1.19/make
PT_DEVELHOME=/home/mwojtkow/P3Ttoolkit-1.19/


# select the approriate paths for the PT stuff
# ISR workstation cluster:
#PT_DEVELHOME?=/share/devel

# zam003:
#PT_DEVELHOME?=$(HOME)/Kugel.Dir/devel_s

#-------------------------------------------------------------------------
# everything below this line should be automatic now:
#-------------------------------------------------------------------------

#PT_MAKEHOME ?= $(PT_DEVELHOME)/make

include $(PT_MAKEHOME)/gmk.platform
# a compiler bug in KCC 3.3d on the CRAY causes templates to not be 
# instantiated correctly. The bug is not triggered in the current code 
# version if we use vector<int> instead of vector<bool> in ModMaterial.H 
# and avoid binary conversion routines, default is to include the feature
BINARYCONV=1
ifeq ($(PT_HOSTTYPE),PT_CRAY_T3E) 
  BINARYCONV=0
endif

#switch compiler:
include $(PT_MAKEHOME)/gmk.gnu
#include $(PT_MAKEHOME)/gmk.opt
include $(PT_MAKEHOME)/gmk.debug
#include $(PT_MAKEHOME)/gmk.ansi
include $(PT_MAKEHOME)/gmk.mpi
ifeq ($(GRAPHICS),1)
 include $(PT_MAKEHOME)/gmk.ogl
 include $(PT_MAKEHOME)/gmk.x11
# you cannot compile with KCC with both pthread and noexceptions set, 
# use noexceptions for better performance and pthread for 
# better interactive graphics (windows update during computation)
# delete the XT_NO_THREADS below and add PTSThread.o to XTOBJECTS 
# if you go for threads
 include $(PT_MAKEHOME)/gmk.pthread
 ifneq ($(PT_CENV),PT_KAI)
   include $(PT_MAKEHOME)/gmk.noexceptions
 endif
else
 include $(PT_MAKEHOME)/gmk.noexceptions
endif

MY_DEFS = -I/home/mati/save/include -DXT_VERBOSITY=10 -DPT_VERBOSITY=100 \
	-DPT_SAFETY=10 -DNDEBUG -DPT_PARALLEL=$(PARALLEL) -DPTM_AVOID_BLITZ \
	-DMOD_CMAP_SORTED=0 -DPT_CONVERTING_BINARYIO=$(BINARYCONV) \
	-DMOD_JANSEN_PRESSURE -DMOD_TANGENTIAL_DAMPING=1 -DMOD_PERSISTENT_CONTACTS 


ifeq ($(GRAPHICS),1)
	MY_DEFS += -DPTM_VISUALIZE -DXT_NO_THREADS	
endif

# restriction to 2D:
#   -DMOD_SUPPRESS_Y_MOTION -DMOD_SUPPRESS_Z_MOTION
# no static friction: -DMOD_PERSISTENT_CONTACTS=0
# no critical damping with static fricton: -DMOD_TANGENTIAL_DAMPING=0
# no rotation:        -DMOD_ROTATION=0
# -DPTM_PARTCONTLC_VERBOSITY=10 -DPTM_PARPARTCONTLC_VERBOSITY=10 
# compute the 'pressure' from the forces exerted by the neighbors
# -DMOD_JANSEN_PRESSURE 

XT_OBJECTS = XTDisplay.o XTGLDev.o XTDevice.o  XTX11EvWin.o XT.o 
# PTSThread.o
PT_OBJECTS = PTC_Para.o PTC_Log.o PTM_Parallel.o PTS_CommBase.o PTS_ParStream.o PTBinaryIO.o PTSRandom.o
MOD_OBJECTS = ModWall.o ModGeometry.o ModMaterial.o ModControl.o ModIO.o IOFuncs.o ModEvaluate.o ModParticle.o 
#ModParticle.o

ifeq ($(GRAPHICS),0)
	XT_OBJECTS =
endif
ifeq ($(PARALLEL),1)
	PT_OBJECTS += PTS_MPIComm.o
else 
	PT_OBJECTS += PTS_SerComm.o
endif

# these are the object files necessary to compile and link your code
BINARY  = htr
OBJECTS	= $(MOD_OBJECTS) $(PT_OBJECTS) $(XT_OBJECTS)
MY_CLEAN = main.o main_eval.o htr htr-eval
MY_INCL = -I/usr/X11R6/include -I/home/mati/save/include
MY_LIBS = -L/usr/X11R6/lib
ifeq ($(PARALLEL),0)
 all: eval main
else 
 all: main
endif

main:	main.o $(OBJECTS)
	$(C++) -o $(BINARY) main.o $(OBJECTS) $(LINKC++) 

eval:	main_eval.o $(OBJECTS)
	$(C++) -o $(BINARY)-eval main_eval.o $(OBJECTS) $(LINKC++) 


include $(PT_MAKEHOME)/gmk.rules

