2009-01-25 12:00:57 +03:00
|
|
|
# hledger project makefile
|
2008-12-10 21:43:14 +03:00
|
|
|
|
2009-12-04 00:11:22 +03:00
|
|
|
# optional features described in MANUAL, comment out if you don't have the libs
|
2010-03-10 22:48:46 +03:00
|
|
|
OPTFLAGS= #-DCHART -DVTY -DWEB
|
2010-02-16 06:39:19 +03:00
|
|
|
#OPTFLAGS=-DCHART -DVTY -DWEBHAPPSTACK
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2009-05-29 23:26:09 +04:00
|
|
|
# command to run during "make ci"
|
|
|
|
CICMD=test
|
2009-06-04 05:33:31 +04:00
|
|
|
CICMD=web --debug -BE
|
2009-05-29 23:26:09 +04:00
|
|
|
|
2009-06-04 05:33:31 +04:00
|
|
|
# command to run during "make prof/heap"
|
2009-05-29 23:26:09 +04:00
|
|
|
PROFCMD=-f 1000x1000x10.ledger balance
|
|
|
|
|
2009-06-04 05:33:31 +04:00
|
|
|
# command to run during "make coverage"
|
|
|
|
COVCMD=test
|
|
|
|
|
2009-12-12 05:55:59 +03:00
|
|
|
# executables to run during "make benchmark". They should be on the path
|
|
|
|
# or in the current directory. hledger executables should generally be the
|
|
|
|
# standard cabal builds, also constrained to parsec 2 for now.
|
2009-12-12 05:35:09 +03:00
|
|
|
BENCHEXES=hledger-0.6 hledger-0.7 ledger-3pre
|
2009-06-03 00:37:34 +04:00
|
|
|
|
2010-02-13 23:21:08 +03:00
|
|
|
# misc. tools
|
|
|
|
PANDOC=pandoc
|
|
|
|
RST2HTML=rst2html
|
|
|
|
RST2HTML=/opt/local/bin/rst2html.py
|
|
|
|
VIEWHTML=open
|
|
|
|
VIEWPS=open
|
|
|
|
VIEWPDF=open
|
|
|
|
PRINT=lpr
|
2009-05-29 23:49:11 +04:00
|
|
|
|
2009-09-23 18:49:04 +04:00
|
|
|
SOURCEFILES:= \
|
|
|
|
hledger.hs \
|
|
|
|
[A-Z]*hs \
|
|
|
|
Commands/[A-Z]*hs \
|
|
|
|
Ledger/[A-Z]*hs
|
2009-12-04 00:11:22 +03:00
|
|
|
DOCFILES:=README README2 MANUAL NEWS CONTRIBUTORS SCREENSHOTS
|
2009-06-05 13:48:15 +04:00
|
|
|
BINARYFILENAME=`runhaskell ./hledger.hs --binary-filename`
|
2009-06-03 00:37:34 +04:00
|
|
|
PATCHLEVEL:=$(shell expr `darcs changes --count --from-tag=\\\\\.` - 1)
|
2009-06-05 13:42:44 +04:00
|
|
|
WARNINGS:=-W -fwarn-tabs #-fwarn-orphans -fwarn-simple-patterns -fwarn-monomorphism-restriction -fwarn-name-shadowing
|
2009-12-19 04:19:01 +03:00
|
|
|
DEFINEFLAGS:=-DMAKE -DPATCHLEVEL=$(PATCHLEVEL) $(OPTFLAGS)
|
|
|
|
BUILDFLAGS:=$(DEFINEFLAGS) $(WARNINGS)
|
2009-06-13 22:21:56 +04:00
|
|
|
TIME:=$(shell date +"%Y%m%d%H%M")
|
2009-06-03 00:37:34 +04:00
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
default: tag hledger
|
|
|
|
|
|
|
|
######################################################################
|
2009-06-04 05:33:31 +04:00
|
|
|
# BUILDING
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2009-06-22 23:52:58 +04:00
|
|
|
# build the standard cabal binary
|
|
|
|
hledgercabal:
|
2009-11-28 18:37:56 +03:00
|
|
|
cabal configure -fweb -fvty && cabal build
|
2009-06-22 23:52:58 +04:00
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# build the standard developer's binary, quickly
|
|
|
|
hledger: setversion
|
|
|
|
ghc --make hledger.hs -o hledger $(BUILDFLAGS) # -O
|
|
|
|
|
2009-06-05 15:15:32 +04:00
|
|
|
hledgernowarnings: setversion
|
|
|
|
ghc --make hledger.hs -o hledger $(BUILDFLAGS) -Werror -v0
|
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# build the profiling-enabled binary. You may need to cabal install
|
|
|
|
# --reinstall -p some libs.
|
|
|
|
hledgerp: setversion
|
2009-06-04 05:33:31 +04:00
|
|
|
ghc --make hledger.hs -prof -auto-all -o hledgerp $(BUILDFLAGS)
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2009-06-05 13:48:15 +04:00
|
|
|
# build the coverage-enabled binary. coverage-enabled .o files are kept
|
|
|
|
# separate to avoid contamination.
|
2009-05-29 23:49:11 +04:00
|
|
|
hledgercov: setversion
|
2009-06-05 13:48:15 +04:00
|
|
|
ghc --make hledger.hs -fhpc -o hledgercov -outputdir .coverageobjs $(BUILDFLAGS)
|
2009-05-29 23:49:11 +04:00
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# build the fastest binary we can
|
|
|
|
hledgeropt: setversion
|
2009-06-03 00:37:34 +04:00
|
|
|
ghc --make hledger.hs -o hledgeropt $(BUILDFLAGS) -O2 # -fvia-C # -fexcess-precision -optc-O3 -optc-ffast-math
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2009-06-05 03:16:06 +04:00
|
|
|
# build a deployable binary for mac, one which uses only standard osx libs
|
2009-12-12 18:58:52 +03:00
|
|
|
# use some trickery to link without gmp lib
|
2009-06-05 03:16:06 +04:00
|
|
|
hledgermac: setversion
|
2009-12-12 18:58:52 +03:00
|
|
|
ghc -c --make hledger.hs -o $(BINARYFILENAME) $(BUILDFLAGS) -O2 -optl-L/usr/lib
|
2009-06-05 03:16:06 +04:00
|
|
|
sudo port deactivate gmp
|
2009-12-12 18:58:52 +03:00
|
|
|
-PATH=tools:$(PATH) ghc --make hledger.hs -o $(BINARYFILENAME) $(BUILDFLAGS) -O2 -optl-L/usr/lib
|
2009-06-05 03:16:06 +04:00
|
|
|
sudo port activate gmp
|
2009-06-05 06:51:02 +04:00
|
|
|
@echo Please check the build looks portable:
|
2009-06-05 06:07:38 +04:00
|
|
|
otool -L $(BINARYFILENAME)
|
2009-06-05 03:16:06 +04:00
|
|
|
|
|
|
|
# build a deployable binary for gnu/linux, statically linked
|
|
|
|
hledgerlinux: setversion
|
2009-06-05 06:51:02 +04:00
|
|
|
ghc --make hledger.hs -o $(BINARYFILENAME) $(BUILDFLAGS) -O2 -static -optl-static -optl-pthread
|
|
|
|
@echo Please check the build looks portable:
|
2009-06-05 10:23:22 +04:00
|
|
|
-ldd $(BINARYFILENAME)
|
2009-06-05 03:16:06 +04:00
|
|
|
|
2009-06-05 04:55:20 +04:00
|
|
|
# build a deployable binary for windows, using cygwin presumably
|
|
|
|
# hledgerwin: setversion
|
|
|
|
# ghc --make hledger.hs -o hledgerlinux $(BUILDFLAGS) -O2 -static -optl-static -optl-pthread
|
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# "continuous integration" testing - auto-recompile and run hledger test
|
|
|
|
# (or some other command) whenever a module changes. sp is from
|
|
|
|
# searchpath.org , you might need the patched version from
|
|
|
|
# http://joyful.com/repos/searchpath .
|
2009-02-27 05:55:54 +03:00
|
|
|
continuous ci: setversion
|
2009-12-11 00:34:08 +03:00
|
|
|
sp --no-exts --no-default-map -o hledger ghc --make hledger.hs $(BUILDFLAGS) --run $(CICMD)
|
2008-10-17 20:59:05 +04:00
|
|
|
|
2010-02-13 23:21:08 +03:00
|
|
|
# fix permissions (eg after darcs get)
|
|
|
|
fixperms:
|
|
|
|
chmod +x tools/*
|
|
|
|
|
2009-07-15 01:51:10 +04:00
|
|
|
# build the standalone unit test runner. Requires test-framework, which
|
|
|
|
# may not work on windows.
|
2009-06-28 07:17:02 +04:00
|
|
|
tools/unittest: tools/unittest.hs
|
|
|
|
ghc --make -threaded -O2 tools/unittest.hs
|
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# build the doctest runner
|
|
|
|
tools/doctest: tools/doctest.hs
|
|
|
|
ghc --make tools/doctest.hs
|
|
|
|
|
2009-06-28 07:17:02 +04:00
|
|
|
# build the benchmark runner. Requires tabular.
|
|
|
|
tools/bench: tools/bench.hs
|
|
|
|
ghc --make tools/bench.hs
|
2009-06-27 12:15:00 +04:00
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# build the generateledger tool
|
2009-05-30 00:28:55 +04:00
|
|
|
tools/generateledger: tools/generateledger.hs
|
2009-05-29 12:29:04 +04:00
|
|
|
ghc --make tools/generateledger.hs
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# TESTING
|
|
|
|
|
2009-06-28 07:17:02 +04:00
|
|
|
test: codetest
|
|
|
|
|
2009-06-05 15:15:32 +04:00
|
|
|
# quick code tests - run all the time
|
2009-06-28 07:17:02 +04:00
|
|
|
codetest: unittest functest
|
2009-03-15 08:15:59 +03:00
|
|
|
|
2009-06-28 07:17:02 +04:00
|
|
|
# moderate pre-commit tests - run before record or before send/push, your choice
|
2009-09-23 19:00:24 +04:00
|
|
|
committest: hlinttest unittest doctest functest haddocktest warningstest quickcabaltest
|
2009-06-28 07:17:02 +04:00
|
|
|
|
|
|
|
# thorough pre-release tests - run before release
|
|
|
|
releasetest: unittest doctest functest haddocktest warningstest fullcabaltest
|
|
|
|
|
2009-09-23 19:00:24 +04:00
|
|
|
hlinttest hlint:
|
2009-09-23 21:56:15 +04:00
|
|
|
hlint --hint=hlint --report=hlint.html $(SOURCEFILES)
|
2009-06-28 07:17:02 +04:00
|
|
|
|
|
|
|
# run unit tests
|
2009-11-25 14:41:25 +03:00
|
|
|
unittest: unittest-builtin
|
2009-06-28 07:17:02 +04:00
|
|
|
|
|
|
|
unittest-builtin: hledger
|
|
|
|
@(./hledger test \
|
2009-06-05 15:15:32 +04:00
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
|
|
|
|
2009-11-25 14:41:25 +03:00
|
|
|
# XXX doesn't rebuild on hledger source changes
|
2009-06-28 07:17:02 +04:00
|
|
|
unittest-standalone: tools/unittest
|
|
|
|
@(tools/unittest \
|
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
2009-06-05 15:15:32 +04:00
|
|
|
|
2009-06-28 07:17:02 +04:00
|
|
|
# run unit tests without waiting for compilation
|
|
|
|
unittesths:
|
2009-06-05 15:15:32 +04:00
|
|
|
@(runghc hledger.hs test \
|
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
2008-12-05 12:28:24 +03:00
|
|
|
|
2009-07-12 02:30:10 +04:00
|
|
|
# run functional tests, requires shelltestrunner from hackage
|
|
|
|
functest: hledger
|
2010-04-10 04:11:47 +04:00
|
|
|
(shelltest tests --implicit=none --threads=16 \
|
2009-06-27 12:15:00 +04:00
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
|
|
|
|
2009-03-15 08:15:59 +03:00
|
|
|
# run doc tests
|
2010-02-13 23:21:08 +03:00
|
|
|
doctest: tools/doctest hledger
|
2009-06-28 07:17:02 +04:00
|
|
|
@(tools/doctest Commands/Add.hs \
|
|
|
|
&& tools/doctest Tests.hs \
|
2009-06-05 15:15:32 +04:00
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
2009-03-15 11:47:23 +03:00
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# make sure we have no haddock errors
|
|
|
|
haddocktest:
|
2009-06-05 15:15:32 +04:00
|
|
|
@(make --quiet haddock \
|
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
|
|
|
|
|
|
|
# make sure the normal build has no warnings
|
|
|
|
warningstest:
|
|
|
|
@(make -s clean \
|
|
|
|
&& make --no-print-directory -s hledgernowarnings \
|
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
|
|
|
|
2009-06-28 07:17:02 +04:00
|
|
|
# make sure cabal is reasonably happy
|
|
|
|
quickcabaltest: setversion
|
|
|
|
@(cabal clean \
|
|
|
|
&& cabal check \
|
2009-11-28 18:37:56 +03:00
|
|
|
&& cabal configure -fvty -fweb \
|
2009-06-28 07:17:02 +04:00
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
|
|
|
|
|
|
|
# make sure cabal is happy in all possible ways
|
|
|
|
fullcabaltest: setversion
|
2009-06-05 15:15:32 +04:00
|
|
|
@(cabal clean \
|
|
|
|
&& cabal check \
|
2009-11-28 18:37:56 +03:00
|
|
|
&& cabal configure -fvty -fweb \
|
2009-06-05 15:15:32 +04:00
|
|
|
&& cabal build \
|
2009-06-22 23:52:58 +04:00
|
|
|
&& dist/build/hledger/hledger test 2>&1 | tail -1 | grep -q 'Errors: 0 Failures: 0' \
|
|
|
|
&& cabal sdist \
|
|
|
|
&& cabal upload dist/hledger-$(VERSION).tar.gz --check -v3 \
|
2009-06-05 15:15:32 +04:00
|
|
|
&& echo $@ passed) || echo $@ FAILED
|
2009-03-15 08:15:59 +03:00
|
|
|
|
2009-06-28 07:17:02 +04:00
|
|
|
# run performance benchmarks and save results in profs/.
|
2009-12-12 05:25:27 +03:00
|
|
|
# Requires some commands defined in bench.tests and some BENCHEXES defined above.
|
2009-06-05 14:47:01 +04:00
|
|
|
benchmark: sampleledgers bench.tests tools/bench
|
2009-12-12 05:11:58 +03:00
|
|
|
PATH=.:$(PATH) tools/bench -fbench.tests $(BENCHEXES) | tee profs/$(TIME).bench
|
2009-06-03 00:37:34 +04:00
|
|
|
@rm -f benchresults.*
|
2009-05-29 23:26:09 +04:00
|
|
|
@(cd profs; rm -f latest.bench; ln -s $(TIME).bench latest.bench)
|
2008-12-10 23:46:18 +03:00
|
|
|
|
2009-06-04 05:33:31 +04:00
|
|
|
# generate, save and display a standard profile
|
|
|
|
prof: sampleledgers hledgerp
|
|
|
|
@echo "Profiling $(PROFCMD)"
|
|
|
|
./hledgerp +RTS -p -RTS $(PROFCMD) >/dev/null
|
|
|
|
mv hledgerp.prof profs/$(TIME)-orig.prof
|
|
|
|
tools/simplifyprof.hs profs/$(TIME)-orig.prof >profs/$(TIME).prof
|
|
|
|
(cd profs; rm -f latest*.prof; ln -s $(TIME)-orig.prof latest-orig.prof; ln -s $(TIME).prof latest.prof)
|
|
|
|
echo; cat profs/latest.prof
|
|
|
|
|
|
|
|
# generate, save and display a graphical heap profile
|
|
|
|
heap: sampleledgers hledgerp
|
|
|
|
@echo "Profiling heap with $(PROFCMD)"
|
|
|
|
./hledgerp +RTS -hc -RTS $(PROFCMD) >/dev/null
|
|
|
|
mv hledgerp.hp profs/$(TIME).hp
|
|
|
|
(cd profs; rm -f latest.hp; ln -s $(TIME).hp latest.hp; \
|
2009-05-30 00:42:42 +04:00
|
|
|
hp2ps $(TIME).hp; rm -f latest.ps; ln -s $(TIME).ps latest.ps; rm -f *.aux)
|
2009-06-04 05:33:31 +04:00
|
|
|
$(VIEWPSCMD) profs/latest.ps
|
|
|
|
|
|
|
|
# generate and display a code coverage report
|
|
|
|
coverage: sampleledgers hledgercov
|
|
|
|
@echo "Generating coverage report with $(COVCMD)"
|
|
|
|
tools/coverage "markup --destdir=profs/coverage" test
|
|
|
|
cd profs/coverage; rm -f index.html; ln -s hpc_index.html index.html
|
|
|
|
$(VIEWHTMLCMD) profs/coverage/index.html
|
|
|
|
|
2009-06-05 15:15:32 +04:00
|
|
|
# get a debug prompt
|
|
|
|
ghci:
|
2010-02-04 22:23:34 +03:00
|
|
|
ghci -DMAKE $(OPTFLAGS) hledger.hs
|
2009-06-05 15:15:32 +04:00
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# generate standard sample ledgers
|
2009-05-29 15:42:34 +04:00
|
|
|
sampleledgers: sample.ledger 100x100x10.ledger 1000x1000x10.ledger 10000x1000x10.ledger 100000x1000x10.ledger
|
2009-05-29 12:29:04 +04:00
|
|
|
|
|
|
|
sample.ledger:
|
|
|
|
true # XXX should probably regenerate this
|
|
|
|
|
2009-05-30 00:28:55 +04:00
|
|
|
100x100x10.ledger: tools/generateledger
|
2009-05-29 15:42:34 +04:00
|
|
|
tools/generateledger 100 100 10 >$@
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2009-05-30 00:28:55 +04:00
|
|
|
1000x1000x10.ledger: tools/generateledger
|
2009-05-29 12:29:04 +04:00
|
|
|
tools/generateledger 1000 1000 10 >$@
|
2008-11-26 22:00:55 +03:00
|
|
|
|
2009-05-30 00:28:55 +04:00
|
|
|
10000x1000x10.ledger: tools/generateledger
|
2009-05-29 12:29:04 +04:00
|
|
|
tools/generateledger 10000 1000 10 >$@
|
2009-05-17 18:13:06 +04:00
|
|
|
|
2009-05-30 00:28:55 +04:00
|
|
|
100000x1000x10.ledger: tools/generateledger
|
2009-05-29 12:29:04 +04:00
|
|
|
tools/generateledger 100000 1000 10 >$@
|
|
|
|
|
|
|
|
######################################################################
|
2009-06-02 23:54:45 +04:00
|
|
|
# DOCUMENTATION
|
2009-01-25 10:48:41 +03:00
|
|
|
|
2009-07-15 01:51:10 +04:00
|
|
|
# Documentation source files are UPPERCASE files in the top directory.
|
|
|
|
# website/ contains both html generated from these (UPPERCASE.html) and
|
|
|
|
# revision-controlled resource files (everything else). website/api-doc
|
|
|
|
# contains only generated files.
|
|
|
|
|
2009-06-02 23:54:45 +04:00
|
|
|
cleandocs:
|
|
|
|
rm -rf website/[A-Z]*.html website/api-doc/*
|
2009-06-02 10:20:19 +04:00
|
|
|
|
2009-06-02 23:54:45 +04:00
|
|
|
# rebuild all docs
|
2010-02-13 23:21:08 +03:00
|
|
|
docs: html pdf apidocs
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2010-02-13 23:21:08 +03:00
|
|
|
# generate html versions of docs (and the hledger.org website)
|
|
|
|
# work around pandoc not handling full rst image directive
|
|
|
|
html:
|
|
|
|
for d in $(DOCFILES); do $(PANDOC) --toc -s -H website/header.html -A website/footer.html -r rst $$d >website/$$d.html; done
|
|
|
|
cd website && ln -sf ../SCREENSHOTS && $(RST2HTML) SCREENSHOTS >SCREENSHOTS.html && rm -f SCREENSHOTS
|
2009-12-04 00:11:22 +03:00
|
|
|
cd website; rm -f index.html; ln -s README.html index.html; rm -f profs; ln -s ../profs
|
2009-06-02 10:58:43 +04:00
|
|
|
|
2010-02-13 23:21:08 +03:00
|
|
|
pdf: docspdf codepdf
|
2009-06-14 01:37:06 +04:00
|
|
|
|
2009-06-02 23:54:45 +04:00
|
|
|
# generate pdf versions of main docs
|
2010-02-13 23:21:08 +03:00
|
|
|
# work around rst2pdf needing images in the same directory
|
|
|
|
docspdf:
|
|
|
|
-for d in $(DOCFILES); do (cd website && ln -sf ../$$d && rst2pdf $$d && rm -f $$d); done
|
|
|
|
|
|
|
|
# format all code as a pdf for offline reading
|
|
|
|
ENSCRIPT=enscript -q --header='$$n|$$D{%+}|Page $$% of $$=' --line-numbers --font=Courier6 --color -o-
|
|
|
|
codepdf:
|
|
|
|
$(ENSCRIPT) --pretty-print=makefile hledger.cabal >cabal.ps
|
|
|
|
$(ENSCRIPT) --pretty-print=makefile Makefile >make.ps
|
|
|
|
$(ENSCRIPT) --pretty-print=haskell $(SOURCEFILES) >haskell.ps
|
|
|
|
cat cabal.ps make.ps haskell.ps | ps2pdf - >code.pdf
|
|
|
|
|
|
|
|
# view all docs and code as pdf
|
|
|
|
PDFS=website/{README,README2,MANUAL,NEWS,CONTRIBUTORS,SCREENSHOTS}.pdf code.pdf
|
|
|
|
viewall: pdf
|
|
|
|
$(VIEWPDFCMD) $(PDFS)
|
|
|
|
|
|
|
|
# print all docs and code for offline reading
|
|
|
|
printall: pdf
|
|
|
|
$(PRINTCMD) $(PDFS)
|
|
|
|
|
|
|
|
# push latest docs etc. and update the hledger.org site
|
|
|
|
site: push
|
|
|
|
ssh joyful.com 'make -C/repos/hledger docs'
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2009-06-02 23:54:45 +04:00
|
|
|
# generate api docs
|
2009-05-29 12:29:04 +04:00
|
|
|
# We munge haddock and hoogle into a rough but useful framed layout.
|
|
|
|
# For this to work the hoogle cgi must be built with base target "main".
|
2009-12-16 20:59:13 +03:00
|
|
|
# XXX move the framed index building into haddock: ?
|
2010-02-13 23:21:08 +03:00
|
|
|
apidocs: haddock #hoogle
|
2009-06-02 23:54:45 +04:00
|
|
|
sed -i -e 's%^></HEAD%><base target="main"></HEAD%' website/api-doc/modules-index.html ; \
|
|
|
|
cp website/api-doc-frames.html website/api-doc/index.html ; \
|
2009-07-10 01:20:49 +04:00
|
|
|
# cp website/hoogle-small.html website/api-doc
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2009-06-02 23:54:45 +04:00
|
|
|
# generate and view the api docs
|
2010-02-13 23:21:08 +03:00
|
|
|
viewapidocs: api-docs
|
2009-06-02 23:54:45 +04:00
|
|
|
$(VIEWHTMLCMD) website/api-doc/index.html
|
2009-05-29 12:29:04 +04:00
|
|
|
|
|
|
|
MAIN=hledger.hs
|
|
|
|
|
2009-06-05 13:42:44 +04:00
|
|
|
# generate code documentation with haddock
|
2009-06-02 23:54:45 +04:00
|
|
|
# --ignore-all-exports means we are documenting internal implementation, not library api
|
2009-12-19 04:19:01 +03:00
|
|
|
HADDOCK=haddock -B `ghc --print-libdir` --no-warnings --ignore-all-exports $(subst -D,--optghc=-D,$(DEFINEFLAGS))
|
2009-06-02 23:54:45 +04:00
|
|
|
haddock: hscolour $(MAIN)
|
|
|
|
$(HADDOCK) -o website/api-doc -h --source-module=src-%{MODULE/./-}.html --source-entity=src-%{MODULE/./-}.html#%N $(filter-out %api-doc-dir hscolour,$^) && \
|
|
|
|
cp website/api-doc/index.html website/api-doc/modules-index.html
|
2009-05-29 12:29:04 +04:00
|
|
|
|
|
|
|
HSCOLOUR=HsColour -css
|
2009-06-02 23:54:45 +04:00
|
|
|
hscolour:
|
2009-06-02 22:29:01 +04:00
|
|
|
for f in $(SOURCEFILES); do \
|
2009-06-02 23:54:45 +04:00
|
|
|
$(HSCOLOUR) -anchor $$f -owebsite/api-doc/`echo "src/"$$f | sed -e's%/%-%g' | sed -e's%\.hs$$%.html%'` ; \
|
2009-05-29 12:29:04 +04:00
|
|
|
done ; \
|
2009-06-02 23:54:45 +04:00
|
|
|
cp website/api-doc/src-hledger.html website/api-doc/src-Main.html ; \
|
|
|
|
HsColour -print-css >website/api-doc/hscolour.css
|
2009-05-29 12:29:04 +04:00
|
|
|
|
|
|
|
#set up the hoogle web interface
|
|
|
|
#uses a hoogle source tree configured with --datadir=., patched to fix haddock urls/target frame
|
|
|
|
HOOGLESRC=/usr/local/src/hoogle
|
|
|
|
HOOGLE=$(HOOGLESRC)/dist/build/hoogle/hoogle
|
|
|
|
HOOGLEVER=`$(HOOGLE) --version |tail -n 1 | sed -e 's/Version /hoogle-/'`
|
2009-06-02 23:54:45 +04:00
|
|
|
hoogle: hoogleindex
|
2009-05-29 12:29:04 +04:00
|
|
|
if test -f $(HOOGLE) ; then \
|
2009-06-02 23:54:45 +04:00
|
|
|
cd website/api-doc && \
|
2009-05-29 12:29:04 +04:00
|
|
|
rm -f $(HOOGLEVER) && \
|
|
|
|
ln -s . $(HOOGLEVER) && \
|
|
|
|
cp -r $(HOOGLESRC)/src/res/ . && \
|
|
|
|
cp -p $(HOOGLE) index.cgi && \
|
|
|
|
touch log.txt && chmod 666 log.txt ; \
|
|
|
|
else \
|
|
|
|
echo "Could not find $(HOOGLE) in the hoogle source tree" ; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
#generate a hoogle index
|
|
|
|
hoogleindex: $(MAIN)
|
2009-06-02 23:54:45 +04:00
|
|
|
$(HADDOCK) -o website/api-doc --hoogle $^ && \
|
|
|
|
cd website/api-doc && \
|
2009-05-29 12:29:04 +04:00
|
|
|
hoogle --convert=main.txt --output=default.hoo
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# RELEASING
|
2009-01-25 11:09:09 +03:00
|
|
|
|
2009-12-11 01:43:23 +03:00
|
|
|
# Version numbering. See also VERSION and Version.hs.
|
|
|
|
#
|
|
|
|
# hledger's version number appears in:
|
2009-02-26 20:37:46 +03:00
|
|
|
# hledger --version
|
2009-02-27 05:55:54 +03:00
|
|
|
# hledger's cabal file
|
|
|
|
# darcs tags
|
|
|
|
# hackage tarball filenames
|
|
|
|
# hackage pages
|
2009-02-26 20:37:46 +03:00
|
|
|
#
|
2009-12-11 01:43:23 +03:00
|
|
|
# Some old version numbering goals:
|
2009-02-26 20:37:46 +03:00
|
|
|
# 1 automation, robustness, simplicity, platform independence
|
|
|
|
# 2 cabal versions must be all-numeric
|
2009-02-27 05:55:54 +03:00
|
|
|
# 3 release versions can be concise (without extra .0's)
|
2009-02-26 20:37:46 +03:00
|
|
|
# 4 releases should have a corresponding darcs tag
|
|
|
|
# 5 development builds should have a precise version appearing in --version
|
|
|
|
# 6 development builds should generate cabal packages with non-confusing versions
|
2009-02-27 05:55:54 +03:00
|
|
|
# 7 there should be a way to mark builds/releases as alpha or beta
|
|
|
|
# 8 it should be easy to darcs get the .0 release even after bugfix releases
|
|
|
|
# 9 avoid unnecessary compiling and linking
|
|
|
|
# 10 minimise rcs noise and syncing issues (commits, unrecorded changes)
|
2009-02-26 20:37:46 +03:00
|
|
|
#
|
2009-12-11 01:43:23 +03:00
|
|
|
# Current policy:
|
|
|
|
#
|
|
|
|
# - We follow http://haskell.org/haskellwiki/Package_versioning_policy
|
|
|
|
#
|
|
|
|
# - The full release version is ma.jor.minor, where minor is 0 for a
|
|
|
|
# normal release or 1..n for bugfix releases.
|
|
|
|
#
|
|
|
|
# - The elided release version is ma.jor when minor is 0. We use it for
|
|
|
|
# hackage releases when possible, trusting it doesn't cause trouble..
|
|
|
|
#
|
|
|
|
# - The build version is ma.jor.minor+patches, where patches is the number
|
|
|
|
# of patches applied in the current repo since the last release tag.
|
|
|
|
#
|
|
|
|
# - The release tag in the repo is the full release version.
|
|
|
|
#
|
|
|
|
# - hledger --version shows the release version or build version as
|
|
|
|
# appropriate.
|
|
|
|
#
|
2009-12-12 05:35:09 +03:00
|
|
|
# - The VERSION file must be updated manually before a release.
|
|
|
|
#
|
|
|
|
# - "make benchmark" depends on version numbers in BENCHEXES, these also
|
|
|
|
# must be updated manually.
|
|
|
|
#
|
|
|
|
# - "make" updates the version in most other places, and defines PATCHES.
|
|
|
|
# Note "cabal build" should also do this but doesn't yet.
|
|
|
|
#
|
|
|
|
# - "make release" additionally records the main version number-affected
|
|
|
|
# files, and tags the repo with the release tag.
|
2009-12-12 05:55:59 +03:00
|
|
|
|
|
|
|
# Build a release, tag the repo, prepare a cabal package
|
|
|
|
# Don't forget to update VERSION first. Examples:
|
2009-12-12 23:40:54 +03:00
|
|
|
# normal release: echo 0.7 >VERSION; make release
|
|
|
|
# a bugfix release: echo 0.7.1 >VERSION; make release
|
2009-06-22 23:52:58 +04:00
|
|
|
release: releasetest setandrecordversion tagrelease sdist
|
|
|
|
|
2009-12-12 05:55:59 +03:00
|
|
|
# Upload the latest cabal package and update hledger.org
|
|
|
|
upload: hackageupload updatesite
|
|
|
|
|
|
|
|
releaseandupload: release upload
|
2009-02-27 05:55:54 +03:00
|
|
|
|
|
|
|
# file where the current release version is defined
|
|
|
|
VERSIONFILE=VERSION
|
|
|
|
|
|
|
|
# two or three-part version string
|
|
|
|
VERSION:=`grep -v '^--' $(VERSIONFILE)`
|
2009-02-26 20:37:46 +03:00
|
|
|
|
2009-02-27 05:55:54 +03:00
|
|
|
# three-part version string
|
|
|
|
ifeq ($(shell ghc -e "length (filter (=='.') \"$(VERSION)\")"), 1)
|
|
|
|
VERSION3:=$(VERSION).0
|
2009-02-26 20:37:46 +03:00
|
|
|
else
|
2009-02-27 05:55:54 +03:00
|
|
|
VERSION3:=$(VERSION)
|
2009-02-26 20:37:46 +03:00
|
|
|
endif
|
|
|
|
|
2009-02-27 05:55:54 +03:00
|
|
|
# other files containing the version string
|
|
|
|
VERSIONFILES=hledger.cabal Version.hs
|
|
|
|
|
|
|
|
hledger.cabal: $(VERSIONFILE)
|
2009-06-14 01:24:31 +04:00
|
|
|
perl -p -e "s/(^version: *) .*/\1 $(VERSION)/" -i $@
|
2009-02-27 05:55:54 +03:00
|
|
|
|
|
|
|
Version.hs: $(VERSIONFILE)
|
|
|
|
perl -p -e "s/(^version *= *)\".*?\"/\1\"$(VERSION3)\"/" -i $@
|
|
|
|
|
|
|
|
# update the version string in local files. Triggered by "make".
|
|
|
|
setversion: $(VERSIONFILES)
|
|
|
|
|
2009-12-12 23:40:54 +03:00
|
|
|
# update the version number in local files, and prompt to record changes
|
|
|
|
# in these files. Triggered by "make release".
|
2009-02-27 05:55:54 +03:00
|
|
|
setandrecordversion: setversion
|
2009-12-12 05:55:59 +03:00
|
|
|
darcs record -m "update version" $(VERSIONFILE) $(VERSIONFILES)
|
2009-02-26 20:37:46 +03:00
|
|
|
|
|
|
|
tagrelease:
|
2009-02-27 05:55:54 +03:00
|
|
|
darcs tag $(VERSION3)
|
2009-02-26 20:37:46 +03:00
|
|
|
|
|
|
|
sdist:
|
|
|
|
cabal sdist
|
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# display a hackage upload command reminder
|
2009-02-27 05:55:54 +03:00
|
|
|
hackageupload:
|
2009-06-22 23:52:58 +04:00
|
|
|
cabal upload dist/hledger-$(VERSION).tar.gz -v3
|
2009-02-26 20:37:46 +03:00
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# send unpushed patches to the mail list
|
|
|
|
send:
|
|
|
|
darcs send http://joyful.com/repos/hledger --to=hledger@googlegroups.com --edit-description
|
2008-11-24 01:15:51 +03:00
|
|
|
|
2009-05-30 01:00:38 +04:00
|
|
|
# push patches and anything else pending to the public server
|
2009-06-05 06:07:38 +04:00
|
|
|
push: pushprofs pushbinary
|
2009-05-29 12:29:04 +04:00
|
|
|
darcs push joyful.com:/repos/hledger
|
2008-10-18 08:34:41 +04:00
|
|
|
|
2009-05-30 01:00:38 +04:00
|
|
|
# pull anything pending from the public server
|
|
|
|
pull: pullprofs
|
|
|
|
darcs pull -a joyful.com:/repos/hledger
|
|
|
|
|
2009-06-05 14:47:01 +04:00
|
|
|
# push any new profiles and benchmark results to the public site
|
2009-06-05 06:07:38 +04:00
|
|
|
# beware, results will vary depending on which machine generated them
|
2009-05-29 23:26:09 +04:00
|
|
|
pushprofs:
|
2009-05-30 01:00:38 +04:00
|
|
|
rsync -azP profs/ joyful.com:/repos/hledger/profs/
|
|
|
|
|
2009-06-05 14:47:01 +04:00
|
|
|
# fetch any new profiles and benchmark results from the public site
|
2009-05-30 01:00:38 +04:00
|
|
|
pullprofs:
|
|
|
|
rsync -azP joyful.com:/repos/hledger/profs/ profs/
|
2009-05-29 23:26:09 +04:00
|
|
|
|
2009-06-05 06:07:38 +04:00
|
|
|
# push a deployable binary for this platform to the public site
|
2009-06-28 07:17:02 +04:00
|
|
|
# make hledgerPLATFORM first
|
2009-06-05 06:07:38 +04:00
|
|
|
pushbinary:
|
|
|
|
-gzip -9 $(BINARYFILENAME)
|
2009-06-22 23:52:58 +04:00
|
|
|
-rsync -aP $(BINARYFILENAME).gz joyful.com:/repos/hledger/website/binaries/
|
2009-06-05 04:55:20 +04:00
|
|
|
|
2009-05-29 12:29:04 +04:00
|
|
|
# show project stats useful for release notes
|
2009-06-05 14:47:01 +04:00
|
|
|
stats: showlastreleasedate showreleaseauthors showloc showcov showerrors showlocalchanges showreleasechanges benchmark
|
2009-01-21 01:27:32 +03:00
|
|
|
|
2009-05-17 18:13:06 +04:00
|
|
|
showreleaseauthors:
|
2008-11-24 00:50:38 +03:00
|
|
|
@echo Patch authors since last release:
|
|
|
|
@darcs changes --from-tag . |grep '^\w' |cut -c 31- |sort |uniq
|
2009-05-29 12:29:04 +04:00
|
|
|
@echo
|
2008-11-24 00:50:38 +03:00
|
|
|
|
2009-05-17 18:13:06 +04:00
|
|
|
showloc:
|
|
|
|
@echo Lines of non-test code:
|
2009-06-03 00:37:34 +04:00
|
|
|
@sloccount `ls $(SOURCEFILES) |grep -v Tests.hs` | grep haskell:
|
2009-05-17 18:13:06 +04:00
|
|
|
@echo Lines of test code:
|
|
|
|
@sloccount Tests.hs | grep haskell:
|
2009-05-29 12:29:04 +04:00
|
|
|
@echo
|
2009-05-17 18:13:06 +04:00
|
|
|
|
2009-06-04 05:33:31 +04:00
|
|
|
showcov:
|
|
|
|
@echo Test coverage:
|
|
|
|
@tools/coverage report test
|
|
|
|
|
2009-05-17 18:13:06 +04:00
|
|
|
showlastreleasedate:
|
|
|
|
@echo Last release date:
|
|
|
|
@darcs changes --from-tag . | tail -2
|
2009-05-29 12:29:04 +04:00
|
|
|
@echo
|
2009-05-17 18:13:06 +04:00
|
|
|
|
|
|
|
showerrors:
|
|
|
|
@echo Known errors:
|
|
|
|
@awk '/^** errors/, /^** / && !/^** errors/' NOTES | grep '^\*\*\* ' | tail +1
|
2009-05-29 12:29:04 +04:00
|
|
|
@echo
|
2009-05-17 18:13:06 +04:00
|
|
|
|
|
|
|
showlocalchanges:
|
2009-05-29 12:29:04 +04:00
|
|
|
@echo Local changes:
|
2009-05-17 18:13:06 +04:00
|
|
|
@-darcs push joyful.com:/repos/hledger --dry-run | grep '*' | tac
|
2009-05-29 12:29:04 +04:00
|
|
|
@echo
|
2009-05-17 18:13:06 +04:00
|
|
|
|
|
|
|
showreleasechanges:
|
|
|
|
@echo "Changes since last release: ("`darcs changes --from-tag . --count`")"
|
2009-11-28 18:37:35 +03:00
|
|
|
@darcs changes --from-tag . --matches "not (name docs: or name site: or name tools:)" | grep '*'
|
2009-05-29 12:29:04 +04:00
|
|
|
@echo
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# MISCELLANEOUS
|
|
|
|
|
|
|
|
tag: emacstags
|
|
|
|
|
|
|
|
emacstags:
|
2009-06-02 22:29:01 +04:00
|
|
|
@rm -f TAGS; hasktags -e $(SOURCEFILES) hledger.cabal
|
2009-05-29 12:29:04 +04:00
|
|
|
|
|
|
|
clean:
|
2010-02-13 23:21:08 +03:00
|
|
|
rm -f `find . -name "*.o" -o -name "*.hi" -o -name "*~" -o -name "darcs-amend-record*" -o -name "*-darcs-backup*"`
|
2009-05-29 12:29:04 +04:00
|
|
|
|
2009-06-02 23:54:45 +04:00
|
|
|
Clean: clean cleandocs
|
2009-05-29 12:29:04 +04:00
|
|
|
rm -f hledger TAGS tags
|
2008-10-03 11:40:28 +04:00
|
|
|
|