#----------------------------------------------------------------------- # Makefile for the Wind-Speed Probability Test suite # # Revision History: # Date Programmer Description # ---- ---------- ----------- # 2019-12-03 A. Brammer, CIRA Iniital development of test-suite #----------------------------------------------------------------------- # -------------------- # Define default shell # -------------------- SHELL = /bin/sh #------------ # Directories #------------ SORC_DIR=../sorc/prob_single_storm.fd # ------------------------------ # Source/Object/Executable files # ------------------------------ SRCM = run_test_driver.f90 OBJM = run_test_driver.o INCM = SRCS = test_gdland.f90 test_common_libs.f90 test_windspeed_dates.f90 test_splsubs.f90 fruit.f90 ${SORC_DIR}/splsubs.f90 ${SORC_DIR}/mc_prob.f90 OBJS = test_gdland.o test_common_libs.o test_windspeed_dates.o test_splsubs.o fruit.o splsubs.o mc_prob.o CMD = run_test_driver all: ${CMD} # ------------------------- # Compiler / linker / flags # ------------------------- COMP=intel # COMP=cray # COMP=pgi # COMP=gnu ifeq ($(COMP),intel) FC = ifort FFLAGS = -g -align all -static-intel -w LDFLAGS = else ifeq ($(COMP),cray) FC = ftn FFLAGS = -h noomp LDFLAGS = else ifeq ($(COMP),pgi) FC = pgf90 FFLAGS = -m32 -nomp -O4 -fastsse -Mipa=fast,inline -Bstatic_pgi -w LDFLAGS = else FC = gfortran FFLAGS = -m64 -Ofast -mavx -funroll-loops -w # FFLAGS = -O0 -g -fbacktrace -ffpe-trap=invalid,zero,overflow,underflow -Wall -Wextra -pedantic LDFLAGS = endif coverage: override FFLAGS := $(FFLAGS) --coverage # ---------------- # Build executable # ---------------- $(CMD): $(SRCM) $(OBJS) $(FC) $(FFLAGS) $(LDFLAGS) $(SRCM) $(OBJS) $(LIBS) -o $(CMD) # -------- # run test suite and coverage generation # -------- .PHONY: coverage coverage: run lcov -b . -c -d . -o coverage.wtest.base lcov -r coverage.wtest.base '*tests/*' -o coverage.wtest.notest genhtml -o ./html/ coverage.wtest.notest # -------- # Clean up # -------- .PHONY: clean clean: -rm -f $(OBJM) $(OBJS) *.o *.mod *.gc* coverage* $(CMD) html # keep seperate so variable can't be over ridden and blitz everything -rm -rf html # ------------ # Dependencies # ------------ test_windspeed_dates.o: test_windspeed_dates.f90 mc_prob.o $(FC) -c $(FFLAGS) test_windspeed_dates.f90 test_splsubs.o: fruit.o test_splsubs.f90 splsubs.o $(FC) -c $(FFLAGS) test_splsubs.f90 test_common_libs.o: fruit.o mc_prob.o $(FC) -c $(FFLAGS) test_common_libs.f90 test_gdland.o: fruit.o mc_prob.o $(FC) -c $(FFLAGS) $^ test_gdland.f90 fruit.o: fruit.f90 $(FC) -c $(FFLAGS) $^ mc_prob.o: $(FC) -c $(FFLAGS) ${SORC_DIR}/mc_prob.f90 splsubs.o: ${SORC_DIR}/splsubs.f90 $(FC) -c $(FFLAGS) $^