msspec_python3/src/msspec/spec/fortran/Makefile

81 lines
2.7 KiB
Makefile

COMP:=gfortran
F2PY:=f2py3
COMP_OPTS:= -O2 -ffast-math
F2PY_OPTS:=
DEBUG:=0
includes := -I./memalloc/ -I./cluster_gen/ -I./common_sub -I./renormalization
includes += -I./phd_se_noso_nosp_nosym
includes += -I./eig/common -I./eig/new_mi -I./eig/new_pw
memalloc_src:=memalloc/dim_mod.f memalloc/modules.f memalloc/allocation.f
memalloc_obj:=$(patsubst %.f,%.o, $(memalloc_src))
cluster_gen_src:=$(wildcard cluster_gen/*.f)
cluster_gen_obj:=$(patsubst %.f,%.o, $(cluster_gen_src))
common_sub_src:=$(wildcard common_sub/*.f)
common_sub_obj:=$(patsubst %.f,%.o, $(common_sub_src))
renormalization_src:=$(wildcard renormalization/*.f)
renormalization_obj:=$(patsubst %.f,%.o, $(renormalization_src))
phd_se_noso_nosp_nosym_src:=$(filter-out phd_se_noso_nosp_nosym/main.f, $(wildcard phd_se_noso_nosp_nosym/*.f))
phd_se_noso_nosp_nosym_obj:=$(patsubst %.f,%.o, $(phd_se_noso_nosp_nosym_src))
eig_common_src:=$(wildcard eig/common/*.f)
eig_common_obj:=$(patsubst %.f,%.o, $(eig_common_src))
eig_mi_src:=$(filter-out eig/mi/main.f, $(wildcard eig/mi/*.f))
eig_mi_obj:=$(patsubst %.f,%.o, $(eig_mi_src))
eig_pw_src:=$(filter-out eig/pw/main.f, $(wildcard eig/pw/*.f))
eig_pw_obj:=$(patsubst %.f,%.o, $(eig_pw_src))
objects_src := $(memalloc_src) $(cluster_gen_src) $(common_sub_src)
objects_src += $(renormalization_src) $(phd_se_noso_nosp_nosym_src)
objects_src += $(eig_common_src) $(eig_mi_src) $(eig_pw_src)
objects:=$(patsubst %.f,%.o, $(objects_src))
EXE=prog
ifeq ($(DEBUG),1)
COMP_OPTS:=$(COMP_OPTS) -g -Wall -Wextra -Warray-temporaries -Wconversion -fbacktrace -ffree-line-length-0 -fcheck=all -ffpe-trap=zero,overflow,underflow -finit-real=nan
F2PY_OPTS:=$(F2PY_OPTS) --debug-capi --debug
endif
export COMP
export COMP_OPTS
.PHONY: clean
pybinding: phd_se_noso_nosp_nosym eig_mi eig_pw
phd_se_noso_nosp_nosym: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(phd_se_noso_nosp_nosym_obj)
@echo "building Python binding..."
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $@ phd_se_noso_nosp_nosym/main.f
# @cp $@.cpython*.so ../
eig_mi: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_mi_obj)
@echo "building Python binding..."
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $@ eig/mi/main.f
# @cp $@.cpython*.so ../
eig_pw: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_pw_obj)
@echo "building Python binding..."
@$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $@ eig/pw/main.f
# @cp $@.cpython*.so ../
%.o: %.f
@echo "compiling $@..."
@$(COMP) $(COMP_OPTS) -I./memalloc/ -fPIC -o $@ -c $^
clean:
@echo "cleaning..."
@rm -rf *.o *.mod
@rm -rf $(objects)