
# Set the TEST_ROOT properly, 
#TEST_ROOT=$(HOME)/usr/test

# This indirect "all" is because we include $(TAO_DIR)/bmake/tao_common later, 
# so the "all" in this file will be confused
all: myall

MATLAB_ROOT=$(HOME)/test

# Set Matlab directory information
MATLAB_INCL_DIR = -I$(MATLAB)/include
MATLAB_LIB_DIR = -L$(MATLAB)/bin/glnx86

PETSC_INCL_DIR = -I$(PETSC_DIR)/include -I$(PETSC_DIR)/bmake/$(PETSC_ARCH) -I$(PETSC_DIR)/include/mpiuni
TAO_INCL_DIR = -I$(TAO_DIR) -I$(TAO_DIR)/include

LIBS = -lmatlb -lmex -lmmfile -lmwhg -lmwservices -lmwsglm -lmwsgl -lmx -lut
LDLIBS = -Wl $(MATLAB_LIB_DIR) $(LIBS)

CXX = g++
LDFLAGS = -g -O
CFLAGS = -g -O


include $(TAO_DIR)/bmake/tao_common


myall: loo.o common.o tao_chkopts
	-$(CLINKER) -O3 -o loo loo.o common.o $(LDLIBS) $(TAO_LIB) $(PETSC_SNES_LIB)

loo.o: loo.cpp common.h common.cpp
	$(CXX) -c -Wall $(PETSC_INCL_DIR) $(TAO_INCL_DIR) $(MATLAB_INCL_DIR) $(CFLAGS) -D__SDIR__="" loo.cpp
	
common.o: common.h common.cpp
	$(CXX) -c -Wall -g3 $(PETSC_INCL_DIR) $(TAO_DIR) $(CFLAGS) -D__SDIR__="" common.cpp
	
.PHONY: clean	
myclean:
	rm -f *.o loo
