-rw-r--r-- Makefile
1 .DEFAULT_GOAL := build 2 3 .PHONY: build 4 build: ## Compile the binary (Default) 5 @stack build --keep-going 6 7 .PHONY: help 8 help: ## Show this help 9 @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[1m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) 10 11 .PHONY: lint 12 lint: ## Check the source code 13 @hlint src 14 15 .PHONY: format 16 format: ## Auto-format the source code 17 @fourmolu -m inplace src/*.hs 18 19 .PHONY: install 20 install: ## Install the compiled executable 21 @stack install --ghc-options="-O2" 22 23 .PHONY: clean 24 clean: ## Clean generated files 25 @stack clean 26 27 .PHONY: rebuild 28 rebuild: ## Clean and then build 29 @stack clean 30 @stack build 31 32 .PHONY: run 33 run: ## Run gitja on this repository into ./output/ 34 rm -rf output 35 stack run -- -q 36 37 .PHONY: test 38 test: ## Run the "tests" 39 bash ./test/test.sh 40 41 .PHONY: all 42 all: format lint rebuild run test ## Lint, format, rebuild, run, test 43 44 .PHONY: prod 45 prod: ## Build with optimise flags 46 @stack build --ghc-options="-O2" 47 48 .PHONY: dot 49 dot: ## Visualise dependencies 50 stack dot --external --depth 1 --prune base,text,bytestring,transformers \ 51 | twopi -Goverlap=false -Tpng -o deps.png 52 53 PROF ?= fprof-auto 54 # other options: fno-prof-auto fprof-auto-top 55 56 .PHONY: prof 57 prof: _prof_build ## Build with profiling enabled 58 stack exec --profile -- gitja -q +RTS -p -po${PROF} 59 ghc-prof-flamegraph ${PROF}.prof -o ${PROF}.svg 60 61 .PHONY: prof_speedscope 62 prof_speedscope: _prof_build ## Build with profiling enabled (JSON output with speedscope) 63 stack exec --profile -- gitja -q +RTS -p -po${PROF} -pj 64 speedscope ${PROF}.prof 65 66 _prof_build: 67 stack build --profile --ghc-options="-${PROF}" 68 rm -fr output 69