Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 151b173

Browse files
committed
Makefile: Rework for use by haddock developers
Previously the Makefile was present only for GHC's old make-based build system. Now since the make-based build system is gone we can use it for more useful ends.
1 parent 074e7d8 commit 151b173

File tree

1 file changed

+37
-15
lines changed

1 file changed

+37
-15
lines changed

Makefile

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1-
# -----------------------------------------------------------------------------
2-
#
3-
# (c) 2009 The University of Glasgow
4-
#
5-
# This file is part of the GHC build system.
6-
#
7-
# To understand how the build system works and how to modify it, see
8-
# http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9-
# http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10-
#
11-
# -----------------------------------------------------------------------------
12-
13-
dir = utils/haddock
14-
TOP = ../..
15-
include $(TOP)/mk/sub-makefile.mk
1+
clean: ## Remove compilation artifacts
2+
@cabal clean
3+
4+
repl: ## Start a REPL
5+
@cabal repl
6+
7+
test: ## Run the test suite
8+
@cabal test
9+
10+
lint: ## Run the code linter (HLint)
11+
@find driver haddock-api haddock-library haddock-test hoogle-test hypsrc-test latex-test \
12+
-name "*.hs" | xargs -P $(PROCS) -I {} hlint --refactor-options="-i" --refactor {}
13+
14+
style: ## Run the code styler (fourmolu and cabal-fmt)
15+
@cabal-fmt -i **/*.cabal
16+
@fourmolu -q --mode inplace driver haddock-api haddock-library
17+
18+
style-check: ## Check the code's style (fourmolu and cabal-fmt)
19+
@cabal-fmt -i **/*.cabal
20+
@fourmolu -q --mode check driver haddock-api haddock-library
21+
22+
style-quick: ## Run the code styler on modified files
23+
@cabal-fmt -i **/*.cabal
24+
@git diff origin --name-only driver haddock-api haddock-library | xargs -P $(PROCS) -I {} fourmolu -q -i {}
25+
26+
tags: ## Generate ctags and etags for the source code (ghc-tags)
27+
@ghc-tags -e -c
28+
29+
help: ## Display this help message
30+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.* ?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
31+
32+
PROCS := $(shell nproc)
33+
34+
.PHONY: all $(MAKECMDGOALS)
35+
36+
.DEFAULT_GOAL := help
37+

0 commit comments

Comments
 (0)