#= Makefile for dcpam/execsrc/all-in
#
# Authors::   Yasuhiro MORIKAWA, Shin-ichi Takehiro
# Version::   $Id: Makefile,v 1.10 2025/09/18 10:00:00 takepiro Exp $
# Tag Name::  $Name:  $
# Copyright:: Copyright (C) GFD Dennou Club, 2004-2025. All rights reserved.
# License::   See COPYRIGHT[link:../../COPYRIGHT]
#
######################################################################
#
#== Settings

DIRDEPTH=../..
INCLUDEFILE = $(DIRDEPTH)/Config.mk
include $(INCLUDEFILE)

TARGETS = dcpam_main dcpam_init_data dcpam_init_data_surface
TARGETS_ZONAL	= $(patsubst %, %_zonal, $(TARGETS))
TARGETS_MPI	= $(patsubst %, %_mpi, $(TARGETS))

# End Settings
######################################################################

######################################################################
#== Rules

all: serial zonal mpi

include $(DIRDEPTH)/rules.make

include depend

serial: $(TARGETS)

zonal: $(TARGETS_ZONAL)

mpi: $(TARGETS_MPI)

clean.local:
	-@$(RM) *.o *.mod *~ *.bak

clean.all: clean.local
	-@$(RM) $(TARGETS) $(TARGETS_ZONAL) $(TARGETS_MPI) *.nc

%o: %.f90
	$(BINDIR)/dcpamfrt -c $< -o $@

%.o: %.F90
	$(BINDIR)/dcpamfrt -c $< -o $@

%: %.f90
	$(BINDIR)/dcpamfrt $(LIBSRCS) $< -o $@

%: %.o
	$(BINDIR)/dcpamfrt $(LIBSRCS) $< -o $@

%_zonal: %.f90
	$(BINDIR)/dcpamfrt --zonal $(LIBSRCS) $< -o $@

%_mpi: %.f90
	$(BINDIR)/dcpamfrt --mpi $(LIBSRCS) $< -o $@
