1 .PHONY
: all lexer sdpx lib exe doctest
4 CABALBUILD
:= cabal v2-build
5 CABALRUN
:= cabal v2-run
12 $(CABALBUILD
) Cabal
:libs
15 $(CABALBUILD
) cabal-install
:exes
17 # source generation: Lexer
19 LEXER_HS
:=Cabal-syntax
/src
/Distribution
/Fields
/Lexer.hs
23 $(LEXER_HS
) : templates
/Lexer.x
24 alex
--latin1
--ghc
-o
$@
$^
28 # source generation: SPDX
30 SPDX_LICENSE_HS
:=Cabal-syntax
/src
/Distribution
/SPDX
/LicenseId.hs
31 SPDX_EXCEPTION_HS
:=Cabal-syntax
/src
/Distribution
/SPDX
/LicenseExceptionId.hs
33 spdx
: $(SPDX_LICENSE_HS
) $(SPDX_EXCEPTION_HS
)
35 SPDX_LICENSE_VERSIONS
:=3.0 3.2 3.6 3.9 3.10 3.16
37 $(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
38 cabal v2-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
)
40 $(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
41 cabal v2-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
)
43 # source generation: templates
45 TEMPLATE_MACROS
:=Cabal
/src
/Distribution
/Simple
/Build
/Macros
/Z.hs
46 TEMPLATE_PATHS
:=Cabal
/src
/Distribution
/Simple
/Build
/PathsModule
/Z.hs
48 templates
: phony
$(TEMPLATE_MACROS
) $(TEMPLATE_PATHS
)
50 $(TEMPLATE_MACROS
) : templates
/cabal_macros.template.h cabal-dev-scripts
/src
/GenCabalMacros.hs
51 cabal v2-run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta gen-cabal-macros
-- $< $@
53 $(TEMPLATE_PATHS
) : templates
/Paths_pkg.template.hs cabal-dev-scripts
/src
/GenPathsModule.hs
54 cabal v2-run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta gen-paths-module
-- $< $@
58 buildinfo-fields-reference
: phony
59 cabal build
--builddir
=dist-newstyle-bi
--project-file
=cabal.project.buildinfo buildinfo-reference-generator
60 $$(cabal-plan list-bin
--builddir
=dist-newstyle-bi buildinfo-reference-generator
) buildinfo-reference-generator
/template.zinza | tee
$@
63 analyse-imports
: phony
64 find Cabal-syntax
/src Cabal
/src cabal-install
/src
-type f
-name
'*.hs' | xargs cabal v2-run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta analyse-imports
--
69 ghcid
-c
'cabal v2-repl Cabal'
72 ghcid
-c
'cabal v2-repl cabal-install'
74 # doctests (relies on .ghc.environment files)
77 doctest
--fast Cabal-syntax
/src Cabal
/src
79 # This is not run as part of validate.sh (we need hackage-security, which is tricky to get).
81 doctest
-D__DOCTEST__
--fast cabal-install
/src cabal-install-solver
/src cabal-install-solver
/src-assertion
86 $(CABALRUN
) check-tests
-- --cwd Cabal-tests
${TEST}
89 $(CABALRUN
) parser-tests
-- --cwd Cabal-tests
${TEST}
92 $(CABALRUN
) parser-tests
-- --cwd Cabal-tests
--accept
${TEST}
95 $(CABALRUN
) custom-setup-tests
--
97 hackage-parsec-tests
:
98 $(CABALRUN
) hackage-tests
-- parsec
+RTS
-s
-qg
-I0
-A64M
-N
${THREADS} -RTS
${TEST}
100 hackage-roundtrip-tests
:
101 $(CABALRUN
) hackage-tests
-- roundtrip
+RTS
-s
-qg
-I0
-A64M
-N
${THREADS} -RTS
${TEST}
105 $(CABALBUILD
) -j3 cabal-tests cabal
106 rm -rf .ghc.environment.
*
107 cd cabal-testsuite
&& `cabal-plan list-bin cabal-tests` --with-cabal
=`cabal-plan list-bin cabal` --hide-successes
-j3
${TEST}
109 # hackage-benchmarks (solver)
111 hackage-benchmarks-run
:
112 $(CABALBUILD
) -j3 hackage-benchmark cabal
113 rm -rf .ghc.environment.
*
114 $$(cabal-plan list-bin hackage-benchmark
) --cabal1
=cabal
--cabal2
=$$(cabal-plan list-bin cabal
) --packages
="hakyll servant-auth-server" --print-trials
--concurrently
117 # This doesn't run build, as you first need to test with cabal-install-test :)
118 cabal-install-test-accept
:
120 rm -rf .ghc.environment.
*
121 cd cabal-testsuite
&& `cabal-plan list-bin cabal-tests` --with-cabal
=`cabal-plan list-bin cabal` --hide-successes
-j3
--accept
${TEST}
125 # Use this carefully, on big machine you can say
127 # make validate-via-docker-all -j4 -O
129 validate-via-docker-all
: validate-via-docker-8.0
.2
130 validate-via-docker-all
: validate-via-docker-8.2
.2
131 validate-via-docker-all
: validate-via-docker-8.4
.4
132 validate-via-docker-all
: validate-via-docker-8.6
.5
133 validate-via-docker-all
: validate-via-docker-8.8
.4
134 validate-via-docker-all
: validate-via-docker-8.10
.4
136 validate-dockerfiles
: .docker
/validate-8.10
.4.dockerfile
137 validate-dockerfiles
: .docker
/validate-8.8
.4.dockerfile
138 validate-dockerfiles
: .docker
/validate-8.6
.5.dockerfile
139 validate-dockerfiles
: .docker
/validate-8.4
.4.dockerfile
140 validate-dockerfiles
: .docker
/validate-8.2
.2.dockerfile
141 validate-dockerfiles
: .docker
/validate-8.6
.5.dockerfile
143 .docker
/validate-
%.dockerfile
: .docker
/validate.dockerfile.zinza cabal-dev-scripts
/src
/GenValidateDockerfile.hs
144 cabal v2-run
--builddir
=dist-newstyle-meta
--project-file
=cabal.project.meta gen-validate-dockerfile
-- $* $< $@
146 # This is good idea anyway
147 # and we have a test relying on this limit being sufficiently small
148 DOCKERARGS
:=--ulimit nofile
=1024:1024
150 validate-via-docker-8.0
.2:
151 docker build
$(DOCKERARGS
) -t cabal-validate
:8.0.2 -f .docker
/validate-8.0
.2.dockerfile .
153 validate-via-docker-8.2
.2:
154 docker build
$(DOCKERARGS
) -t cabal-validate
:8.2.2 -f .docker
/validate-8.2
.2.dockerfile .
156 validate-via-docker-8.4
.4:
157 docker build
$(DOCKERARGS
) -t cabal-validate
:8.4.4 -f .docker
/validate-8.4
.4.dockerfile .
159 validate-via-docker-8.6
.5:
160 docker build
$(DOCKERARGS
) -t cabal-validate
:8.6.5 -f .docker
/validate-8.6
.5.dockerfile .
162 validate-via-docker-8.8
.4:
163 docker build
$(DOCKERARGS
) -t cabal-validate
:8.8.4 -f .docker
/validate-8.8
.4.dockerfile .
165 validate-via-docker-8.10
.4:
166 docker build
$(DOCKERARGS
) -t cabal-validate
:8.10.4 -f .docker
/validate-8.10
.4.dockerfile .
168 validate-via-docker-old
:
169 docker build
$(DOCKERARGS
) -t cabal-validate
:older
-f .docker
/validate-old.dockerfile .
173 cabal build
all --project-file
=cabal.project.weeder
179 hasktags
-b Cabal-syntax
/src Cabal
/src Cabal-described
/src cabal-install
/src cabal-testsuite
/src
182 ##############################################################################
184 bootstrap-json-
%: phony
185 cabal v2-build
--project
=cabal.project.release
--with-compiler
=ghc-
$* --dry-run cabal-install
:exe
:cabal
186 cp dist-newstyle
/cache
/plan.json bootstrap
/linux-
$*.plan.json
187 @
# -v0 to avoid build output on stdout
188 cd bootstrap
&& cabal v2-run
-v0 cabal-bootstrap-gen
-- linux-
$*.plan.json \
189 | python3
-m json.tool
> linux-
$*.json
191 bootstrap-jsons
: bootstrap-json-8.6
.5 bootstrap-json-8.8
.4 bootstrap-json-8.10
.7
194 ##############################################################################
196 # TODO: when we have sphinx-build2 ?
197 SPHINXCMD
:=sphinx-build
198 # Flag -n ("nitpick") warns about broken references
199 # Flag -W turns warnings into errors
200 # Flag --keep-going continues after errors
201 SPHINX_FLAGS
:=-n
-W
--keep-going
-E
202 SPHINX_HTML_OUTDIR
:=dist-newstyle
/doc
/users-guide
203 USERGUIDE_STAMP
:=$(SPHINX_HTML_OUTDIR
)/index.html
205 # do pip install every time so we have up to date requirements when we build
206 users-guide
: .python-sphinx-virtualenv
$(USERGUIDE_STAMP
)
207 $(USERGUIDE_STAMP
) : doc
/*.rst
208 mkdir
-p
$(SPHINX_HTML_OUTDIR
)
209 (. .
/.python-sphinx-virtualenv
/bin
/activate
&& pip
install -r doc
/requirements.txt
&& $(SPHINXCMD
) $(SPHINX_FLAGS
) doc
$(SPHINX_HTML_OUTDIR
))
211 .python-sphinx-virtualenv
:
212 python3
-m venv .python-sphinx-virtualenv
213 (. .
/.python-sphinx-virtualenv
/bin
/activate
)
215 # This goal is intended for manual invocation, always rebuilds.
216 .PHONY
: users-guide-requirements
217 users-guide-requirements
: doc
/requirements.txt
219 .PHONY
: doc
/requirements.txt
220 doc
/requirements.txt
: .python-sphinx-virtualenv
221 . .python-sphinx-virtualenv
/bin
/activate \
222 && make
-C doc build-and-check-requirements