Skip to content

Commit 64a21ca

Browse files
committed
Makefile: add 'make help', trim some useless targets.
1 parent a081859 commit 64a21ca

File tree

1 file changed

+27
-39
lines changed

1 file changed

+27
-39
lines changed

Makefile

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,26 @@ REVISION?=1
2121
# For tasty-bench:
2222
BENCHARGS?=--csv bench_$(TIMESTAMP).csv $(BASELINECMD) --timeout=6 +RTS -T --nonmoving-gc -RTS $(if $(PATTERN),--pattern "$(PATTERN)",)
2323

24-
quick:
24+
# Note: to accept current results of golden tests,
25+
# make test TESTARGS='--accept'
26+
quick: ## build & test with stack, no optimizations
2527
stack install --ghc-options='$(GHCOPTS)' --system-ghc --flag 'pandoc:embed_data_files' --fast --test --test-arguments='-j4 --hide-successes --ansi-tricks=false $(TESTARGS)'
2628

27-
quick-cabal:
29+
quick-cabal: ## build & test with stack, no optimizations
2830
cabal v2-build -j8 --ghc-options '$(GHCOPTS)' --disable-optimization --enable-tests
2931
cabal v2-test --disable-optimization --test-options="--hide-successes --ansi-tricks=false $(TESTARGS)"
3032
echo "Path to built executable:" && cabal exec -- sh -c 'command -v pandoc' | sed -e 's!x/pandoc/build!x/pandoc/noopt/build!'
3133

32-
full-cabal:
33-
cabal v2-configure . --ghc-options '$(GHCOPTS)' --flags '+embed_data_files +trypandoc' --enable-tests --enable-benchmarks
34-
cabal v2-build . --disable-optimization
35-
cabal v2-run test-pandoc --disable-optimization -- --hide-successes --ansi-tricks=false $(TESTARGS)
36-
37-
full:
34+
full: ## build with stack, including benchmarks, trypandoc
3835
stack install --flag 'pandoc:embed_data_files' --flag 'pandoc:trypandoc' --bench --no-run-benchmarks --test --test-arguments='-j4 --hide-successes--ansi-tricks-false' --ghc-options '-Wall -Werror -fno-warn-unused-do-bind -O0 $(GHCOPTS)'
3936

40-
ghci:
37+
ghci: ## start ghci session
4138
stack ghci --flag 'pandoc:embed_data_files'
4239

43-
haddock:
40+
haddock: ## build haddocks
4441
stack haddock
4542

46-
check: check-cabal checkdocs
43+
check: check-cabal checkdocs ## prerelease checks
4744
cabal check # check cabal file
4845
cabal outdated # check cabal dependencies
4946
stack-lint-extra-deps # check that stack.yaml dependencies are up to date
@@ -58,47 +55,34 @@ checkdocs:
5855
@echo "Checking for tabs in manual."
5956
! grep -q -n -e "\t" MANUAL.txt changelog.md
6057

61-
# Note: to accept current results of golden tests,
62-
# make test TESTARGS='--accept'
63-
test:
64-
stack test --flag 'pandoc:embed_data_files' --fast --test-arguments='-j4 --hide-successes --ansi-tricks=false $(TESTARGS)' --ghc-options '$(GHCOPTS)'
65-
66-
ghcid:
58+
ghcid: ## run ghcid/stack
6759
ghcid -c "stack repl --flag 'pandoc:embed_data_files'"
6860

69-
ghcid-test:
61+
ghcid-test: ## run ghcid/stack with tests
7062
ghcid -c "stack repl --ghc-options=-XNoImplicitPrelude --flag 'pandoc:embed_data_files' --ghci-options=-fobject-code pandoc:lib pandoc:test-pandoc"
7163

72-
bench:
64+
bench: ## build and run benchmarks
7365
stack bench \
7466
--ghc-options '$(GHCOPTS)' \
7567
--benchmark-arguments='$(BENCHARGS)' 2>&1 | \
7668
tee "bench_latest.txt"
7769

78-
reformat:
70+
reformat: ## reformat with stylish-haskell
7971
for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done
8072

81-
lint: hlint fix_spacing
73+
lint: hlint fix_spacing ## run linters
8274

83-
hlint:
75+
hlint: ## run hlint
8476
for f in $(SOURCEFILES); do echo $$f; hlint --verbose --refactor --refactor-options='-s -o -' $$f; done
8577

86-
fix_spacing:
87-
# Fix trailing newlines and spaces at ends of lines
78+
fix_spacing: ## Fix trailing newlines and spaces
8879
for f in $(SOURCEFILES); do printf '%s\n' "`cat $$f`" | sed -e 's/ *$$//' > $$f.tmp; mv $$f.tmp $$f; done
8980

90-
changes_github:
81+
changes_github: ## copy this release's changes in gfm
9182
pandoc --filter tools/extract-changes.hs changelog.md -t gfm --wrap=none --template tools/changes_template.html | sed -e 's/\\#/#/g' | pbcopy
9283

93-
dist: man/pandoc.1
94-
cabal sdist
95-
rm -rf "pandoc-${version}"
96-
tar xvzf dist/pandoc-${version}.tar.gz
97-
cd pandoc-${version}
98-
stack setup && stack test && cd .. && rm -rf "pandoc-${version}"
9984

100-
101-
debpkg:
85+
debpkg: ## create linux package
10286
docker run -v `pwd`:/mnt \
10387
-v `pwd`/linux/artifacts:/artifacts \
10488
--user $(id -u):$(id -g) \
@@ -123,27 +107,27 @@ README.md: README.template MANUAL.txt tools/update-readme.lua
123107
pandoc --lua-filter tools/update-readme.lua \
124108
--reference-location=section -t gfm $< -o $@
125109

126-
download_stats:
110+
download_stats: ## print download stats from GitHub releases
127111
curl https://api.github.com/repos/jgm/pandoc/releases | \
128112
jq -r '.[] | .assets | .[] | "\(.download_count)\t\(.name)"'
129113

130-
pandoc-templates:
114+
pandoc-templates: ## update pandoc-templates repo
131115
rm ../pandoc-templates/default.* ; \
132116
cp data/templates/* ../pandoc-templates/ ; \
133117
pushd ../pandoc-templates/ && \
134118
git add * && \
135119
git commit -m "Updated templates for pandoc $(version)" && \
136120
popd
137121

138-
trypandoc:
122+
trypandoc: ## build trypandoc on server
139123
ssh -t macfarlane 'cd src/pandoc && git pull && cabal update && cabal install -ftrypandoc -fembed_data_files --install-method=copy --overwrite-policy=always && cd trypandoc && sudo make install'
140124

141-
update-website:
125+
update-website: ## update website and upload
142126
make -C $(WEBSITE) update
143127
make -C $(WEBSITE)
144128
make -C $(WEBSITE) upload
145129

146-
clean:
130+
clean: ## clean up
147131
stack clean
148132

149133
sdist-files.txt: .FORCE
@@ -152,4 +136,8 @@ sdist-files.txt: .FORCE
152136
git-files.txt: .FORCE
153137
git ls-tree -r --name-only HEAD | grep '^\(test\|data\)\/' | sort > $@
154138

155-
.PHONY: .FORCE deps quick full haddock install clean test bench changes_github dist prof download_stats reformat lint weigh doc/lua-filters.md pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal check
139+
.PHONY: help
140+
help: ## Display this help
141+
@grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-30s %s\n", $$1, $$2}'
142+
143+
.PHONY: .FORCE deps quick haddock install clean test bench changes_github download_stats reformat lint weigh pandoc-templates trypandoc update-website debpkg checkdocs ghcid ghci fix_spacing hlint check check-cabal check

0 commit comments

Comments
 (0)