-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (50 loc) · 1.85 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# For the difference between 'all' and 'ci': 'all' is the default run with no arguments. So, as the
# default we will format the code, but not run a "check" of it, which is used in CI to fail the
# running job if code wasn't formatted.
all: setup build-cabal build-stack format
ci: build-cabal build-stack format-check
setup: setup-ghc setup-cabal setup-stack setup-extra-tools
# Note that the ghc-versions for cabal and the stack yamls match which version of ghc they end up
# using. Also note that by use ?= we allow this to be defined with environment variables so CI can
# run a subset of them on different platforms. This is particularly helpful when something is
# unreleased and/or broken upstream. Like not having a proper release for aarch64-darwin or
# something.
GHC_VERSIONS ?= 9.4.5 9.6.3 9.8.1
STACK_YAMLS ?= stack.yaml
.PHONY: setup-ghc
setup-ghc:
# This will prefetch/build the required versions of ghc upfront
.for GHC_VERSION in ${GHC_VERSIONS}
ghcup install ghc ${GHC_VERSION}
.endfor
.PHONY: setup-cabal
setup-cabal:
cabal update
# This will build all the dependencies for the various ghc versions
.for GHC_VERSION in ${GHC_VERSIONS}
cabal build --only-dependencies -w ghc-${GHC_VERSION} --flag ci
.endfor
.PHONY: setup-stack
setup-stack:
stack build --only-dependencies --flag henforcer:ci
.PHONY: setup-extra-tools
setup-extra-tools:
# Note: We don't actually need n versions of formatting/linting tools though, so only get ones with
# the default stack.yaml
stack install fourmolu
.PHONY: build-cabal
build-cabal:
.for GHC_VERSION in ${GHC_VERSIONS}
cabal build -w ghc-${GHC_VERSION} --flag ci
.endfor
.PHONY: build-stack
build-stack:
.for STACK_YAML in ${STACK_YAMLS}
stack --stack-yaml ${STACK_YAML} build --flag henforcer:ci
.endfor
.PHONY: format
format:
fourmolu -i app plugin src
.PHONY: format-check
format-check:
fourmolu -m check app plugin src