forked from ReactiveBayes/RxInfer.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (71 loc) · 4.77 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
80
81
82
83
84
85
86
87
88
89
90
91
92
SHELL = /bin/bash
.DEFAULT_GOAL = help
# Windows has different commands in shell
# - `RM` command: use for removing files
ifeq ($(OS), Windows_NT)
RM = del /Q /F
PATH_SEP = \\
else
RM = rm -rf
PATH_SEP = /
endif
# Includes `examples/Manifest.toml`
EXAMPLES_MANIFEST_FILE = examples$(PATH_SEP)Manifest.toml
# Includes `examples/Manifest.toml`, `docs/src/examples`, `docs/src/assets/examples`
EXAMPLES_FILES = $(EXAMPLES_MANIFEST_FILE) docs$(PATH_SEP)src$(PATH_SEP)examples docs$(PATH_SEP)src$(PATH_SEP)assets$(PATH_SEP)examples
# Includes `docs/build`
DOCS_BUILD_FILES = docs$(PATH_SEP)build
# Includes `_output`, `test/_output`
TEST_OUTPUT_FILES = _output test$(PATH_SEP)_output
# Includes all the above
ALL_TMP_FILES = $(EXAMPLES_FILES) $(DOCS_BUILD_FILES) $(TEST_OUTPUT_FILES)
.PHONY: lint format
scripts_init:
julia --startup-file=no --project=scripts/ -e 'using Pkg; Pkg.instantiate(); Pkg.update(); Pkg.precompile();'
lint: scripts_init ## Code formating check
julia --startup-file=no --project=scripts/ scripts/format.jl
format: scripts_init ## Code formating run
julia --startup-file=no --project=scripts/ scripts/format.jl --overwrite
.PHONY: examples
examples_init:
$(RM) $(EXAMPLES_MANIFEST_FILE)
julia --startup-file=no --project=examples/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.build(); Pkg.precompile();'
dev_examples_init:
$(RM) $(EXAMPLES_MANIFEST_FILE)
julia --startup-file=no --project=examples -e 'using Pkg; Pkg.rm([ "RxInfer", "BayesBase", "ExponentialFamily", "ReactiveMP", "GraphPPL", "Rocket" ])'
julia --startup-file=no --project=examples -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "BayesBase.jl")));'
julia --startup-file=no --project=examples -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "ExponentialFamily.jl")));'
julia --startup-file=no --project=examples -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "ReactiveMP.jl")));'
julia --startup-file=no --project=examples -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "GraphPPL.jl")));'
julia --startup-file=no --project=examples -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "Rocket.jl")));'
julia --startup-file=no --project=examples/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.precompile();'
examples: scripts_init examples_init ## Precompile examples and put them in the `docs/src/examples` folder (use specific="<pattern>" to compile a specific example)
julia --startup-file=no --project=scripts/ scripts/examples.jl $(specific)
devexamples: scripts_init dev_examples_init ## Same as `make examples` but uses `dev-ed` versions of core packages
julia --startup-file=no --project=scripts/ scripts/examples.jl $(specific)
.PHONY: docs
doc_init:
$(RM) $(EXAMPLES_MANIFEST_FILE)
julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.precompile();'
dev_doc_init:
$(RM) $(EXAMPLES_MANIFEST_FILE)
julia --startup-file=no --project=docs -e 'using Pkg; Pkg.rm([ "RxInfer", "BayesBase", "ExponentialFamily", "ReactiveMP", "GraphPPL", "Rocket" ])'
julia --startup-file=no --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "BayesBase.jl")));'
julia --startup-file=no --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "ExponentialFamily.jl")));'
julia --startup-file=no --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "ReactiveMP.jl")));'
julia --startup-file=no --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "GraphPPL.jl")));'
julia --startup-file=no --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=joinpath(Pkg.devdir(), "Rocket.jl")));'
julia --startup-file=no --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.precompile();'
docs: doc_init ## Generate documentation
julia --startup-file=no --project=docs/ docs/make.jl
devdocs: dev_doc_init ## Same as `make docs` but uses `dev-ed` versions of core packages
julia --startup-file=no --project=docs/ docs/make.jl
.PHONY: test
test: ## Run tests, use dev=true to use `dev-ed` version of core packages
julia -e 'ENV["USE_DEV"]="$(dev)"; import Pkg; Pkg.activate("."); Pkg.test()'
devtest: ## Alias for the `make test dev=true ...`
julia -e 'ENV["USE_DEV"]="true"; import Pkg; Pkg.activate("."); Pkg.test()'
clean: ## Clean documentation build, precompiled examples, benchmark output from tests
$(foreach file, $(ALL_TMP_FILES), $(RM) $(file))
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-24s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)