-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (58 loc) · 2.57 KB
/
Makefile
File metadata and controls
82 lines (58 loc) · 2.57 KB
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
.PHONY: help test docs clean distclean devrepl codestyle servedocs
.DEFAULT_GOAL := help
JULIA ?= julia
PORT ?= 8000
define PRINT_HELP_JLSCRIPT
rx = r"^([a-z0-9A-Z_-]+):.*?##[ ]+(.*)$$"
for line in eachline()
m = match(rx, line)
if !isnothing(m)
target, help = m.captures
println("$$(rpad(target, 20)) $$help")
end
end
endef
export PRINT_HELP_JLSCRIPT
help: ## show this help
@git config --local blame.ignoreRevsFile .git-blame-ignore-revs
@julia -e "$$PRINT_HELP_JLSCRIPT" < $(MAKEFILE_LIST)
test: test/Manifest.toml ## Run the test suite
$(JULIA) --project=test --banner=no --startup-file=yes -e 'include("devrepl.jl"); test()'
@echo "Done. Consider using 'make devrepl'"
test/Manifest.toml: test/Project.toml
@if [ -e ../scripts/installorg.jl ]; then \
$(JULIA) --project=test ../scripts/installorg.jl; \
else \
$(JULIA) --project=test -e 'import Pkg; Pkg.develop(path="."); Pkg.instantiate()'; \
fi
@touch $@
docs/Manifest.toml: docs/Project.toml
@git config --local blame.ignoreRevsFile .git-blame-ignore-revs
@if [ -e ../scripts/installorg.jl ]; then \
$(JULIA) --project=docs ../scripts/installorg.jl; \
else \
$(JULIA) --project=docs -e 'import Pkg; Pkg.develop(path="."); Pkg.instantiate()'; \
fi
@touch $@
devrepl: ## Start an interactive REPL for testing and building documentation
$(JULIA) --project=test --banner=no --startup-file=yes -i devrepl.jl
docs: docs/Manifest.toml ## Build the documentation
$(JULIA) --project=docs docs/make.jl
@echo "Done. Consider using 'make devrepl'"
servedocs: test/Manifest.toml ## Build (auto-rebuild) and serve documentation at PORT=8000
$(JULIA) --project=test -e 'include("devrepl.jl"); servedocs(port=$(PORT), verbose=true)'
clean: ## Clean up build/doc/testing artifacts
$(JULIA) -e 'include("test/clean.jl"); clean()'
.JuliaFormatter.toml:
@if [ -e ../.JuliaFormatter.toml ]; then \
ln -sf ../.JuliaFormatter.toml .JuliaFormatter.toml; \
echo "Linked to ../.JuliaFormatter.toml"; \
else \
curl -fsSL -o .JuliaFormatter.toml https://raw.githubusercontent.com/JuliaQuantumControl/JuliaQuantumControl/refs/heads/master/.JuliaFormatter.toml; \
echo "Downloaded .JuliaFormatter.toml from JuliaQuantumControl repository"; \
fi
codestyle: test/Manifest.toml .JuliaFormatter.toml ## Apply the codestyle to the entire project
$(JULIA) --project=test -e 'using JuliaFormatter; format(".", verbose=true)'
@echo "Done. Consider using 'make devrepl'"
distclean: clean ## Restore to a clean checkout state
$(JULIA) -e 'include("test/clean.jl"); clean(distclean=true)'