.PHONY: all clean install

CC      = mpicc
CFLAGS  = -O2 -std=gnu99 -Wall -Wpointer-arith -fopenmp -I../../include -DOMNI_CPU_X86_64 -DOMNI_OS_LINUX -DNDEBUG 
FC      = mpif90
FCFLAGS = -O2 -fopenmp
AR      = ar cru
RANLIB  = ranlib
MKDIR_P = install -m 755 -d
INSTALL = install

SRCS = ompc_thread.c ompc_lock.c ompc_lib.c ompc_runtime.c timer.c ompf_runtime.c ompf_thread.c
HEADERS          = ompc_reduction.h ompclib.h timer.h
OMPCRTOBJ        = ompc_main.o
OMPCRTOBJ_SRC    = ompc_main.c
OMPFRTOBJ        = ompf_main.o
OMPFRTOBJ_SRC    = ompf_main.F90
DEFAULT_LIB_NAME = libompc.a
lib_LIBRARIES    = $(LIB_TARGET)
LIBDIR           = /usr/local/lib
INCDIR           = /usr/local/include
OMP_HEADER       = ../../include/omp.h

all:    $(OMPCRTOBJ) $(OMPFRTOBJ) doAllLib
include ./target.tmpl
$(OMPCRTOBJ): $(OMPCRTOBJ_SRC)
	$(CC) $(CFLAGS) -c $<

$(OMPFRTOBJ): $(OMPFRTOBJ_SRC)
	$(FC) $(FCFLAGS) -c $<

install: $(OMPCRTOBJ) $(OMPFRTOBJ) libompc_mutex_pthread.a $(OMP_HEADER)
	$(MKDIR_P) $(LIBDIR)
	$(INSTALL) $(OMPCRTOBJ) $(OMPFRTOBJ) libompc_mutex_pthread.a $(LIBDIR)
	$(INSTALL) $(OMP_HEADER) $(INCDIR)

clean:
	rm -f *.o $(LIB_TARGET) *._*_o

