BASEDIR = $(PWD)/../..

include $(BASEDIR)/include/Makefile_base

ALL_FTN_SRC    = $(shell ls *.ftn 2>/dev/null)
ALL_FTN90_SRC  = $(shell ls *.ftn90 2>/dev/null)
ALL_C_SRC      = $(shell ls *.c 2>/dev/null)

ALL_OBJ = $(patsubst %.ftn, %.o, $(ALL_FTN_SRC)) $(patsubst %.ftn90, %.o, $(ALL_FTN90_SRC))  $(patsubst %.c, %.o, $(ALL_C_SRC))

default: all

all: $(ALL_OBJ)

test: all
	cd tests ;  $(MAKE) all ; $(MAKE) test

clean: clean0
	cd tests ; $(MAKE) clean

#
# ALL dependencies ...
#

file_utils.o: file_utils.ftn90 msg.h
handle_error.o: handle_error.ftn90 rpn_comm.hf stop_mpi.h msg.h utils_call_back.h
msg.o: msg.ftn90 msg.h
utils4tests.o: utils4tests.ftn90 rpn_comm.hf rmnlib_basics.hf
utils_call_back.o: utils_call_back.c utils_call_back.h
stop_mpi.o: stop_mpi.ftn90 rpn_comm.hf stop_mpi.h msg.h
