From d5fc940fc2062a320c924c5ea132209db3dac6af Mon Sep 17 00:00:00 2001 From: kamischi <karl-michael.schindler@web.de> Date: Fri, 20 Jan 2023 13:44:09 +0100 Subject: [PATCH] Makefile: Update, fix & cleanup --- source/f90/fcat-analysis/Makefile | 88 ++++++++----------------------- 1 file changed, 23 insertions(+), 65 deletions(-) diff --git a/source/f90/fcat-analysis/Makefile b/source/f90/fcat-analysis/Makefile index a519b00..a39cfaa 100644 --- a/source/f90/fcat-analysis/Makefile +++ b/source/f90/fcat-analysis/Makefile @@ -1,4 +1,4 @@ -.SUFFIXES: .c .f .f90 .F90 .for .FOR .ftn .FTN .o +.SUFFIXES: .f90 .F90 .o # the fortran compiler FC = gfortran @@ -6,82 +6,40 @@ FC = gfortran # the options for the fortran compiler # FFLAGS = -fbounds-check # FFLAGS = -O3 -ff2c -gw -FFLAGS = -g -gdwarf-2 -fbounds-check -fcheck=all -fdiagnostics-color=auto +FFLAGS = -g -gdwarf-2 -fbounds-check -fcheck=all +# gfortran version 4.8 does not know -fdiagnostics-color +# safeguard for major version >= 5 +GFORTAN_VERSION_GT_5 := $(shell echo `gcc -dumpversion | cut -f1 -d. ` \>= 5 | bc) +ifeq "$(GFORTAN_VERSION_GT_5)" "1" + FFLAGS += -fdiagnostics-color=auto +endif # fcat tool FCAT = fcat -# Stuff for the python modules -# Python3 and its numpy must be installed. -PYTHON3 = python3 +boson_all-fcat.f90: boson_all.f90 + $(FCAT) -count boson_all.f90 > boson_all-fcat.f90 +bosonf90: boson_all-fcat.f90 + $(FC) $(FFLAGS) -o bosonf90 boson_all-fcat.f90 -# the implicit rule for compiling for files -# %.o: %.for ; $(FC) $(FFLAGS) -c -o $@ $< -#%-fcat.f90: %.f90 ; fcat -count %.f90 > %-fcat.f90 -%.o: %-fcat.f90 ; $(FC) $(FFLAGS) -c $< -%_mod.mod: %.f90 ; $(FC) $(FFLAGS) -c $< +eels_all-fcat.f90: eels_all.f90 + $(FCAT) -count eels_all.f90 > eels_all-fcat.f90 +eelsf90: eels_all-fcat.f90 + $(FC) $(FFLAGS) -o eelsf90 eels_all-fcat.f90 -all: boson eels eels-boson pylibs - -bosonmods = sicot_mod.mod sintr_mod.mod rcffi_mod.mod -doboson-fcat.f90: doboson.f90 - $(FCAT) -count doboson.f90 > doboson-fcat.f90 -doboson.o: doboson-fcat.f90 $(bosonmods) - -sicot_mod.mod: sintr_mod.mod - -bosonsubs = doboson.o respon.o sicot.o sintr.o rcffi.o o1.o o2.o -boson-fcat.f90: boson.f90 - $(FCAT) -count boson.f90 > boson-fcat.f90 -boson: boson-fcat.f90 change_working_dir.o $(bosonsubs) $(bosonmods) - $(FC) $(FFLAGS) -o bosonf90 boson-fcat.f90 change_working_dir.o $(bosonsubs) - -eelsmods = quanc8_mod.mod queels_mod.mod seteps_mod.mod -doeels-fcat.f90: doeels.f90 - $(FCAT) -count doeels.f90 > doeels-fcat.f90 -doeels.o: doeels-fcat.f90 $(eelsmods) - -queels_mod.mod: quanc8_mod.mod fint1_mod.mod fint2_mod.mod fint3_mod.mod -quanc8_mod.mod: fun_mod.mod -fint1_mod.mod: surlos_mod.mod -fint2_mod.mod: surlos_mod.mod -fint3_mod.mod: surlos_mod.mod - -eelssubs = doeels.o usurlo.o quanc8.o fun.o queels.o fint1.o fint2.o fint3.o surlos.o seteps.o phint.o qrat.o -eels-fcat.f90: eels.f90 - $(FCAT) -count eels.f90 > eels-fcat.f90 -eels: eels-fcat.f90 change_working_dir.o $(eelssubs) $(eelsmods) - $(FC) $(FFLAGS) -o eelsf90 eels-fcat.f90 change_working_dir.o $(eelssubs) - -eels-boson: eels-boson.f90 change_working_dir.o $(eelssubs) $(eelsmods) $(bosonsubs) $(bosonmods) - $(FC) $(FFLAGS) -o eels-boson eels-boson.f90 change_working_dir.o $(eelssubs) $(bosonsubs) - -pylibs: doeels-py doboson-py - -doeels-py: doeels.f90 quanc8.f90 surlos.f90 fint1.f90 fint2.f90 fint3.f90 queels.f90 phint.f90 qrat.f90 usurlo.f90 - $(PYTHON3) -m numpy.f2py -c seteps.f90 doeels.f90 quanc8.f90 surlos.f90 fint1.f90 fint2.f90 fint3.f90 queels.f90 phint.f90 qrat.f90 usurlo.f90 -m doeels - -doboson-py: doboson.f90 sicot.f90 sintr.f90 rcffi.f90 respon.f90 o1.f90 o2.f90 - $(PYTHON3) -m numpy.f2py -c o1.f90 o2.f90 sintr.f90 rcffi.f90 respon.f90 sicot.f90 doboson.f90 -m doboson - -fcat: eelsf90 bosonf90 +all: eelsf90 bosonf90 ./eelsf90 > eelsf90_fcat_output - fcat -count eels.f90 eelsf90_fcat_output -# fcat -report eels.f90 eelsf90_fcat_output + fcat -count eels_all.f90 eelsf90_fcat_output > eels_all.f90.fcat-analysis.txt ./bosonf90 > bosonf90_fcat_output - fcat -count boson.f90 bosonf90_fcat_output - fcat -count doboson.f90 bosonf90_fcat_output -# fcat -report boson.f90 bosonf90_fcat_output + fcat -count boson_all.f90 bosonf90_fcat_output > boson_all.f90.fcat-analysis.txt clean: - rm -f *.o rm -rf *.dSYM - rm -rf *.mod - rm -rf *.so - rm -rf *-fcat.* + rm -rf *mod.mod + rm -rf *_all-fcat.f90 rm -f bosonf90 bosonf90.exe rm -f eelsf90 eelsf90.exe - rm -f eels-boson eels-boson.exe + rm -rf *_all.f90.fcat-analysis.txt -.PHONY: all clean pylibs fcat +.PHONY: all clean -- GitLab