-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
513147b
commit 72927c1
Showing
2 changed files
with
56 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,77 @@ | ||
# Define installation arguments with optional prefix | ||
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),) | ||
# Define examples with their descriptions | ||
EXAMPLE_DESCRIPTIONS := \ | ||
"example-building-ast:Demonstrates how to build AST" \ | ||
"example-destructuring-ast:Demonstrates how to destructure an AST" \ | ||
|
||
# Default rule | ||
default: | ||
.PHONY: help | ||
help: ## Print this help message | ||
@echo ""; | ||
@echo "List of available make commands"; | ||
@echo ""; | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'; | ||
@echo ""; | ||
@echo "Available examples:"; | ||
@echo ""; | ||
@for desc in $(EXAMPLE_DESCRIPTIONS); do \ | ||
target=$$(echo $$desc | cut -d: -f1); \ | ||
description=$$(echo $$desc | cut -d: -f2); \ | ||
printf " \033[36m%-30s\033[0m %s\n" "$$target" "$$description"; \ | ||
done | ||
@echo ""; | ||
|
||
.PHONY: default | ||
default: ## Build the project with auto-promote | ||
dune build --auto-promote @install | ||
|
||
install: | ||
.PHONY: install | ||
install: ## Install the project | ||
dune install $(INSTALL_ARGS) | ||
|
||
uninstall: | ||
.PHONY: uninstall | ||
uninstall: ## Uninstall the project | ||
dune uninstall $(INSTALL_ARGS) | ||
|
||
reinstall: uninstall reinstall | ||
.PHONY: reinstall | ||
reinstall: ## Reinstall the project | ||
uninstall reinstall | ||
|
||
test: | ||
.PHONY: test | ||
test: ## Run tests | ||
dune runtest | ||
|
||
doc: | ||
.PHONY: doc | ||
doc: ## Build documentation | ||
dune build @doc | ||
|
||
clean: | ||
.PHONY: doc-dev | ||
doc-dev: ## Build and watch documentation | ||
dune build @doc --watch & dune_pid=$$!; \ | ||
trap 'kill $$dune_pid' EXIT; \ | ||
sleep 2 && open _build/default/_doc/_html/index.html & \ | ||
wait $$dune_pid | ||
|
||
.PHONY: clean | ||
clean: ## Clean the build artifacts | ||
dune clean | ||
|
||
all-supported-ocaml-versions: | ||
.PHONY: all-supported-ocaml-versions | ||
all-supported-ocaml-versions: ## Build for all supported OCaml versions | ||
dune build @install --workspace dune-workspace.dev --root . | ||
|
||
opam-release: | ||
.PHONY: opam-release | ||
opam-release: ## Release the project using opam | ||
dune-release distrib --skip-build --skip-lint --skip-tests | ||
dune-release publish distrib --verbose | ||
dune-release opam pkg | ||
dune-release opam submit | ||
|
||
bench: | ||
.PHONY: bench | ||
bench: ## Run benchmarks | ||
dune build bench --profile release | ||
dune exec bench/bench.exe | ||
|
||
.PHONY: default install uninstall reinstall clean test doc bench | ||
.PHONY: all-supported-ocaml-versions opam-release | ||
|
||
.PHONY: $(TARGET) | ||
example-%: | ||
.PHONY: example-<target> | ||
example-%: ## Run example with specified target, e.g. make example-global-transformation | ||
DUNE_CONFIG__GLOBAL_LOCK=disabled opam exec -- dune exec $*-example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters