# This is the makefile for testing the mesa ionization package 

MESA_DIR = ../../..

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

# STEP 1: set up the standard info

include $(MESA_DIR)/utils/makefile_header

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

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

# STEP 2: info about the libraries

LOAD_LOCAL = -L$(LOCAL_LIB_DIR) -lionization
LOAD_OTHER = -L$(MESA_LIB_DIR) $(LOAD_MESA_MICRO)

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

# STEP 3: build the test program

TEST_OBJS = test_ionization_support.o test_ionization.o
TEST = tester

TESTQ_OBJS = test_ionization_support.o test_ionization_quitely.o
TESTQ = test_quietly

all : $(TEST) $(TESTQ)

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

$(TESTQ) : $(TESTQ_OBJS)
	$(LOADER) $(FCopenmp) -o $(TEST_DIR)/$(TESTQ) $(TESTQ_OBJS) $(LOAD_LOCAL) $(LOAD_OTHER)
	
#################################################################

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

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