-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (56 loc) · 2.66 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
75
76
77
78
79
SHELL := /bin/bash
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
PACKAGE = $(shell python ../setup.py --name)
include $(SELF_DIR)/.ci_env
# HELP
# This will output the help for each task
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help test
help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
# cli args
ARGS = $(filter-out $@,$(MAKECMDGOALS))
MAKE_CMD = $(MAKE) -s --no-print-directory -C makefiles
# Default environment
ifeq ($(env),)
env = ${PACKAGE}_build
endif
clean:
@$(MAKE_CMD) -f conda.mk clean
# FAST TESTING
check: check-buildenv
@conda run -n $(env) --no-capture-output $(MAKE_CMD) -f test.mk check
test: test-buildenv ## Test code with 'pytest', this is the fastest way to test the code
@conda run -n $(env) --no-capture-output $(MAKE_CMD) -f test.mk test args="$(args)"
%-buildenv: ## Test conda package
ifneq ($(strip $(env)),)
$(eval env=${PACKAGE}_$*)
endif
@$(MAKE_CMD) -f conda.mk build-environment-$* env=$(env)
# %-inconda: ## Test conda package
# ifneq ($(strip $(env)),)
# $(eval env=${PACKAGE}_$*)
# endif
# @$(MAKE_CMD) -f conda.mk check-environment-$* env=$(env)
# @$(MAKE_CMD) -f conda.mk conda-run-env env=$(env) \
# cmd="make -C .. $*" \
# args="$(args)"
conda-all: conda-build conda-test conda-convert conda-publish ## (default) Perform all conda process (build, test, convert, publish)
# CONDA WORKFLOW
conda-build: ## Build (without tests) conda package, 'variants=<variants>' option can be passed (format must be fully compliant with '--variants' option of conda-build)
@$(MAKE_CMD) -f conda.mk conda-build-only env=build variants="$(variants)"
conda-test: ## Test conda package
@$(MAKE_CMD) -f conda.mk conda-test-only env=build
conda-clean: ## Test conda package
@$(MAKE_CMD) -f conda.mk conda-clean
conda-convert: ## Convert conda package towards all platforms, if 'python=<version>' (default is all variants of package built) is set then the package built for this version of Python will be converted
@$(MAKE_CMD) -f conda.mk conda-convert env=$(env)
conda-publish: ## Publish conda package, if 'python=<version>' (default is all variants of package built) is set then the package built for this version of Python will be published
@$(MAKE_CMD) -f conda.mk conda-publish env=$(env)
conda-check-recipe: ## Check conda recipe
@$(MAKE_CMD) -f conda.mk conda-recipe-check
conda-create-run_env: ## Make an conda environment to run program
@$(MAKE_CMD) -f conda.mk check-environment-test env=${PACKAGE}_test
doc-pdoc:
cd .. ; rm -rf chemlite/__pycache__ ; pdoc --force --html -o docs chemlite