-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (67 loc) · 2.54 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
ANACONDA2 = /usr/pppl/anaconda2/4.4.0/bin
ANACONDA3 = /usr/pppl/anaconda3/4.4.0/bin
define PRINT_HELP_PYSCRIPT
import re, sys
print("Makefile targets:")
for line in sys.stdin:
match = re.match(r'^([0-9a-zA-Z_. -]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
for word in target.split():
print("%-20s %s" % (word, help))
endef
export PRINT_HELP_PYSCRIPT
.PHONY: help
help: ## show this help message
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
.PHONY: mdsplus
mdsplus: ## Build and test Python package for MDSplus release
$(eval mdsdir := pylib/$@)
@echo "****************************************************"
@echo "*** Start: $(mdsdir)"
@echo "MDSplus installation: $(MDSPLUS)"
@echo "Building and testing with python2"
@$(MAKE) build mdsdir=$(mdsdir) pybase=$(ANACONDA2)
@$(MAKE) test mdsdir=$(mdsdir) pybase=$(ANACONDA2)
@echo "*** Successful build and test: $(mdsdir)"
@echo "****************************************************"
.PHONY: mdsplus_alpha v6.1.84 v7.0.71 v7.1.13
mdsplus_alpha v6.1.84 v7.0.71 v7.1.13: ## Build and test Python package for MDSplus release
$(eval mdsdir := pylib/$@)
@echo "****************************************************"
@echo "*** Start: $(mdsdir)"
@echo "MDSplus installation: $(MDSPLUS)"
@echo "Building with python3 and testing with python2/python3"
@$(MAKE) build mdsdir=$(mdsdir) pybase=$(ANACONDA3) wheel_flags=--universal
@$(MAKE) test mdsdir=$(mdsdir) pybase=$(ANACONDA3)
@$(MAKE) test mdsdir=$(mdsdir) pybase=$(ANACONDA2)
@echo "*** Successful build and test: $(mdsdir)"
@echo "****************************************************"
.PHONY: build
build:
@echo "*** Build & install $(mdsdir) with $(pybase)"
$(eval python = $(pybase)/python)
@echo "Using python: $(python)"
$(eval pip = $(pybase)/pip)
@echo "Using pip: $(pip)"
@rm -rf $(mdsdir)/dist $(mdsdir)/build $(mdsdir)/package
@echo "Building:"
cd $(mdsdir) && $(python) setup.py --quiet bdist_wheel $(wheel_flags)
@echo "Installing:"
@mkdir -p $(mdsdir)/package
cd $(mdsdir) && $(pip) install --quiet --no-index --ignore-installed \
--find-links=dist --target=package MDSplus
@echo "*** End build & install"
.PHONY: test
test:
@echo "*** Testing $(mdsdir) with $(pybase)"
$(eval python = $(pybase)/python)
@echo "Using python: $(python)"
$(eval PYTHONPATH := $(mdsdir)/package)
@echo "PYTHONPATH: $(PYTHONPATH)"
$(eval PYTHONUSERBASE := '')
@echo "PYTHONUSERBASE: $(PYTHONUSERBASE)"
@$(python) --version
$(python) -c "import MDSplus; print(MDSplus.__file__)"
$(python) test-mdsplus.py
@echo "*** End testing"