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: clean @echo "Creating the self-extractible setup program... " # update the version @cp ./src/msspec/version.py ./src/msspec/version.py.bak @echo "__version__ = \"$(VERSION)\"" > ./src/msspec/version.py # 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) # restore previous version.py file and remove *.lsm file @mv ./src/msspec/version.py.bak ./src/msspec/version.py @rm ./msspec.lsm 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 venv: @virtualenv --python=python3 --system-site-packages ci_venv $(SUPPRESS_OUPUT) @. "./ci_venv/bin/activate" && pip install --upgrade pip numpy ase h5py lxml pint terminaltables pycairo sphinx $(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)