--- trunk/GNUmakefile 2014/02/05 17:51:07 78 +++ trunk/GNUmakefile 2014/02/28 17:52:47 79 @@ -13,17 +13,18 @@ VPATH := ${src_root} $(addprefix ${src_root}/, $(shell cat ${src_root}/directories)) common_sources := $(shell cat ${src_root}/common_sources) -src_no_main_ce0l_only := $(shell cat ${src_root}/src_no_main_ce0l_only) -src_no_main_gcm_only := $(shell cat ${src_root}/src_no_main_gcm_only) -src_no_main = ${src_no_main_ce0l_only} ${src_no_main_gcm_only} ${common_sources} +src_ce0l_only := $(shell cat ${src_root}/src_ce0l_only) +src_gcm_only := $(shell cat ${src_root}/src_gcm_only) +sources = ${src_ce0l_only} ${src_gcm_only} ${common_sources} -# 2. Objects +# 2. Objects and executable files -obj_ce0l := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_no_main_ce0l_only}))) +obj_ce0l := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_ce0l_only}))) -obj_gcm := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_no_main_gcm_only}))) +obj_gcm := $(addsuffix .o, $(sort $(basename ${common_sources} ${src_gcm_only}))) -objects := $(addsuffix .o, $(basename ${src_no_main})) +objects := $(addsuffix .o, $(basename ${sources})) +execut = ce0l gcm # 3. Compiler-dependent part @@ -38,29 +39,31 @@ %.o: %.f90 $(COMPILE.f90) $(OUTPUT_OPTION) $< -%: %.f90 - $(LINK.f) $^ $(LOADLIBES) $(LDLIBS) -o $@ - .DELETE_ON_ERROR: .PHONY: all clean clobber depend -all: ce0l gcm trace +all: ${execut} log + +${execut}: + $(FC) $(LDFLAGS) $^ $(LDLIBS) -o $@ + ce0l: ${obj_ce0l} gcm: ${obj_gcm} depend ${src_root}/depend.mk: - 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 -Wmissing -Wconfused $(addprefix -I, ${VPATH}) -nosrc $(addprefix -u , netcdf numer_rec_95 netcdf95 nr_util jumble) ${sources} >${src_root}/depend.mk -${src_root}/TAGS: ${src_no_main} ce0l.f90 gcm.f90 +${src_root}/TAGS: ${sources} ctags -e --language-force=fortran -f $@ $^ clean: - rm -f ce0l gcm ${objects} trace + rm -f ${execut} ${objects} log clobber: clean rm -f *.mod ${src_root}/depend.mk ${src_root}/TAGS -trace: - ${FC} ${version_flag} >$@ 2>&1 +log: + hostname >$@ + ${FC} ${version_flag} >>$@ 2>&1 echo -e "\nFC = ${FC}\n\nFFLAGS = ${FFLAGS}\n\nLDLIBS = ${LDLIBS}\n\nLDFLAGS = ${LDFLAGS}" >>$@ ifneq ($(MAKECMDGOALS), clobber)