Revert "Change cabal-plan list-bin to cabal list-bin in Makefile"
[cabal.git] / Makefile
blob99eeb1787268ddfc25fdb35547b195083510d40e
1 .PHONY : all lexer sdpx lib exe doctest
2 .PHONY : phony
4 CABALBUILD := cabal v2-build
5 CABALRUN := cabal v2-run
7 # default rules
9 all : exe lib
11 lib : $(LEXER_HS)
12 $(CABALBUILD) Cabal:libs
14 exe : $(LEXER_HS)
15 $(CABALBUILD) cabal-install:exes
17 # Build library with oldest supported GHC
18 lib-ghc-7.6 :
19 $(CABALBUILD) --project-file=cabal.project.libonly --with-compiler=ghc-7.6.3 Cabal:libs
21 lib-ghc-7.8 :
22 $(CABALBUILD) --project-file=cabal.project.libonly --with-compiler=ghc-7.8.4 Cabal:libs
24 # source generation: Lexer
26 LEXER_HS:=Cabal/src/Distribution/Fields/Lexer.hs
28 lexer : $(LEXER_HS)
30 $(LEXER_HS) : templates/Lexer.x
31 alex --latin1 --ghc -o $@ $^
32 cat -s $@ > Lexer.tmp
33 mv Lexer.tmp $@
35 # source generation: SPDX
37 SPDX_LICENSE_HS:=Cabal/src/Distribution/SPDX/LicenseId.hs
38 SPDX_EXCEPTION_HS:=Cabal/src/Distribution/SPDX/LicenseExceptionId.hs
40 spdx : $(SPDX_LICENSE_HS) $(SPDX_EXCEPTION_HS)
42 SPDX_LICENSE_VERSIONS:=3.0 3.2 3.6 3.9 3.10
44 $(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
45 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)
47 $(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
48 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)
50 # source generation: templates
52 TEMPLATE_MACROS:=Cabal/src/Distribution/Simple/Build/Macros/Z.hs
53 TEMPLATE_PATHS:=Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs
55 templates : phony $(TEMPLATE_MACROS) $(TEMPLATE_PATHS)
57 $(TEMPLATE_MACROS) : templates/cabal_macros.template.h cabal-dev-scripts/src/GenCabalMacros.hs
58 cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-cabal-macros -- $< $@
60 $(TEMPLATE_PATHS) : templates/Paths_pkg.template.hs cabal-dev-scripts/src/GenPathsModule.hs
61 cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-paths-module -- $< $@
63 # generated docs
65 buildinfo-fields-reference : phony
66 cabal build --builddir=dist-newstyle-bi --project-file=cabal.project.buildinfo buildinfo-reference-generator
67 $$(cabal-plan list-bin --builddir=dist-newstyle-bi buildinfo-reference-generator) buildinfo-reference-generator/template.zinza | tee $@
69 # analyse-imports
70 analyse-imports : phony
71 find Cabal/src cabal-install/src -type f -name '*.hs' | xargs cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta analyse-imports --
73 # github actions
74 github-actions : .github/workflows/artifacts.yml
75 github-actions : .github/workflows/quick-jobs.yml
76 github-actions : .github/workflows/bootstrap.yml
77 github-actions : .github/workflows/linux.yml
78 github-actions : .github/workflows/macos.yml
79 github-actions : .github/workflows/windows.yml
81 .github/workflows/%.yml : templates/ci-%.template.yml cabal-dev-scripts/src/GenValidate.hs
82 cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-validate -- $< $@
84 # ghcid
86 ghcid-lib :
87 ghcid -c 'cabal v2-repl Cabal'
89 ghcid-cli :
90 ghcid -c 'cabal v2-repl cabal-install'
92 # doctests (relies on .ghc.environment files)
94 doctest :
95 doctest --fast Cabal/src
97 # This is not run as part of validate.sh (we need hackage-security, which is tricky to get).
98 doctest-cli :
99 doctest -D__DOCTEST__ --fast cabal-install/src cabal-install-solver/src cabal-install-solver/src-assertion
101 # tests
103 check-tests :
104 $(CABALRUN) check-tests -- --cwd Cabal-tests ${TEST}
106 parser-tests :
107 $(CABALRUN) parser-tests -- --cwd Cabal-tests ${TEST}
109 parser-tests-accept :
110 $(CABALRUN) parser-tests -- --cwd Cabal-tests --accept ${TEST}
112 custom-setup-tests :
113 $(CABALRUN) custom-setup-tests --
115 hackage-parsec-tests :
116 $(CABALRUN) hackage-tests -- parsec +RTS -s -qg -I0 -A64M -N${THREADS} -RTS ${TEST}
118 hackage-roundtrip-tests :
119 $(CABALRUN) hackage-tests -- roundtrip +RTS -s -qg -I0 -A64M -N${THREADS} -RTS ${TEST}
121 cabal-install-test:
122 @which cabal-plan
123 $(CABALBUILD) -j3 cabal-tests cabal
124 rm -rf .ghc.environment.*
125 cd cabal-testsuite && `cabal-plan list-bin cabal-tests` --with-cabal=`cabal-plan list-bin cabal` --hide-successes -j3 ${TEST}
127 # hackage-benchmarks (solver)
129 hackage-benchmarks-run:
130 $(CABALBUILD) -j3 hackage-benchmark cabal
131 rm -rf .ghc.environment.*
132 $$(cabal-plan list-bin hackage-benchmark) --cabal1=cabal --cabal2=$$(cabal-plan list-bin cabal) --packages="hakyll servant-auth-server" --print-trials --concurrently
135 # This doesn't run build, as you first need to test with cabal-install-test :)
136 cabal-install-test-accept:
137 @which cabal-plan
138 rm -rf .ghc.environment.*
139 cd cabal-testsuite && `cabal-plan list-bin cabal-tests` --with-cabal=`cabal-plan list-bin cabal` --hide-successes -j3 --accept ${TEST}
141 # Docker validation
143 # Use this carefully, on big machine you can say
145 # make validate-via-docker-all -j4 -O
147 validate-via-docker-all : validate-via-docker-7.6.3
148 validate-via-docker-all : validate-via-docker-7.8.4
149 validate-via-docker-all : validate-via-docker-7.10.3
150 validate-via-docker-all : validate-via-docker-8.0.2
151 validate-via-docker-all : validate-via-docker-8.2.2
152 validate-via-docker-all : validate-via-docker-8.4.4
153 validate-via-docker-all : validate-via-docker-8.6.5
154 validate-via-docker-all : validate-via-docker-8.8.4
155 validate-via-docker-all : validate-via-docker-8.10.4
157 validate-dockerfiles : .docker/validate-8.10.4.dockerfile
158 validate-dockerfiles : .docker/validate-8.8.4.dockerfile
159 validate-dockerfiles : .docker/validate-8.6.5.dockerfile
160 validate-dockerfiles : .docker/validate-8.4.4.dockerfile
161 validate-dockerfiles : .docker/validate-8.2.2.dockerfile
162 validate-dockerfiles : .docker/validate-8.6.5.dockerfile
163 validate-dockerfiles : .docker/validate-7.10.3.dockerfile
164 validate-dockerfiles : .docker/validate-7.8.4.dockerfile
165 validate-dockerfiles : .docker/validate-7.6.3.dockerfile
167 .docker/validate-%.dockerfile : .docker/validate.dockerfile.zinza cabal-dev-scripts/src/GenValidateDockerfile.hs
168 cabal v2-run --builddir=dist-newstyle-meta --project-file=cabal.project.meta gen-validate-dockerfile -- $* $< $@
170 # This is good idea anyway
171 # and we have a test relying on this limit being sufficiently small
172 DOCKERARGS:=--ulimit nofile=1024:1024
174 validate-via-docker-7.6.3:
175 docker build $(DOCKERARGS) -t cabal-validate:7.6.3 -f .docker/validate-7.6.3.dockerfile .
177 validate-via-docker-7.8.4:
178 docker build $(DOCKERARGS) -t cabal-validate:7.8.4 -f .docker/validate-7.8.4.dockerfile .
180 validate-via-docker-7.10.3:
181 docker build $(DOCKERARGS) -t cabal-validate:7.10.3 -f .docker/validate-7.10.3.dockerfile .
183 validate-via-docker-8.0.2:
184 docker build $(DOCKERARGS) -t cabal-validate:8.0.2 -f .docker/validate-8.0.2.dockerfile .
186 validate-via-docker-8.2.2:
187 docker build $(DOCKERARGS) -t cabal-validate:8.2.2 -f .docker/validate-8.2.2.dockerfile .
189 validate-via-docker-8.4.4:
190 docker build $(DOCKERARGS) -t cabal-validate:8.4.4 -f .docker/validate-8.4.4.dockerfile .
192 validate-via-docker-8.6.5:
193 docker build $(DOCKERARGS) -t cabal-validate:8.6.5 -f .docker/validate-8.6.5.dockerfile .
195 validate-via-docker-8.8.4:
196 docker build $(DOCKERARGS) -t cabal-validate:8.8.4 -f .docker/validate-8.8.4.dockerfile .
198 validate-via-docker-8.10.4:
199 docker build $(DOCKERARGS) -t cabal-validate:8.10.4 -f .docker/validate-8.10.4.dockerfile .
201 validate-via-docker-old:
202 docker build $(DOCKERARGS) -t cabal-validate:older -f .docker/validate-old.dockerfile .
204 # Weeder
205 weeder :
206 cabal build all --project-file=cabal.project.weeder
207 weeder | less
209 # tags
210 .PHONY : tags
211 tags :
212 hasktags -b Cabal/src Cabal-described/src cabal-install/src cabal-testsuite/src
214 # boostrapping
215 ##############################################################################
217 bootstrap-plans-linux: phony
218 @if [ $$(uname) != "Linux" ]; then echo "Not Linux"; false; fi
219 cabal v2-build --project=cabal.project.release --with-compiler ghc-8.6.5 --dry-run cabal-install:exe:cabal
220 cp dist-newstyle/cache/plan.json bootstrap/linux-8.6.5.plan.json
221 cabal v2-build --project=cabal.project.release --with-compiler ghc-8.8.4 --dry-run cabal-install:exe:cabal
222 cp dist-newstyle/cache/plan.json bootstrap/linux-8.8.4.plan.json
223 cabal v2-build --project=cabal.project.release --with-compiler ghc-8.10.7 --dry-run cabal-install:exe:cabal
224 cp dist-newstyle/cache/plan.json bootstrap/linux-8.10.7.plan.json
226 bootstrap-jsons-linux: phony
227 @if [ $$(uname) != "Linux" ]; then echo "Not Linux"; false; fi
228 cabal v2-build --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen
229 cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.6.5.plan.json | python3 -m json.tool | tee bootstrap/linux-8.6.5.json
230 cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.8.4.plan.json | python3 -m json.tool | tee bootstrap/linux-8.8.4.json
231 cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.10.7.plan.json | python3 -m json.tool | tee bootstrap/linux-8.10.7.json
233 # documentation
234 ##############################################################################
236 # TODO: when we have sphinx-build2 ?
237 SPHINXCMD:=sphinx-build
238 # Flag -n ("nitpick") warns about broken references
239 # Flag -W turns warnings into errors
240 # Flag --keep-going continues after errors
241 SPHINX_FLAGS:=-n -W --keep-going -E
242 SPHINX_HTML_OUTDIR:=dist-newstyle/doc/users-guide
243 USERGUIDE_STAMP:=$(SPHINX_HTML_OUTDIR)/index.html
245 # do pip install everytime so we have up to date requirements when we build
246 users-guide: .python-sphinx-virtualenv $(USERGUIDE_STAMP)
247 $(USERGUIDE_STAMP) : doc/*.rst
248 mkdir -p $(SPHINX_HTML_OUTDIR)
249 (. ./.python-sphinx-virtualenv/bin/activate && pip install -r doc/requirements.txt && $(SPHINXCMD) $(SPHINX_FLAGS) doc $(SPHINX_HTML_OUTDIR))
251 .python-sphinx-virtualenv:
252 python3 -m venv .python-sphinx-virtualenv
253 (. ./.python-sphinx-virtualenv/bin/activate)