/[lmdze]/trunk/GNUmakefile
ViewVC logotype

Diff of /trunk/GNUmakefile

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 78 by guez, Wed Feb 5 17:51:07 2014 UTC revision 82 by guez, Wed Mar 5 14:57:53 2014 UTC
# Line 2  Line 2 
2    
3  # This makefile builds LMDZE.  # This makefile builds LMDZE.
4    
 # Suffixes are:  
 # "f90" for free format, no preprocessing  
 # "f" for fixed format, no preprocessing  
   
5  # 1. Source files  # 1. Source files
6    
7  src_root = .  src_root = .
# Line 13  src_root = . Line 9  src_root = .
9  VPATH := ${src_root} $(addprefix ${src_root}/, $(shell cat ${src_root}/directories))  VPATH := ${src_root} $(addprefix ${src_root}/, $(shell cat ${src_root}/directories))
10    
11  common_sources := $(shell cat ${src_root}/common_sources)  common_sources := $(shell cat ${src_root}/common_sources)
12  src_no_main_ce0l_only := $(shell cat ${src_root}/src_no_main_ce0l_only)  src_ce0l_only := $(shell cat ${src_root}/src_ce0l_only)
13  src_no_main_gcm_only := $(shell cat ${src_root}/src_no_main_gcm_only)  src_gcm_only := $(shell cat ${src_root}/src_gcm_only)
14  src_no_main = ${src_no_main_ce0l_only} ${src_no_main_gcm_only} ${common_sources}  sources = ${src_ce0l_only} ${src_gcm_only} ${common_sources}
15    
16  # 2. Objects  # 2. Objects and executable files
17    
18  obj_ce0l := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_no_main_ce0l_only})))  obj_ce0l := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_ce0l_only})))
19    
20  obj_gcm := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_no_main_gcm_only})))  obj_gcm := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_gcm_only})))
21    
22  objects := $(addsuffix .o, $(basename ${src_no_main}))  objects := $(addsuffix .o, $(basename ${sources}))
23    execut = ce0l gcm
24    
25  # 3. Compiler-dependent part  # 3. Compiler-dependent part
26    
27  mode = debug  mode = debug
28  include Compilers/${FC}_${mode}.mk  include Compiler_options/${FC}_${mode}.mk
29    
30  # 4. Rules  # 4. Rules
31    
32  SHELL = bash  SHELL = bash
 COMPILE.f90 = $(FC) $(F90FLAGS) $(TARGET_ARCH) -c  
   
 %.o: %.f90  
         $(COMPILE.f90) $(OUTPUT_OPTION) $<  
   
 %: %.f90  
         $(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@  
   
33  .DELETE_ON_ERROR:  .DELETE_ON_ERROR:
34  .PHONY: all clean clobber depend  .PHONY: all clean clobber depend
35  all: ce0l gcm trace  all: ${execut} log
36    
37    ${execut}:
38            $(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@
39    
40  ce0l: ${obj_ce0l}  ce0l: ${obj_ce0l}
41  gcm: ${obj_gcm}  gcm: ${obj_gcm}
42    
43  depend ${src_root}/depend.mk:  depend ${src_root}/depend.mk:
44          makedepf90 -Wmissing -Wconfused $(addprefix -I, ${VPATH}) -nosrc $(addprefix -u , netcdf numer_rec_95 netcdf95 nr_util jumble) ${src_no_main} >${src_root}/depend.mk          makedepf90 -free -Wmissing -Wconfused $(addprefix -I, ${VPATH}) -nosrc $(addprefix -u , netcdf numer_rec_95 netcdf95 nr_util jumble) ${sources} >${src_root}/depend.mk
45    
46  ${src_root}/TAGS: ${src_no_main} ce0l.f90 gcm.f90  ${src_root}/TAGS: ${sources}
47          ctags -e --language-force=fortran -f $@ $^          ctags -e --language-force=fortran -f $@ $^
48    
49  clean:  clean:
50          rm -f ce0l gcm ${objects} trace          rm -f ${execut} ${objects} log
51    
52  clobber: clean  clobber: clean
53          rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS          rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS
54    
55  trace:  log:
56          ${FC} ${version_flag} >$@ 2>&1          hostname >$@
57            ${FC} ${version_flag} >>$@ 2>&1
58          echo -e "\nFC = ${FC}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}" >>$@          echo -e "\nFC = ${FC}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}" >>$@
59    
60  ifneq ($(MAKECMDGOALS), clobber)  ifneq ($(MAKECMDGOALS), clobber)

Legend:
Removed from v.78  
changed lines
  Added in v.82

  ViewVC Help
Powered by ViewVC 1.1.21