# This is the makefile for testing the mesa atm library

MESA_DIR = ../../..

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

# STEP 1: get the standard compiler setup

include $(MESA_DIR)/utils/makefile_header

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

# STEP 2: info about the libraries

LOAD_LOCAL = -L$(LOCAL_LIB_DIR) -latm
LOAD_OTHER = -L$(MESA_LIB_DIR) -lmlt $(LOAD_MESA_MICRO)

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

# STEP 3: build

TEST = tester
TEST_OBJS = test_atm_support.o test_atm.o

PLOT = plotter
PLOT_OBJS = test_atm_support.o plot_atm.o

TEST_QUIETLY = test_quietly
TEST_QUIETLY_OBJS = test_atm_support.o test_atm_quietly.o

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

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

all : $(TEST) $(TEST_QUIETLY) $(PLOT)

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

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

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