git.iko.soy/typeable/pandoc
on a01ba44 help sign in
typeable/pandoc/Makefile
148 lines 5.2 kB history raw
1version?=$(shell grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}')
2pandoc=$(shell find dist -name pandoc -type f -exec ls -t {} \; | head -1)
3SOURCEFILES?=$(shell git ls-tree -r master --name-only | grep "\.hs$$")
4BRANCH?=master
5ARCH=$(shell uname -m)
6DOCKERIMAGE=registry.gitlab.b-data.ch/ghc/ghc4pandoc:8.10.4
7COMMIT=$(shell git rev-parse --short HEAD)
8TIMESTAMP=$(shell date "+%Y%m%d_%H%M")
9LATESTBENCH=$(word 1,$(shell ls -t bench_*.csv 2>/dev/null))
10BASELINE?=$(LATESTBENCH)
11ifeq ($(BASELINE),)
12BASELINECMD=
13else
14BASELINECMD=--baseline $(BASELINE)
15endif
16GHCOPTS=-fdiagnostics-color=always -j4 +RTS -A8m -RTS
17WEBSITE=../../web/pandoc.org
18REVISION?=1
19# For gauge:
20# BENCHARGS?=--small --ci=0.90 --match=pattern $(PATTERN)
21# For tasty-bench:
22BENCHARGS?=--csv bench_$(TIMESTAMP).csv $(BASELINECMD) --timeout=6 +RTS -T -RTS $(if $(PATTERN),--pattern "$(PATTERN)",)
24quick:
25 stack install --ghc-options='$(GHCOPTS)' --install-ghc --flag 'pandoc:embed_data_files' --fast --test --ghc-options='$(GHCOPTS)' --test-arguments='-j4 --hide-successes $(TESTARGS)'
27quick-cabal:
28 cabal new-configure . --ghc-options '$(GHCOPTS)' --disable-optimization --enable-tests
29 cabal new-build -j4 . --disable-optimization
30 cabal new-run test-pandoc --disable-optimization -- --hide-successes $(TESTARGS)
32full-cabal:
33 cabal new-configure . --ghc-options '$(GHCOPTS)' --flags '+embed_data_files +trypandoc' --enable-tests --enable-benchmarks
34 cabal new-build . --disable-optimization
35 cabal new-run test-pandoc --disable-optimization -- --hide-successes $(TESTARGS)
37full:
38 stack install --flag 'pandoc:embed_data_files' --flag 'pandoc:trypandoc' --bench --no-run-benchmarks --test --test-arguments='-j4 --hide-successes' --ghc-options '-Wall -Werror -fno-warn-unused-do-bind -O0 $(GHCOPTS)'
40ghci:
41 stack ghci --flag 'pandoc:embed_data_files'
43haddock:
44 stack haddock
46# Note: to accept current results of golden tests,
47# make test TESTARGS='--accept'
48test:
49 stack test --flag 'pandoc:embed_data_files' --fast --test-arguments='-j4 --hide-successes $(TESTARGS)' --ghc-options '$(GHCOPTS)'
51ghcid:
52 ghcid -c "stack repl --flag 'pandoc:embed_data_files'"
54ghcid-test:
55 ghcid -c "stack repl --ghc-options=-XNoImplicitPrelude --flag 'pandoc:embed_data_files' --ghci-options=-fobject-code pandoc:lib pandoc:test-pandoc"
57bench:
58 stack bench \
59 --ghc-options '$(GHCOPTS)' \
60 --benchmark-arguments='$(BENCHARGS)' 2>&1 | \
61 tee "bench_latest.txt"
63reformat:
64 for f in $(SOURCEFILES); do echo $$f; stylish-haskell -i $$f ; done
66lint: hlint fix_spacing
68hlint:
69 for f in $(SOURCEFILES); do echo $$f; hlint --verbose --refactor --refactor-options='-s -o -' $$f; done
71fix_spacing:
72 # Fix trailing newlines and spaces at ends of lines
73 for f in $(SOURCEFILES); do printf '%s\n' "`cat $$f`" | sed -e 's/ *$$//' > $$f.tmp; mv $$f.tmp $$f; done
75changes_github:
76 pandoc --filter tools/extract-changes.hs changelog.md -t gfm --wrap=none --template tools/changes_template.html | sed -e 's/\\#/#/g' | pbcopy
78dist: man/pandoc.1
79 cabal sdist
80 rm -rf "pandoc-${version}"
81 tar xvzf dist/pandoc-${version}.tar.gz
82 cd pandoc-${version}
83 stack setup && stack test && cd .. && rm -rf "pandoc-${version}"
85check: checkdocs check-cabal
87checkdocs:
88 ! grep -q -n -e "\t" MANUAL.txt changelog.md
90debpkg: man/pandoc.1
91 docker run -v `pwd`:/mnt \
92 -v `pwd`/linux/artifacts:/artifacts \
93 --user $(id -u):$(id -g) \
94 -e REVISION=$(REVISION) \
95 -w /mnt \
96 --memory=0 \
97 --rm \
98 $(DOCKERIMAGE) \
99 bash \
100 /mnt/linux/make_artifacts.sh 2>&1 > docker.log
102man/pandoc.1: MANUAL.txt man/pandoc.1.before man/pandoc.1.after
103 pandoc $< -f markdown -t man -s \
104 --lua-filter man/manfilter.lua \
105 --include-before-body man/pandoc.1.before \
106 --include-after-body man/pandoc.1.after \
107 --metadata author="" \
108 --variable footer="pandoc $(version)" \
109 -o $@
111README.md: README.template MANUAL.txt tools/update-readme.lua
112 pandoc --lua-filter tools/update-readme.lua \
113 --reference-location=section -t gfm $< -o $@
115download_stats:
116 curl https://api.github.com/repos/jgm/pandoc/releases | \
117 jq -r '.[] | .assets | .[] | "\(.download_count)\t\(.name)"'
119pandoc-templates:
120 rm ../pandoc-templates/default.* ; \
121 cp data/templates/* ../pandoc-templates/ ; \
122 pushd ../pandoc-templates/ && \
123 git add * && \
124 git commit -m "Updated templates for pandoc $(version)" && \
125 popd
127trypandoc:
128 ssh -t macfarlane 'cd src/pandoc && git pull && stack install --flag pandoc:trypandoc --flag pandoc:embed_data_files && cd trypandoc && sudo make install'
130update-website:
131 make -C $(WEBSITE) update
132 make -C $(WEBSITE)
133 make -C $(WEBSITE) upload
135clean:
136 stack clean
138check-cabal: git-files.txt sdist-files.txt
139 echo "Checking to see if all committed test/data files are in sdist."
140 diff -u $^
142sdist-files.txt: .FORCE
143 cabal sdist --list-only | sed 's/\.\///' | grep '^\(test\|data\)\/' | sort > $@
145git-files.txt: .FORCE
146 git ls-tree -r --name-only HEAD | grep '^\(test\|data\)\/' | sort > $@
148.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