New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Makefile in utils/tools_AGRIF_CMEMS_2020/NESTING_AGRIF – NEMO

source: utils/tools_AGRIF_CMEMS_2020/NESTING_AGRIF/Makefile @ 10086

Last change on this file since 10086 was 10086, checked in by rblod, 5 years ago

Compilation of NESTING_AGRIF, a good old makefile

  • Property svn:executable set to *
File size: 4.5 KB
Line 
1SHELL = /bin/bash
2MPI = NO
3
4include make.inc
5
6PROGS = create_coordinate
7SFMAKEDEPEND := ./sfmakedepend
8DIR_LIB=lib
9DIR_FILES=src
10DIR_PPSRC=NEMOFILES
11DIR_PPSRC_2=ppsrc
12DIR_DOC=doc
13DIR_OBJS=obj
14DIR_LIB=lib
15
16FILENAMES =$(notdir $(basename $(wildcard src/*.F90))) $(notdir $(basename $(wildcard src/*.F))) $(notdir $(basename $(wildcard src/*.c))) $(notdir $(basename $(wildcard src/*.f))) $(notdir $(basename $(wildcard src/*.f90)))
17FILES=src/*
18OBJS=$(addsuffix .o,$(addprefix $(DIR_OBJS)/,$(FILENAMES)))
19PROG=create_coordinate
20
21all: depend conv prepagrif AGRIF_LIB $(OBJS) $(PROGS)
22      @echo
23      @echo ===================================================
24      @echo   Nesting is ok
25      @echo ===================================================
26      @echo
27
28
29create_coordinate: $(DIR_LIB)/libnesting.a $(DIR_PPSRC)/create_coordinate.f90
30      $(FC) $(LINKFLAGS) $(FFLAGS) -o create_coordinate $(DIR_PPSRC_2)/create_coordinate.f90 $(DIR_LIB)/libnesting.a $(LIBS) -I$(DIR_OBJS) $(FFLAGS_SPEC) -I../../ext/AGRIF
31
32prepagrif:
33      @echo
34      @echo ===================================================
35      @echo   Create working directories for AGRIF ...
36      @echo ===================================================
37      mkdir -p obj
38      mkdir -p $(DIR_PPSRC_2)
39      mkdir -p $(DIR_LIB)
40      mkdir -p $(DIR_OBJS)
41      mkdir -p $(DIR_PPSRC)
42      mkdir -p $(DIR_PPSRC)/AGRIF_MODELFILES
43      mkdir -p $(DIR_PPSRC)/AGRIF_INC
44      \cp ../../ext/AGRIF/LIB/conv $(DIR_PPSRC)
45      \cp ../../ext/AGRIF/agrif_oce.in $(DIR_PPSRC)
46      @echo
47
48conv:
49      gmake -C ../../ext/AGRIF/LIB
50
51AGRIF_LIB: 
52      gmake -C ../../ext/AGRIF FC=$(FC) CPP=$(CPP) FFLAGS="$(FFLAGS)"
53
54$(DIR_LIB)/libnesting.a: $(OBJS)
55      @echo
56      @echo ===================================================
57      @echo   Compile Nesting library...
58      @echo ===================================================
59      $(AR) -r $@ $(OBJS)
60      ranlib $@
61      @echo
62
63
64
65$(DIR_OBJS)/%.o: $(DIR_FILES)/%.F90 Makefile  MODEL.CPP
66      $(CPP) -include MODEL.CPP $(CPPFLAGS) $(DIR_FILES)/$(*F).F90 > $(DIR_PPSRC)/$(*F).f90
67         @(cd NEMOFILES ; ./conv ./agrif_oce.in -rm \
68      -comdirin ./ -comdirout AGRIF_MODELFILES/. -convfile $(*F).f90)
69      $(CPP) -I$(DIR_PPSRC)/AGRIF_INC -include MODEL.CPP $(CPPFLAGS)  $(DIR_PPSRC)/AGRIF_MODELFILES/$(*F).f90 >$(DIR_PPSRC_2)/$(*F).f90   
70      $(FC) $(FFLAGS) -c $(DIR_PPSRC_2)/$(*F).f90 -o $(DIR_OBJS)/$(*F).o -I../../ext/AGRIF -I$(DIR_OBJS)  $(FFLAGS_SPEC) 
71
72$(DIR_OBJS)/%.o: $(DIR_FILES)/%.f90 Makefile MODEL.CPP
73      $(CPP) -include MODEL.CPP $(CPPFLAGS) $(DIR_FILES)/$(*F).f90 > $(DIR_PPSRC)/$(*F).f90
74         @(cd NEMOFILES ; ./conv agrif_oce.in -rm \
75      -comdirin ./ -comdirout AGRIF_MODELFILES/. -convfile $(*F).f90)
76      $(CPP) -I$(DIR_PPSRC)/AGRIF_INC -include MODEL.CPP $(CPPFLAGS)  $(DIR_PPSRC)/AGRIF_MODELFILES/$(*F).f90 >$(DIR_PPSRC_2)/$(*F).f90   
77      $(FC) $(FFLAGS) -c $(DIR_PPSRC_2)/$(*F).f90 -o $(DIR_OBJS)/$(*F).o -I../../ext/AGRIF -I$(DIR_OBJS)  $(FFLAGS_SPEC) 
78
79#$(DIR_OBJS)/%.o: $(DIR_FILES)/%.F Makefile MODEL.CPP
80#     $(CPP) -include MODEL.CPP $(CPPFLAGS) $(DIR_FILES)/$(*F).F > $(DIR_PPSRC)/$(*F).f
81#     $(FC) $(FFLAGS) $(F77FLG) -c $(DIR_PPSRC)/$(*F).f -o $(DIR_OBJS)/$(*F).o
82
83#$(DIR_OBJS)/%.o: $(DIR_FILES)/%.f90 Makefile MODEL.CPP
84#     $(FC) $(FFLAGS) -c $(DIR_PPSRC)/$(*F).f90 -o $(DIR_OBJS)/$(*F).o
85
86#$(DIR_OBJS)/par_oce.o: $(DIR_FILES)/par_oce.f90
87#     echo $(OBJS) $(DIR_FILES)/
88
89#$(DIR_OBJS)/%.o: $(DIR_FILES)/%.c Makefile MODEL.CPP
90#  $(CC) -c $(CFLAGS) -c $(DIR_FILES)/$(*F).c -o $(DIR_OBJS)/$(*F).o
91
92#--------------------------------------------------------------------------
93#  Target to create dependeanies.
94#--------------------------------------------------------------------------
95
96MakeDepend: $(DIR_FILES)
97      $(SFMAKEDEPEND) --silent --fext=f90 --fext=f --fext=F90 --fext=F --fext=c --file=- --moddir=$(DIR_OBJS) --objdir=$(DIR_OBJS)  $(FILES) > MakeDepend
98
99depend: $(DIR_FILES)
100      @echo
101      @echo ===================================================
102      @echo   Create dependancies for Nesting ...
103      @echo ===================================================
104      $(SFMAKEDEPEND) --fext=f90 --fext=f  --silent --fext=F90 --fext=F --fext=c --file=- --moddir=$(DIR_OBJS) --objdir=$(DIR_OBJS)  $(FILES) > MakeDepend
105
106#ifneq "$(MAKECMDGOALS)" "clean"
107-include ./MakeDepend
108#endif
109
110#--------------------------------------------------------------------------
111#  Target to clean
112#--------------------------------------------------------------------------
113
114clean:
115      @echo
116      @echo ===================================================
117      @echo   Clean ...
118      @echo ===================================================
119      $(RM) -rf $(DIR_PPSRC) $(DIR_PPSRC_2) $(DIR_LIB) $(DIR_OBJS) $(PROGS) 
120   
121# DO NOT DELETE THIS LINE - used by make depend
Note: See TracBrowser for help on using the repository browser.