Skip to content

Instantly share code, notes, and snippets.

@HirotoShioi
Created March 18, 2019 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HirotoShioi/7378d921931fd3c5470095bbaa177211 to your computer and use it in GitHub Desktop.
Save HirotoShioi/7378d921931fd3c5470095bbaa177211 to your computer and use it in GitHub Desktop.
Makefile
PROJECT_NAME = <enter your project name here>
help: ## Print documentation
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
stylish-haskell: ## Apply stylish-haskell on all *.hs files
@find . -type f -name "*.hs" -not -path '.git' -not -path '*.stack-work*' -print0 | xargs -0 stylish-haskell -i
ghci: ## Run repl
@stack ghci $(PROJECT_NAME):lib --haddock-deps --ghci-options=-fobject-code
ghcid: ## Run ghcid
@ghcid --command "stack ghci $(PROJECT_NAME):lib --ghci-options=-fobject-code"
run-test: ## Build & run test
@stack build --fast && \
stack test --fast
test-ghci: ## Run repl on test suites
@stack ghci $(PROJECT_NAME):lib $(PROJECT_NAME):test:$(PROJECT_NAME)-test
test-ghcid: ## Run ghcid on test suites
@ghcid --command "stack ghci $(PROJECT_NAME):lib $(PROJECT_NAME):test:$(PROJECT_NAME)-test --ghci-options=-fobject-code"
.PHONY: stylish-haskell ghci ghcid runtest test-ghcid test-ghci help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment