# define F90 flag. The default is ifort ifort if not specified.
ifdef F90
   ifeq ($(F90),ifort)
         F90FLAGS = -O3 -openmp 
   endif
   ifeq ($(F90),pgf90)
         F90FLAGS = -O2 -mp -mcmodel=medium
   endif
else
         F90 = ifort 
         F90FLAGS = -O3 -openmp 
         $(info The default compiler is Intel ifort ...)
endif


LDFLAGS=$(F90FLAGS)

SRCS =  hello_f.f90            \
	mapping_threads_f.f90  \
	threadprivate_v0_f.f90 \
	threadprivate_v1_f.f90 \
	threadprivate_v2_f.f90 \
	privatevar_f.f90       \
	data_racing_f.f90      \
	nested_loops_v0_f.f90  \
	nested_loops_v1_f.f90  \
	nested_loops_v2_f.f90  \
	sections_f.f90         \
	single_f.f90           \
	atomic_f.f90           \
	firstprivate_f.f90


OBJS =	$(SRCS:.f90=.o)
PROG =  $(SRCS:.f90=)

all: $(PROG)


clean:
	rm -f $(PROG) $(OBJS) *.mod *~

# clenaomod only remove *.o, *.mod, and *~ file. 
# Executable file is not removed.
cleanomod:
	rm -f $(OBJS) *.mod *~


%:%.f90
	$(F90) $(F90FLAGS) -o $@  $<

