# define cc flag. The default is Intel icc if not specified.
ifdef cc
   ifeq ($(cc),icc)
         ccflags = -O3 -openmp 
   endif
   ifeq ($(cc),pgcc)
         ccflags = -O2 -mp 
   endif
else
         cc = icc
         ccflags = -O3 -openmp 
         $(info The default compiler is Intel icc ...)
endif


LDFLAGS=$(ccflags)

SRCS =  hello_c.c             \
	mapping_threads_c.c   \
	threadprivate_v0_c.c  \
	threadprivate_v1_c.c  \
	threadprivate_v2_c.c  \
	privatevar_c.c        \
	data_racing_c.c       \
	nested_loops_v0_c.c   \
	nested_loops_v1_c.c   \
	nested_loops_v2_c.c   \
	sections_c.c          \
	single_c.c            \
	atomic_c.c            \
	firstprivate_c.c


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

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 *~


%:%.c
	$(cc) $(ccflags) -o $@  $<

