Revert back to GNU Make for building.
epsi-builds/msspec_python3/pipeline/head This commit looks good
Details
epsi-builds/msspec_python3/pipeline/head This commit looks good
Details
Makefiles are easier to maintain, I eventually prefer using GNU Make instead of scons. SConstruct files will be removed when makefiles will be ready in a future commit.
This commit is contained in:
parent
2dec004b0d
commit
13593b8870
|
@ -0,0 +1,83 @@
|
||||||
|
MAKESELF:=makeself
|
||||||
|
VERSION:=$(shell git describe|sed 's/-\([[:digit:]]\+\)-.*/\.post\1/')
|
||||||
|
SETUPFILE:=MsSpec-$(VERSION).setup
|
||||||
|
|
||||||
|
|
||||||
|
VERBOSE:=0
|
||||||
|
ifeq ($(VERBOSE),0)
|
||||||
|
SUPPRESS_OUPUT:=1>/dev/null 2>/dev/null
|
||||||
|
MAKEFLAGS += --no-print-directory
|
||||||
|
else
|
||||||
|
SUPPRESS_OUPUT:=
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: clean version selfex venv doc
|
||||||
|
|
||||||
|
|
||||||
|
selfex: results
|
||||||
|
@echo "Creating the self-extractible setup program... "
|
||||||
|
# copy the src folder and purge it
|
||||||
|
@cp -r src src_
|
||||||
|
@+$(MAKE) -C ./src_ purge
|
||||||
|
# update the version
|
||||||
|
@echo "$(VERSION)" > ./src_/VERSION
|
||||||
|
# distribute the README.md file
|
||||||
|
@cp README.md ./src_/
|
||||||
|
# create the package folder
|
||||||
|
@mkdir -p package
|
||||||
|
# create the *.lsm file
|
||||||
|
@echo "Begin4" > msspec.lsm
|
||||||
|
@echo "Title: Python MsSpec" >> msspec.lsm
|
||||||
|
@echo "Version: $(VERSION)" >> msspec.lsm
|
||||||
|
@echo "Entered-date: `date +%Y-%m-%d`" >> msspec.lsm
|
||||||
|
@echo "Description: A multiple scattering package for spectroscopies using electrons to probe materials" >> msspec.lsm
|
||||||
|
@echo "Keywords: " >> msspec.lsm
|
||||||
|
@echo "Author: sylvain.tricot@univ-rennes1.fr (Sylvain Tricot), didier.sebilleau@univ-rennes1.fr (Didier Sébilleau)" >> msspec.lsm
|
||||||
|
@echo "Maintained-by: sylvain.tricot@univ-rennes1.fr (Sylvain Tricot)" >> msspec.lsm
|
||||||
|
@echo "Primary-site: https://msspec.cnrs.fr" >> msspec.lsm
|
||||||
|
@echo "Alternate-site:" >> msspec.lsm
|
||||||
|
@echo "Original-site:" >> msspec.lsm
|
||||||
|
@echo "Platforms:" >> msspec.lsm
|
||||||
|
@echo "Copying-policy: Gnu Library General Public License (GLPL) 2.0" >> msspec.lsm
|
||||||
|
@echo "End" >> msspec.lsm
|
||||||
|
# create the self-extractible archive
|
||||||
|
@$(MAKESELF) --license "./license.txt" --lsm ./msspec.lsm ./src_ package/$(SETUPFILE) "Python MsSpec" ./install.sh $(SUPPRESS_OUPUT)
|
||||||
|
# remove *.lsm file and src_
|
||||||
|
@rm ./msspec.lsm
|
||||||
|
@rm -rf ./src_
|
||||||
|
|
||||||
|
|
||||||
|
version:
|
||||||
|
@python ./CI/update_version.py
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning all..."
|
||||||
|
@find ./src -type f -name '*.pyc' -exec rm -f {} +
|
||||||
|
@find ./src -type d -name '__pycache__' -exec rm -rf {} +
|
||||||
|
@rm -rf src/dist
|
||||||
|
@rm -rf src/*.egg*
|
||||||
|
@+$(MAKE) -C src/ clean $(SUPPRESS_OUPUT)
|
||||||
|
@+$(MAKE) -C doc/ clean $(SUPPRESS_OUPUT)
|
||||||
|
@rm -rf package
|
||||||
|
|
||||||
|
purge: clean
|
||||||
|
@echo "Removing also shared objects..."
|
||||||
|
@find ./src -type f -name '*.so' -exec rm -f {} +
|
||||||
|
|
||||||
|
results:
|
||||||
|
@+$(MAKE) -C src results
|
||||||
|
|
||||||
|
|
||||||
|
venv:
|
||||||
|
@virtualenv --python=python3 --system-site-packages ci_venv $(SUPPRESS_OUPUT)
|
||||||
|
@. "./ci_venv/bin/activate" && pip install --upgrade pip && pip install --upgrade -r requirements.txt $(SUPPRESS_OUPUT)
|
||||||
|
|
||||||
|
doc:
|
||||||
|
@echo "Building pdf and html documentation..."
|
||||||
|
@mkdir -p package/
|
||||||
|
@+$(MAKE) -C doc/ latexpdf $(SUPPRESS_OUPUT)
|
||||||
|
@rm -rf package/*.pdf
|
||||||
|
@cp "doc/build/latex/MsSpec-python.pdf" "./package/MsSpec-${VERSION}.pdf"
|
||||||
|
@+$(MAKE) -C doc/ html $(SUPPRESS_OUPUT)
|
|
@ -0,0 +1,36 @@
|
||||||
|
include options.mk
|
||||||
|
|
||||||
|
.PHONY: pybinding results clean
|
||||||
|
|
||||||
|
pybinding:
|
||||||
|
@echo "Building Python binding for phagen and spec..."
|
||||||
|
@+$(MAKE) -C msspec/phagen/fortran all
|
||||||
|
@+$(MAKE) -C msspec/spec/fortran all
|
||||||
|
|
||||||
|
results: msspec/results.txt
|
||||||
|
|
||||||
|
msspec/results.txt: pybinding
|
||||||
|
@echo "Generating results for unittests"
|
||||||
|
@coverage run --source=./ --omit=msspec/es/*,msspec/msspecgui/* msspec/create_tests_results.py
|
||||||
|
# create the html coverage report
|
||||||
|
@coverage html -d ../doc/source/htmlcov
|
||||||
|
@rm .coverage
|
||||||
|
|
||||||
|
tests: pybinding
|
||||||
|
@echo "Runing unittests"
|
||||||
|
@python -m msspec.tests 1>/dev/null
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning all..."
|
||||||
|
@find ./ -type f -name '*.pyc' -exec rm -f {} +
|
||||||
|
@find ./ -type d -name '__pycache__' -exec rm -rf {} +
|
||||||
|
@+$(MAKE) -C msspec/spec/fortran clean
|
||||||
|
@+$(MAKE) -C msspec/phagen/fortran clean
|
||||||
|
# remove previous sdist
|
||||||
|
@rm -rf dist
|
||||||
|
@rm -rf *.egg*
|
||||||
|
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "help message"
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
VERSION:=$(shell python -c "import msspec; print(msspec.__version__)")
|
||||||
|
|
||||||
|
VERBOSE:=0
|
||||||
|
ifeq ($(VERBOSE),0)
|
||||||
|
SUPPRESS_OUPUT:=1>/dev/null 2>/dev/null
|
||||||
|
MAKEFLAGS += --no-print-directory --silent
|
||||||
|
else
|
||||||
|
SUPPRESS_OUPUT:=
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
install: sdist
|
||||||
|
@echo "Installing the newly created Python package..."
|
||||||
|
@pip install dist/msspec-*.tar.gz $(SUPPRESS_OUPUT)
|
||||||
|
|
||||||
|
sdist: install_deps
|
||||||
|
@echo "Creating Python source distribution..."
|
||||||
|
# Create the source distrib
|
||||||
|
@python setup.py sdist $(SUPPRESS_OUPUT)
|
||||||
|
|
||||||
|
install_deps: pybinding
|
||||||
|
@echo "Installing Python dependencies..."
|
||||||
|
# Install dependencies with pip
|
||||||
|
@pip install --upgrade -r requirements.txt $(SUPPRESS_OUPUT)
|
||||||
|
|
||||||
|
pybinding:
|
||||||
|
@echo "Building Python binding for phagen and spec..."
|
||||||
|
@+$(MAKE) -C msspec/spec/fortran pybinding $(SUPPRESS_OUPUT)
|
||||||
|
@+$(MAKE) -C msspec/phagen/fortran pybinding $(SUPPRESS_OUPUT)
|
||||||
|
|
||||||
|
results: msspec/results.txt
|
||||||
|
|
||||||
|
msspec/results.txt: pybinding
|
||||||
|
@echo "Generating results for unittests"
|
||||||
|
@coverage run --source=./ --omit=msspec/es/*,msspec/msspecgui/* msspec/create_tests_results.py 1>/dev/null
|
||||||
|
# create the html coverage report
|
||||||
|
@coverage html -d ../doc/source/htmlcov
|
||||||
|
@rm .coverage
|
||||||
|
|
||||||
|
tests: pybinding
|
||||||
|
@echo "Runing unittests"
|
||||||
|
@python -m msspec.tests 1>/dev/null
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning all..."
|
||||||
|
@find ./ -type f -name '*.pyc' -exec rm -f {} +
|
||||||
|
@find ./ -type d -name '__pycache__' -exec rm -rf {} +
|
||||||
|
@+$(MAKE) -C msspec/spec/fortran clean $(SUPPRESS_OUPUT)
|
||||||
|
@+$(MAKE) -C msspec/phagen/fortran clean $(SUPPRESS_OUPUT)
|
||||||
|
# remove previous sdist
|
||||||
|
@rm -rf dist
|
||||||
|
@rm -rf *.egg*
|
||||||
|
|
||||||
|
purge: clean
|
||||||
|
@echo "Removing also shared objects..."
|
||||||
|
@find ./ -type f -name '*.so' -exec rm -f {} +
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "help message"
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
SRCS = phagen_scf_2.1_dp.f
|
||||||
|
MAIN_F = main.f
|
||||||
|
SO = libphagen.so
|
||||||
|
|
||||||
|
include ../../../options.mk
|
|
@ -0,0 +1,25 @@
|
||||||
|
.PHONY: all phd_se phd_mi eig_mi eig_pw comp_curve clean
|
||||||
|
|
||||||
|
all: phd_se phd_mi eig_mi eig_pw comp_curve
|
||||||
|
|
||||||
|
phd_se:
|
||||||
|
@+$(MAKE) -f phd_se_noso_nosp_nosym.mk all
|
||||||
|
|
||||||
|
phd_mi:
|
||||||
|
@+$(MAKE) -f phd_mi_noso_nosp_nosym.mk all
|
||||||
|
|
||||||
|
eig_mi:
|
||||||
|
@+$(MAKE) -f eig_mi.mk all
|
||||||
|
|
||||||
|
eig_pw:
|
||||||
|
@+$(MAKE) -f eig_pw.mk all
|
||||||
|
|
||||||
|
comp_curve:
|
||||||
|
@+$(MAKE) -f comp_curve.mk all
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@+$(MAKE) -f phd_se_noso_nosp_nosym.mk $@
|
||||||
|
@+$(MAKE) -f phd_mi_noso_nosp_nosym.mk $@
|
||||||
|
@+$(MAKE) -f eig_mi.mk $@
|
||||||
|
@+$(MAKE) -f eig_pw.mk $@
|
||||||
|
@+$(MAKE) -f comp_curve.mk $@
|
|
@ -0,0 +1,5 @@
|
||||||
|
SRCS = treatment/comp_curves.f
|
||||||
|
MAIN_F = treatment/main.f
|
||||||
|
SO = comp_curves.so
|
||||||
|
|
||||||
|
include ../../../options.mk
|
|
@ -0,0 +1,12 @@
|
||||||
|
memalloc_src := memalloc/dim_mod.f memalloc/modules.f memalloc/allocation.f
|
||||||
|
cluster_gen_src := $(wildcard cluster_gen/*.f)
|
||||||
|
common_sub_src := $(wildcard common_sub/*.f)
|
||||||
|
renormalization_src := $(wildcard renormalization/*.f)
|
||||||
|
eig_common_src := $(wildcard eig/common/*.f)
|
||||||
|
eig_mi_src := $(wildcard eig/mi/*.f)
|
||||||
|
|
||||||
|
SRCS = $(memalloc_src) $(cluster_gen_src) $(common_sub_src) $(renormalization_src) $(eig_mi_src)
|
||||||
|
MAIN_F = eig/mi/main.f
|
||||||
|
SO = _eig_pw.so
|
||||||
|
|
||||||
|
include ../../../options.mk
|
|
@ -0,0 +1,12 @@
|
||||||
|
memalloc_src := memalloc/dim_mod.f memalloc/modules.f memalloc/allocation.f
|
||||||
|
cluster_gen_src := $(wildcard cluster_gen/*.f)
|
||||||
|
common_sub_src := $(wildcard common_sub/*.f)
|
||||||
|
renormalization_src := $(wildcard renormalization/*.f)
|
||||||
|
eig_common_src := $(wildcard eig/common/*.f)
|
||||||
|
eig_pw_src := $(wildcard eig/pw/*.f)
|
||||||
|
|
||||||
|
SRCS = $(memalloc_src) $(cluster_gen_src) $(common_sub_src) $(renormalization_src) $(eig_pw_src)
|
||||||
|
MAIN_F = eig/pw/main.f
|
||||||
|
SO = _eig_pw.so
|
||||||
|
|
||||||
|
include ../../../options.mk
|
|
@ -0,0 +1,11 @@
|
||||||
|
memalloc_src := memalloc/dim_mod.f memalloc/modules.f memalloc/allocation.f
|
||||||
|
cluster_gen_src := $(wildcard cluster_gen/*.f)
|
||||||
|
common_sub_src := $(wildcard common_sub/*.f)
|
||||||
|
renormalization_src := $(wildcard renormalization/*.f)
|
||||||
|
phd_mi_noso_nosp_nosym_src := $(wildcard phd_mi_noso_nosp_nosym/*.f)
|
||||||
|
|
||||||
|
SRCS = $(memalloc_src) $(cluster_gen_src) $(common_sub_src) $(renormalization_src) $(phd_mi_noso_nosp_nosym_src)
|
||||||
|
MAIN_F = phd_mi_noso_nosp_nosym/main.f
|
||||||
|
SO = _phd_mi_noso_nosp_nosym.so
|
||||||
|
|
||||||
|
include ../../../options.mk
|
|
@ -0,0 +1,11 @@
|
||||||
|
memalloc_src := memalloc/dim_mod.f memalloc/modules.f memalloc/allocation.f
|
||||||
|
cluster_gen_src := $(wildcard cluster_gen/*.f)
|
||||||
|
common_sub_src := $(wildcard common_sub/*.f)
|
||||||
|
renormalization_src := $(wildcard renormalization/*.f)
|
||||||
|
phd_se_noso_nosp_nosym_src := $(wildcard phd_se_noso_nosp_nosym/*.f)
|
||||||
|
|
||||||
|
SRCS = $(memalloc_src) $(cluster_gen_src) $(common_sub_src) $(renormalization_src) $(phd_se_noso_nosp_nosym_src)
|
||||||
|
MAIN_F = phd_se_noso_nosp_nosym/main.f
|
||||||
|
SO = _phd_se_noso_nosp_nosym.so
|
||||||
|
|
||||||
|
include ../../../options.mk
|
|
@ -0,0 +1,97 @@
|
||||||
|
FC = gfortran
|
||||||
|
F2PY = f2py3
|
||||||
|
|
||||||
|
DEBUG = 0
|
||||||
|
VERBOSE = 0
|
||||||
|
BUILDDIR = ./build
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# GFORTRAN CONFIGURATION #
|
||||||
|
################################################################################
|
||||||
|
GFORTRAN_FFLAGS = -O2 -ffast-math
|
||||||
|
GFORTRAN_FFLAGS_DBG = -g -Wall -Wextra -Warray-temporaries -Wconversion
|
||||||
|
GFORTRAN_FFLAGS_DBG += -fbacktrace -ffree-line-length-0 -fcheck=all
|
||||||
|
GFORTRAN_FFLAGS_DBG += -ffpe-trap=zero,overflow,underflow -finit-real=nan
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# IFORT CONFIGURATION #
|
||||||
|
################################################################################
|
||||||
|
IFORT_FFLAGS =
|
||||||
|
IFORT_FFLAGS_DBG =
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# F2PY CONFIGURATION #
|
||||||
|
################################################################################
|
||||||
|
F2PYFLAGS = --opt=-O2
|
||||||
|
F2PYFLAGS_DBG = --debug-capi --debug
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# /!\ DO NOT EDIT BELOW THAT LINE (unlesss you know what you're doing...) #
|
||||||
|
# CORE CONFIGURATION #
|
||||||
|
################################################################################
|
||||||
|
VERSION:=$(shell python -c "import msspec; print(msspec.__version__)")
|
||||||
|
|
||||||
|
ifeq ($(VERBOSE),0)
|
||||||
|
OUPUT_REDIRECTION := 1>/dev/null 2>/dev/null
|
||||||
|
MAKEFLAGS = -s --no-print-directory
|
||||||
|
else
|
||||||
|
OUPUT_REDIRECTION:=
|
||||||
|
MAKEFLAGS += --debug=b
|
||||||
|
endif
|
||||||
|
|
||||||
|
PREFIX=
|
||||||
|
SUFFIX=
|
||||||
|
|
||||||
|
ifeq ($(FC),gfortran)
|
||||||
|
PREFIX = GFORTRAN
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(FC),IFORT)
|
||||||
|
PREFIX = IFORT
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(DEBUG),1)
|
||||||
|
SUFFIX = _DBG
|
||||||
|
endif
|
||||||
|
|
||||||
|
FFLAGS = $($(PREFIX)_FFLAGS$(SUFFIX))
|
||||||
|
|
||||||
|
OBJS = $(addprefix $(BUILDDIR)/, $(patsubst %.f,%.o, $(filter-out $(MAIN_F), $(SRCS))))
|
||||||
|
|
||||||
|
.PHONY: clean obj all compilation_info
|
||||||
|
|
||||||
|
compilation_info:
|
||||||
|
@echo "Compiler used: $(FC)"
|
||||||
|
@echo "fortran flags: $(FFLAGS)"
|
||||||
|
@echo "f2py flags: $(FFLAGS)"
|
||||||
|
|
||||||
|
|
||||||
|
all: $(SO)
|
||||||
|
|
||||||
|
|
||||||
|
obj: $(OBJS)
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "Cleaning..."
|
||||||
|
rm -rf $(BUILDDIR)
|
||||||
|
rm -rf $(SO)
|
||||||
|
|
||||||
|
|
||||||
|
$(BUILDDIR)/%.o: %.f
|
||||||
|
@echo "Compiling $@..."
|
||||||
|
mkdir -p $(basename $@)
|
||||||
|
$(FC) $(FFLAGS) -J $(BUILDDIR) -I $(BUILDDIR) -fPIC -o $@ -c $^ $(OUPUT_REDIRECTION)
|
||||||
|
|
||||||
|
|
||||||
|
$(SO): $(OBJS) $(MAIN_F)
|
||||||
|
@echo "building Python binding $@..."
|
||||||
|
mkdir -p $(BUILDDIR)
|
||||||
|
$(F2PY) $(F2PYFLAGS) -I$(BUILDDIR) -m $(basename $@) -c $(OBJS) $(MAIN_F) $(OUPUT_REDIRECTION)
|
||||||
|
mv $(basename $@).*.so $@
|
Loading…
Reference in New Issue