# This is the makefile for testing the mesa interp_2d library

MESA_DIR = ../../..

#################################################################

# STEP 1: get the standard compiler setup

include $(MESA_DIR)/utils/makefile_header

ifeq ($(INTERP_2D_OFFLOAD),YES)
CC += -Doffload
FC += -Doffload
endif

#################################################################

# STEP 2: info about the libraries

LOCAL_INCLUDES = -I$(LOCAL_LIB_DIR)
LOAD_LOCAL = -L$(LOCAL_LIB_DIR) -linterp_2d
LOAD_OTHER = -L$(MESA_LIB_DIR) -lnum -linterp_1d $(LOAD_MATRIX)

#################################################################

# STEP 3: build

TEST = tester
TEST_OBJS = \
   test_renka790_sg.o test_renka790_db.o \
   test_akima_sg.o test_akima_db.o \
   interp_2d_support.o test_interp_2d.o

PLOT = plotter
PLOT_OBJS = interp_2d_support.o plot_interp_2d.o

all : $(TEST) $(PLOT)

$(TEST) : $(TEST_OBJS)
	$(LOADER) $(FCopenmp) -o $(TEST_DIR)/$(TEST) $(TEST_OBJS) $(LOAD_LOCAL) $(LOAD_OTHER)

$(PLOT) : $(PLOT_OBJS)
	$(LOADER) $(FCopenmp) -o $(TEST_DIR)/$(PLOT) $(PLOT_OBJS) $(LOAD_LOCAL) $(LOAD_OTHER)
	
#################################################################

%.o: $(TEST_SRC_DIR)/%.f
	$(TEST_COMPILE) $(FCfixed) $<

clean:
	-@rm -f *.o *.mod $(TEST_DIR)/$(TEST)
