forked from ufs-community/uwtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (35 loc) · 1.18 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
CHANNELS = $(addprefix -c ,$(shell tr '\n' ' ' <$(RECIPE_DIR)/channels)) -c local
METADEPS = $(addprefix $(RECIPE_DIR)/,meta.yaml) src/uwtools/resources/info.json
METAJSON = $(RECIPE_DIR)/meta.json
TARGETS = clean-devenv devshell docs env format lint meta package test typecheck unittest
export RECIPE_DIR := $(shell cd ./recipe && pwd)
clean = $(info $(shell $(CONDA_EXE) env remove -y -n DEV-$(call val,name)))
spec = $(call val,name)$(2)$(call val,version)$(2)$(call val,$(1))
val = $(shell jq -r .$(1) $(METAJSON))
.PHONY: $(TARGETS)
all:
$(error Valid targets are: $(TARGETS))
clean-devenv:
$(if $(filter DEV-$(call val,name),$(CONDA_DEFAULT_ENV)),$(error EXIT DEVSHELL FIRST),$(call clean))
devshell:
condev-shell || true
docs:
$(MAKE) -C docs examples
$(MAKE) -C docs docs
env: package
conda create -y -n $(call spec,buildnum,-) $(CHANNELS) $(call spec,build,=)
format:
@./format
lint:
recipe/run_test.sh lint
meta: $(METAJSON)
package: meta
conda build $(CHANNELS) --error-overlinking --override-channels $(RECIPE_DIR)
test:
recipe/run_test.sh
typecheck:
recipe/run_test.sh typecheck
unittest:
recipe/run_test.sh unittest
$(METAJSON): $(METADEPS)
condev-meta