27 lines
960 B
Makefile
Raw Normal View History

SHELL := bash
CABAL_DIR := $(abspath ../.cabal)
CABAL_ENV := CABAL_DIR=$(CABAL_DIR) XDG_STATE_HOME=$(CABAL_DIR)/state XDG_CACHE_HOME=$(CABAL_DIR)/cache XDG_CONFIG_HOME=$(CABAL_DIR)/config
.DEFAULT_GOAL := help
.PHONY: help
help: ## Show available Haskell interop commands
@grep -E '^[a-zA-Z_-]+:.*## .*$$' Makefile | \
awk 'BEGIN {FS = ":.*## "}; {printf "\033[36m%-24s\033[0m %s\n", $$1, $$2}'
.PHONY: rust-lib
rust-lib: ## Build the Rust static library used by the Haskell executable
@cargo build --manifest-path ../Cargo.toml --lib
.PHONY: build
build: rust-lib ## Build the Haskell project, including the foreign library for Rust
@$(CABAL_ENV) cabal build --project-file=cabal.project all
.PHONY: run
run: rust-lib ## Run the Haskell -> Rust demo executable
@$(CABAL_ENV) cabal run --project-file=cabal.project haskell-calls-rust -- Ada 7 5
.PHONY: test
test: ## Run the pure Haskell tests
@$(CABAL_ENV) cabal test --project-file=cabal.project