1 .PHONY
: all lexer sdpx lib exe doctest
4 CABALBUILD
:= cabal build
6 DOCTEST
:= cabal repl
--with-ghc
=doctest
--repl-options
="-w" --project-file
=cabal.project.doctest
13 $(CABALBUILD
) Cabal
:libs
16 $(CABALBUILD
) cabal-install
:exes
18 init
: ## Set up git hooks and ignored revisions
19 @git config core.hooksPath .githooks
22 style
: ## Run the code styler
23 @fourmolu
-q
-i Cabal Cabal-syntax cabal-install
25 style-modified
: ## Run the code styler on modified files
26 @git ls-files
--modified Cabal Cabal-syntax cabal-install \
27 | grep
'.hs$$' | xargs
-P
$(PROCS
) -I
{} fourmolu
-q
-i
{}
29 style-commit
: ## Run the code styler on the previous commit
30 @git diff
--name-only HEAD
$(COMMIT
) Cabal Cabal-syntax cabal-install \
31 | grep
'.hs$$' | xargs
-P
$(PROCS
) -I
{} fourmolu
-q
-i
{}
33 # source generation: SPDX
35 SPDX_LICENSE_HS
:=Cabal-syntax
/src
/Distribution
/SPDX
/LicenseId.hs
36 SPDX_EXCEPTION_HS
:=Cabal-syntax
/src
/Distribution
/SPDX
/LicenseExceptionId.hs
38 spdx
: $(SPDX_LICENSE_HS
) $(SPDX_EXCEPTION_HS
)
40 SPDX_LICENSE_VERSIONS
:=3.0 3.2 3.6 3.9 3.10 3.16
42 $(SPDX_LICENSE_HS
) : templates
/SPDX.LicenseId.template.hs cabal-dev-scripts
/src
/GenUtils.hs cabal-dev-scripts
/src
/GenSPDX.hs license-list-data
/licenses-3.0.json license-list-data
/licenses-3.2.json
43 cabal run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta gen-spdx
-- templates
/SPDX.LicenseId.template.hs
$(SPDX_LICENSE_VERSIONS
:%=license-list-data
/licenses-
%.json
) $(SPDX_LICENSE_HS
)
45 $(SPDX_EXCEPTION_HS
) : templates
/SPDX.LicenseExceptionId.template.hs cabal-dev-scripts
/src
/GenUtils.hs cabal-dev-scripts
/src
/GenSPDXExc.hs license-list-data
/exceptions-3.0.json license-list-data
/exceptions-3.2.json
46 cabal run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta gen-spdx-exc
-- templates
/SPDX.LicenseExceptionId.template.hs
$(SPDX_LICENSE_VERSIONS
:%=license-list-data
/exceptions-
%.json
) $(SPDX_EXCEPTION_HS
)
48 # source generation: templates
50 TEMPLATE_MACROS
:=Cabal
/src
/Distribution
/Simple
/Build
/Macros
/Z.hs
51 TEMPLATE_PATHS
:=Cabal
/src
/Distribution
/Simple
/Build
/PathsModule
/Z.hs
53 templates
: phony
$(TEMPLATE_MACROS
) $(TEMPLATE_PATHS
)
55 $(TEMPLATE_MACROS
) : templates
/cabal_macros.template.h cabal-dev-scripts
/src
/GenCabalMacros.hs
56 cabal run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta gen-cabal-macros
-- $< $@
58 $(TEMPLATE_PATHS
) : templates
/Paths_pkg.template.hs cabal-dev-scripts
/src
/GenPathsModule.hs
59 cabal run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta gen-paths-module
-- $< $@
62 # Use cabal build before cabal run to avoid output of the build on stdout when running
63 doc
/buildinfo-fields-reference.rst
: \
64 $(wildcard Cabal-syntax
/src
/*/*.hs Cabal-syntax
/src
/*/*/*.hs Cabal-syntax
/src
/*/*/*/*.hs
) \
65 $(wildcard Cabal-described
/src
/Distribution
/Described.hs Cabal-described
/src
/Distribution
/Utils
/*.hs
) \
66 buildinfo-reference-generator
/src
/Main.hs \
67 buildinfo-reference-generator
/template.zinza
68 cabal build
--project-file
=cabal.project.buildinfo buildinfo-reference-generator
69 cabal run
--project-file
=cabal.project.buildinfo buildinfo-reference-generator buildinfo-reference-generator
/template.zinza | tee
$@
70 git diff
--exit-code
$@
73 analyse-imports
: phony
74 find Cabal-syntax
/src Cabal
/src cabal-install
/src
-type f
-name
'*.hs' | xargs cabal run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta analyse-imports
--
79 ghcid
-c
'cabal repl Cabal'
82 ghcid
-c
'cabal repl cabal-install'
84 # Artem, 2023-02-03, https://github.com/haskell/cabal/issues/8504
85 # The new and prefered way to call the doctest tool (as of now) is based on cabal repl --with-ghc=doctest.
86 # The call below reflects the current documentation of the doctest tool except one caveat,
87 # which is https://github.com/haskell/cabal/issues/6859, i.e. we have to hide allow-newer in our project
88 # file from cabal/doctest. This is easy: we just select a project file with no allow-newer (e.g. cabal.project.libonly).
90 # TODO: Cabal-described should be added here but its doctests currently broken, see:
91 # https://github.com/haskell/cabal/issues/8734
92 # Just as well, cabal-install(-solver) doctests (the target below) bitrotted and need some care.
94 $(DOCTEST
) Cabal-syntax
95 $(DOCTEST
) Cabal-described
96 $(DOCTEST
) --build-depends
=QuickCheck Cabal
97 $(DOCTEST
) cabal-install
99 # This is not run as part of validate.sh (we need hackage-security, which is tricky to get).
101 doctest
-D__DOCTEST__
--fast cabal-install
/src cabal-install-solver
/src cabal-install-solver
/src-assertion
104 cabal
install doctest
--overwrite-policy
=always
--ignore-project
109 $(CABALRUN
) check-tests
-- --cwd Cabal-tests
${TEST}
112 $(CABALRUN
) parser-tests
-- --cwd Cabal-tests
${TEST}
114 parser-tests-accept
:
115 $(CABALRUN
) parser-tests
-- --cwd Cabal-tests
--accept
${TEST}
118 $(CABALRUN
) custom-setup-tests
--
120 hackage-parsec-tests
:
121 $(CABALRUN
) hackage-tests
-- parsec
+RTS
-s
-qg
-I0
-A64M
-N
${THREADS} -RTS
${TEST}
123 hackage-roundtrip-tests
:
124 $(CABALRUN
) hackage-tests
-- roundtrip
+RTS
-s
-qg
-I0
-A64M
-N
${THREADS} -RTS
${TEST}
127 $(CABALBUILD
) -j3 cabal-tests cabal
128 rm -rf .ghc.environment.
*
129 cd cabal-testsuite
&& `cabal list-bin cabal-tests` --with-cabal
=`cabal list-bin cabal` --hide-successes
-j3
${TEST}
131 # hackage-benchmarks (solver)
133 hackage-benchmarks-run
:
134 $(CABALBUILD
) -j3 hackage-benchmark cabal
135 rm -rf .ghc.environment.
*
136 $$(cabal list-bin hackage-benchmark
) --cabal1
=cabal
--cabal2
=$$(cabal list-bin cabal
) --packages
="hakyll servant-auth-server" --print-trials
--concurrently
139 # This doesn't run build, as you first need to test with cabal-install-test :)
140 cabal-install-test-accept
:
141 rm -rf .ghc.environment.
*
142 cd cabal-testsuite
&& `cabal list-bin cabal-tests` --with-cabal
=`cabal list-bin cabal` --hide-successes
-j3
--accept
${TEST}
146 # Use this carefully, on big machine you can say
148 # make validate-via-docker-all -j4 -O
150 validate-via-docker-all
: validate-via-docker-8.2
.2
151 validate-via-docker-all
: validate-via-docker-8.4
.4
152 validate-via-docker-all
: validate-via-docker-8.6
.5
153 validate-via-docker-all
: validate-via-docker-8.8
.4
154 validate-via-docker-all
: validate-via-docker-8.10
.4
156 validate-dockerfiles
: .docker
/validate-8.10
.4.dockerfile
157 validate-dockerfiles
: .docker
/validate-8.8
.4.dockerfile
158 validate-dockerfiles
: .docker
/validate-8.6
.5.dockerfile
159 validate-dockerfiles
: .docker
/validate-8.4
.4.dockerfile
160 validate-dockerfiles
: .docker
/validate-8.2
.2.dockerfile
162 .docker
/validate-
%.dockerfile
: .docker
/validate.dockerfile.zinza cabal-dev-scripts
/src
/GenValidateDockerfile.hs
163 cabal run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta gen-validate-dockerfile
-- $* $< $@
165 # This is good idea anyway
166 # and we have a test relying on this limit being sufficiently small
167 DOCKERARGS
:=--ulimit nofile
=1024:1024
169 validate-via-docker-8.2
.2:
170 docker build
$(DOCKERARGS
) -t cabal-validate
:8.2.2 -f .docker
/validate-8.2
.2.dockerfile .
172 validate-via-docker-8.4
.4:
173 docker build
$(DOCKERARGS
) -t cabal-validate
:8.4.4 -f .docker
/validate-8.4
.4.dockerfile .
175 validate-via-docker-8.6
.5:
176 docker build
$(DOCKERARGS
) -t cabal-validate
:8.6.5 -f .docker
/validate-8.6
.5.dockerfile .
178 validate-via-docker-8.8
.4:
179 docker build
$(DOCKERARGS
) -t cabal-validate
:8.8.4 -f .docker
/validate-8.8
.4.dockerfile .
181 validate-via-docker-8.10
.4:
182 docker build
$(DOCKERARGS
) -t cabal-validate
:8.10.4 -f .docker
/validate-8.10
.4.dockerfile .
184 validate-via-docker-old
:
185 docker build
$(DOCKERARGS
) -t cabal-validate
:older
-f .docker
/validate-old.dockerfile .
189 cabal build
all --project-file
=cabal.project.weeder
195 hasktags
-b Cabal-syntax
/src Cabal
/src Cabal-described
/src cabal-install
/src cabal-testsuite
/src
198 ##############################################################################
200 bootstrap-json-
%: phony
201 cabal build
--project
=cabal.project.release
--with-compiler
=ghc-
$* --dry-run cabal-install
:exe
:cabal
202 cp dist-newstyle
/cache
/plan.json bootstrap
/linux-
$*.plan.json
203 @
# -v0 to avoid build output on stdout
204 cd bootstrap
&& cabal run
-v0 cabal-bootstrap-gen
-- linux-
$*.plan.json \
205 | python3
-m json.tool
> linux-
$*.json
207 BOOTSTRAP_GHC_VERSIONS
:= 8.10.7 9.0.2 9.2.7 9.4.4
209 bootstrap-jsons
: $(BOOTSTRAP_GHC_VERSIONS
:%=bootstrap-json-
%)
212 ##############################################################################
216 $(MAKE
) -C doc users-guide
218 .PHONY
: users-guide-requirements
219 users-guide-requirements
:
220 $(MAKE
) -C doc users-guide-requirements
222 ifeq ($(shell uname
), Darwin
)
223 PROCS
:= $(shell sysctl
-n hw.logicalcpu
)
225 PROCS
:= $(shell nproc
)