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

Commit

Permalink
Makefile: Rework for use by haddock developers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bgamari committed May 17, 2024
1 parent 074e7d8 commit 151b173
Showing 1 changed file with 37 additions and 15 deletions.
52 changes: 37 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
# http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
# http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
#
# -----------------------------------------------------------------------------

dir = utils/haddock
TOP = ../..
include $(TOP)/mk/sub-makefile.mk
clean: ## Remove compilation artifacts
@cabal clean

repl: ## Start a REPL
@cabal repl

test: ## Run the test suite
@cabal test

lint: ## Run the code linter (HLint)
@find driver haddock-api haddock-library haddock-test hoogle-test hypsrc-test latex-test \
-name "*.hs" | xargs -P $(PROCS) -I {} hlint --refactor-options="-i" --refactor {}

style: ## Run the code styler (fourmolu and cabal-fmt)
@cabal-fmt -i **/*.cabal
@fourmolu -q --mode inplace driver haddock-api haddock-library

style-check: ## Check the code's style (fourmolu and cabal-fmt)
@cabal-fmt -i **/*.cabal
@fourmolu -q --mode check driver haddock-api haddock-library

style-quick: ## Run the code styler on modified files
@cabal-fmt -i **/*.cabal
@git diff origin --name-only driver haddock-api haddock-library | xargs -P $(PROCS) -I {} fourmolu -q -i {}

tags: ## Generate ctags and etags for the source code (ghc-tags)
@ghc-tags -e -c

help: ## Display this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.* ?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

PROCS := $(shell nproc)

.PHONY: all $(MAKECMDGOALS)

.DEFAULT_GOAL := help

0 comments on commit 151b173

Please sign in to comment.