-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
28 lines (22 loc) · 1.38 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
# bash sell to correctly interpret the double brackets in the conditions below
SHELL=/bin/bash
# https://www.gnu.org/software/make/manual/html_node/One-Shell.html
# Required to prevent having to use "conda init"
# all the lines in a recipe are passed to a single invocation of the shell.
.ONESHELL:
# list of all phony targets, alphabetically sorted
.PHONY: help conda docs test
help:
# this nifty perl one-liner collects all commnents headed by the double "#" symbols next to each target and recycles them as comments
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
# Note that the extra activate is needed to ensure that the activate floats env to the front of PATH
CONDA_ACTIVATE=source $$(conda info --base)/etc/profile.d/conda.sh ; conda activate
conda-env: ## creates conda environment `refred` and installs package `RefRed` in editable mode
conda env create --solver=libmamba --file ./environment.yml
$(CONDA_ACTIVATE) refred
pip install -e .
docs: ## create HTML docs under `docs/_build/html/`. Requires activation of the `refred` conda environment
# this will fail on a warning
@cd docs&& make html SPHINXOPTS="-W --keep-going -n" && echo -e "##########\n DOCS point your browser to file://$$(pwd)/_build/html/index.html\n##########"
test-all: ## run all tests
pytest ./test