# This is the makefile for testing the mesa net 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) -lnet
LOAD_OTHER = -L$(MESA_LIB_DIR) -leos -lscreen -lrates -lreaclib -lweak -lecapture -lchem $(LOAD_MESA_NUMERICS)

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

# STEP 3: build

TEST_STD_OBJS = test_net_support.o test_burn.o test_burn_const_P.o mod_test_net.o
TEST = tester
TEST_OBJS = $(TEST_STD_OBJS) test_net.o
TESTQ = test_quietly
TESTQ_OBJS = $(TEST_STD_OBJS) test_net_quietly.o

PLOT = plotter
PLOT_OBJS = test_net_support.o test_burn.o plot_net.o

SAMPLE = sample
SAMPLE_OBJS = sample_net.o

ONE_ZONE_OBJS = test_net_support.o one_zone_burn.o
ONE_ZONE = burn

all : $(TEST) $(TESTQ) $(PLOT) $(SAMPLE) $(ONE_ZONE)

DEBUG_FLAGS = -g

$(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)

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

$(ONE_ZONE) : $(ONE_ZONE_OBJS)
	$(LOADER) $(FCopenmp) -o $(TEST_DIR)/$(ONE_ZONE) $(ONE_ZONE_OBJS) $(LOAD_LOCAL) $(LOAD_OTHER)

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

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

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

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

clean:
	-@rm -f *.o *.mod $(TEST_DIR)/$(TEST) $(TEST_DIR)/$(TESTQ) \
	$(TEST_DIR)/$(PLOT) $(TEST_DIR)/$(SAMPLE) $(TEST_DIR)/$(ONE_ZONE) 
