makefile.conf 1.2 KB
Newer Older
ulrich_y's avatar
ulrich_y committed
1 2
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))

ulrich_y's avatar
ulrich_y committed
3 4 5
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
    ifneq ("$(wildcard /etc/redhat-release)","")
ulrich_y's avatar
ulrich_y committed
6
        PYTHON=PYTHONPATH=$$PYTHONPATH:/scratch/ulrich/pymule/tools/ /afs/psi.ch/sys/psi.x86_64_slp6/Programming/psi-python27/4.4.0/bin/python -B
ulrich_y's avatar
ulrich_y committed
7 8 9
        PEP8=$(PYTHON) /afs/psi.ch/sys/psi.x86_64_slp6/Programming/psi-python27/4.4.0/bin/pep8
        JUPYTERCONV=$(PYTHON) /afs/psi.ch/sys/psi.x86_64_slp6/Programming/psi-python27/4.4.0/bin/jupyter-nbconvert
    else
ulrich_y's avatar
ulrich_y committed
10
        PYTHON=python -B
ulrich_y's avatar
ulrich_y committed
11 12 13 14 15 16
        PEP8=pep8
        JUPYTERCONV=jupyter nbconvert
    endif
else

endif
ulrich_y's avatar
ulrich_y committed
17 18 19 20 21
PY2NB = $(PYTHON) $(SELF_DIR)/py2nb.py -x

PEP8FLAGS=--ignore=E265,E266,W503,E121,E123,E126,E226,E24,E704,W503

.DEFAULT_GOAL=all
ulrich_y's avatar
ulrich_y committed
22
.PHONY:check clean ci
ulrich_y's avatar
ulrich_y committed
23 24 25 26 27 28 29 30 31 32 33 34

%.ipynb: %.py
	$(PY2NB) $<

%.html: %.ipynb
	$(JUPYTERCONV) --to html $<

$(figures): $(name).ipynb

all: $(name).html $(figures)

clean:
ulrich_y's avatar
ulrich_y committed
35
	rm -rf *.ipynb *.pdf *.png *.html *.tex *.pgf *.pyc .ipynb_checkpoints
ulrich_y's avatar
ulrich_y committed
36 37

check:
ulrich_y's avatar
ulrich_y committed
38
	@res=$$(find . -name "*.py" -exec $(PEP8) $(PEP8FLAGS) {} \;) ; \
ulrich_y's avatar
ulrich_y committed
39
	if [ -n "$$res" ]; then echo "$$res" ; fi
ulrich_y's avatar
ulrich_y committed
40 41

ci: all
ulrich_y's avatar
ulrich_y committed
42 43
	mkdir -p $(SELF_DIR)/../ci/$(group)/$(name)/
	cp $(name).html $(name).ipynb $(figures) $(SELF_DIR)/../ci/$(group)/$(name)