-
Notifications
You must be signed in to change notification settings - Fork 68
/
Makefile
72 lines (58 loc) · 2.41 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
WEBR_ROOT ?= $(abspath .)
WASM = $(WEBR_ROOT)/wasm
HOST = $(WEBR_ROOT)/host
TOOLS = $(WEBR_ROOT)/tools
default: webr
# This is created at configure-time
include $(TOOLS)/fortran.mk
.PHONY: webr
webr: $(EMFC) $(FORTRAN_WASM_LIB) libs ## Build webR and install the web app in `./dist`
cd R && $(MAKE) && $(MAKE) install
cd src && $(MAKE)
.PHONY: libs
libs: ## Compile supporting libs for webR
cd libs && $(MAKE)
.PHONY: docker-webr
docker-webr: ## Build webR in a temporary Docker container
mkdir -p dist
docker build -t webr-build .
docker run --rm --mount type=bind,source=$(PWD),target=/app webr-build
# Create a permanent docker container for building webR. Call `make`
# from within the container to start the build.
.PHONY: docker-container-%
docker-container-%: ## Build webR development Docker container using a supplied name
docker build -t webr-build .
docker run -dit --name $* --mount type=bind,source=$(PWD),target=/app webr-build bash
docs: docs/build ## Build documentation and Quarto website
docs/build: ## Build documentation and Quarto website
cd docs && $(MAKE) api && $(MAKE) html
.PHONY: check
check: ## Run unit tests and calculate coverage
cd src && $(MAKE) check
.PHONY: check-pr
check-pr: ## Run additional pull request tests, linter, and calculate coverage
cd src && $(MAKE) lint && $(MAKE) check && $(MAKE) check-packages
.PHONY: clean
clean: ## Remove Wasm R build
rm -rf $(HOST) $(WASM)/R-*
cd R && $(MAKE) clean
.PHONY: clean-wasm
clean-wasm: clean ## Remove Wasm R build and supporting libs
rm -rf $(WASM)
cd libs && $(MAKE) clean
.PHONY: distclean
distclean: clean-wasm clean-tools ## Remove Wasm R build, supporting libs, build tools, and webR distribution
rm -rf dist
.PHONY: help
help: ## Show help messages for make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-18s\033[0m %s\n", $$1, $$2}'
.PHONY: debug
debug: ## Print all variables for debugging
@printf "\033[32m%-18s\033[0m %s\n" "WEBR_ROOT" "$(WEBR_ROOT)"
@printf "\033[32m%-18s\033[0m %s\n" "WASM" "$(WASM)"
@printf "\033[32m%-18s\033[0m %s\n" "HOST" "$(HOST)"
@printf "\033[32m%-18s\033[0m %s\n" "TOOLS" "$(TOOLS)"
@printf "\033[32m%-18s\033[0m %s\n" "EMFC" "$(EMFC)"
@printf "\033[32m%-18s\033[0m %s\n" "FORTRAN_WASM_LIB" "$(FORTRAN_WASM_LIB)"
@printf "\033[32m%-18s\033[0m %s\n" "PWD" "$(PWD)"
@printf "\033[32m%-18s\033[0m %s\n" "MAKE" "$(MAKE)"