hledger/Makefile

664 lines
22 KiB
Makefile
Raw Normal View History

2009-01-25 12:00:57 +03:00
# hledger project makefile
2008-12-10 21:43:14 +03:00
# ghc 6.12 executables need a locale
export LANG=en_US.UTF-8
2009-12-04 00:11:22 +03:00
# optional features described in MANUAL, comment out if you don't have the libs
2010-09-06 02:51:51 +04:00
OPTFLAGS=-DWEB -DVTY -DCHART
OPTFLAGS=-DWEB -DVTY
#OPTFLAGS=-DWEB
2010-05-24 02:49:09 +04:00
#OPTFLAGS=
# command to run during "make ci"
2010-09-06 02:51:51 +04:00
CICMD=web --debug -f ~/personal/current.journal # -f data/sample.journal
CICMD=test
2010-09-06 02:51:51 +04:00
#CICMD=-f t.journal print
# command line to run during "make prof" and "make heap"
PROFCMD=bin/hledgerp -f data/1000x1000x10.journal balance >/dev/null
# command to run during "make coverage"
COVCMD=test
# executables to run during "make simplebench". They should be on the path
2010-05-23 01:24:07 +04:00
# or in the current directory. hledger executables for benchmarking should
# generally be the standard optimised cabal build, constrained to parsec 2.
2010-09-06 02:51:51 +04:00
BENCHEXES=hledger-0.9 hledger-0.10-1 hledgeropt ledger
2010-07-19 07:36:14 +04:00
#BENCHEXES=hledger
2009-06-03 00:37:34 +04:00
# misc. tools
2010-02-13 23:33:15 +03:00
RST2PDF=rst2pdf
2010-09-06 02:51:51 +04:00
#VIEWHTML=open -a 'Google Chrome'
VIEWHTML=google-chrome
VIEWPS=open
VIEWPDF=open
PRINT=lpr
2010-03-13 03:19:05 +03:00
MAIN=hledger.hs
SOURCEFILES:= \
2010-03-13 03:19:05 +03:00
$(MAIN) \
[A-Z]*hs \
Hledger/Cli/*hs \
Hledger/Cli/Commands/*hs \
hledger-lib/*hs \
2010-05-20 03:08:53 +04:00
hledger-lib/Hledger/*hs \
hledger-lib/Hledger/Data/*hs \
hledger-lib/Hledger/Read/*hs
2009-12-04 00:11:22 +03:00
DOCFILES:=README README2 MANUAL NEWS CONTRIBUTORS SCREENSHOTS
2010-07-18 22:44:59 +04:00
BINARYFILENAME=$(shell 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)
PREFERMACUSRLIBFLAGS=-L/usr/lib
BUILDFLAGS:=$(PREFERMACUSRLIBFLAGS) $(DEFINEFLAGS) $(WARNINGS) -ihledger-lib
2009-06-13 22:21:56 +04:00
TIME:=$(shell date +"%Y%m%d%H%M")
2009-06-03 00:37:34 +04:00
2010-05-24 03:45:12 +04:00
# file defining the current release version
VERSIONFILE=VERSION
2010-07-10 17:09:49 +04:00
# two or three-part version string, whatever's in VERSION
2010-05-24 03:45:12 +04:00
VERSION:=$(shell grep -v '^--' $(VERSIONFILE))
2010-07-10 17:09:49 +04:00
# three-part version string, 0-padded if necessary
2010-05-24 03:45:12 +04:00
ifeq ($(shell ghc -e "length (filter (=='.') \"$(VERSION)\")"), 1)
VERSION3:=$(VERSION).0
else
VERSION3:=$(VERSION)
endif
# files which should be updated when the version changes
VERSIONSENSITIVEFILES=\
hledger.cabal \
Hledger/Cli/Version.hs \
hledger-lib/hledger-lib.cabal \
MANUAL.markdown \
2010-07-25 02:08:54 +04:00
DOWNLOAD.markdown \
2010-05-24 03:45:12 +04:00
default: tag hledger
######################################################################
# BUILDING
2010-05-17 19:50:44 +04:00
# fetch dependencies, build and install the standard cabal binary
hledgercabal:
2010-05-17 19:50:44 +04:00
cd hledger-lib; cabal install
cabal install -fweb -fvty
# build the standard developer's binary, quickly
hledger: setversion
ghc --make hledger.hs -o bin/hledger $(BUILDFLAGS) # -O
hledgernowarnings: setversion
ghc --make hledger.hs -o bin/hledger $(BUILDFLAGS) -Werror -v0
# build the profiling-enabled binary. You may need to cabal install
# --reinstall -p some libs.
hledgerp: setversion
ghc --make hledger.hs -prof -auto-all -o bin/hledgerp $(BUILDFLAGS)
# build the coverage-enabled binary. coverage-enabled .o files are kept
# separate to avoid contamination.
hledgercov: setversion
ghc --make hledger.hs -fhpc -o bin/hledgercov -outputdir .coverageobjs $(BUILDFLAGS)
# build the fastest binary we can
hledgeropt: setversion
ghc --make hledger.hs -o bin/hledgeropt $(BUILDFLAGS) -O2 # -fvia-C # -fexcess-precision -optc-O3 -optc-ffast-math
2009-06-05 03:16:06 +04:00
# build a deployable binary for gnu/linux, statically linked
hledgerlinux: setversion
ghc --make hledger.hs -o bin/$(BINARYFILENAME) $(BUILDFLAGS) -O2 -static -optl-static -optl-pthread
2010-07-18 03:14:36 +04:00
@echo 'Please check the build looks portable (statically linked):'
-file bin/$(BINARYFILENAME)
2009-06-05 03:16:06 +04:00
2010-07-18 04:08:30 +04:00
# build a deployable binary for mac, using only standard osx libs
hledgermac: setversion
ghc --make hledger.hs -o bin/$(BINARYFILENAME) $(BUILDFLAGS) -O2 # -optl-L/usr/lib
@echo Please check the build looks portable:
otool -L bin/$(BINARYFILENAME)
2010-07-18 22:44:59 +04:00
# build a deployable binary for windows, assuming cygwin tools are present
hledgerwin: setversion #hledgercabal
cp ~/.cabal/bin/hledger.exe bin/`echo $(BINARYFILENAME) | dos2unix`
# auto-recompile and run (with the specified argument) whenever a module changes.
# sp is from searchpath.org, you might need the patched version from
# http://joyful.com/repos/searchpath.
auto-%: setversion
sp --no-exts --no-default-map -o bin/hledger ghc --make hledger.hs $(BUILDFLAGS) --run $*
autobuild auto: auto-test
# fix permissions (eg after darcs get)
fixperms:
2010-03-09 04:32:52 +03:00
chmod +x hledger.hs 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
# build the doctest runner
tools/doctest: tools/doctest.hs
ghc --make tools/doctest.hs
# build the simple benchmark runner. Requires tabular.
tools/simplebench: tools/simplebench.hs
ghc --make tools/simplebench.hs
# build the criterion-based benchmark runner. Requires criterion.
tools/criterionbench: tools/criterionbench.hs
ghc --make tools/criterionbench.hs
# build the progression-based benchmark runner. Requires progression.
tools/progressionbench: tools/progressionbench.hs
ghc --make tools/progressionbench.hs
# build the generatejournal tool
tools/generatejournal: tools/generatejournal.hs
ghc --make tools/generatejournal.hs
######################################################################
# TESTING
2009-06-28 07:17:02 +04:00
test: codetest
# quick code tests - run all the time
2009-06-28 07:17:02 +04:00
codetest: unittest functest
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
2010-09-06 03:24:54 +04:00
releasetest: unittest doctest functest warningstest fullcabaltest haddocktest
2009-06-28 07:17:02 +04:00
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
unittest: unittest-builtin
2009-06-28 07:17:02 +04:00
unittest-builtin: hledger
2010-05-24 02:49:03 +04:00
@(bin/hledger test \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
# XXX doesn't rebuild on hledger source changes
2009-06-28 07:17:02 +04:00
unittest-standalone: tools/unittest
@(tools/unittest \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
2009-06-28 07:17:02 +04:00
# run unit tests without waiting for compilation
unittesths:
@(runghc hledger.hs test \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
# run functional tests, requires shelltestrunner >= 0.9 from hackage
# 16 threads sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless
functest: hledger
2010-05-24 02:49:03 +04:00
(shelltest tests --implicit=none --plain --threads=16 \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
# run doc tests
doctest: tools/doctest hledger
2010-09-06 02:51:51 +04:00
@(tools/doctest Hledger/Cli/Commands/Add.hs \
&& tools/doctest Hledger/Cli/Tests.hs \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
2009-03-15 11:47:23 +03:00
# make sure we have no haddock errors
haddocktest:
@(make --quiet haddock \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
# make sure the normal build has no warnings
warningstest:
@(make -s clean \
&& make --no-print-directory -s hledgernowarnings \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
2009-06-28 07:17:02 +04:00
# make sure cabal is reasonably happy
quickcabaltest: setversion
2010-09-06 03:24:54 +04:00
(cd hledger-lib \
&& cabal clean \
&& cabal check \
&& cabal configure \
&& cd .. \
&& cabal clean \
&& cabal check \
&& cabal configure -fvty -fweb \
&& echo $@ PASSED) || echo $@ FAILED
2009-06-28 07:17:02 +04:00
# make sure cabal is happy in all possible ways
fullcabaltest: setversion
2010-05-24 03:45:12 +04:00
(cd hledger-lib \
&& cabal clean \
&& cabal check \
&& cabal install \
&& cabal sdist \
&& cabal upload dist/hledger-lib-$(VERSION).tar.gz --check -v3 \
&& cd .. \
&& cabal clean \
&& cabal check \
&& cabal configure -fvty -fweb \
&& cabal build \
&& 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 \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED \
2010-05-24 03:45:12 +04:00
) || echo $@ FAILED
2010-05-23 01:24:07 +04:00
# run performance benchmarks without saving results.
# Requires some commands defined in bench.tests and some BENCHEXES defined above.
quickbench: samplejournals bench.tests tools/simplebench
2010-05-23 01:24:07 +04:00
tools/simplebench -fbench.tests $(BENCHEXES)
@rm -f benchresults.*
# run performance benchmarks and save textual results in profs/.
2009-12-12 05:25:27 +03:00
# Requires some commands defined in bench.tests and some BENCHEXES defined above.
simplebench: samplejournals bench.tests tools/simplebench
2010-05-23 01:24:07 +04:00
tools/simplebench -fbench.tests $(BENCHEXES) | tee profs/$(TIME).bench
2009-06-03 00:37:34 +04:00
@rm -f benchresults.*
@(cd profs; rm -f latest.bench; ln -s $(TIME).bench latest.bench)
2008-12-10 23:46:18 +03:00
# run criterion benchmark tests and save graphical results
criterionbench: samplejournals tools/criterionbench
tools/criterionbench -t png -k png
# run progression benchmark tests and save graphical results
progressionbench: samplejournals tools/progressionbench
tools/progressionbench -- -t png -k png
# generate, save, simplify and display an execution profile
prof: samplejournals hledgerp
@echo "Profiling: $(PROFCMD)"
-$(PROFCMD) +RTS -p -RTS
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 and display an execution profile, don't save or simplify
quickprof: samplejournals hledgerp
@echo "Profiling: $(PROFCMD)"
-$(PROFCMD) +RTS -p -RTS
echo; cat hledgerp.prof
# generate, save and display a graphical heap profile
heap: samplejournals hledgerp
@echo "Profiling heap with: $(PROFCMD)"
$(PROFCMD) +RTS -hc -RTS
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)
2010-02-26 03:24:04 +03:00
$(VIEWPS) profs/latest.ps
# generate and display a graphical heap profile, don't save
quickheap: samplejournals hledgerp
@echo "Profiling heap with: $(PROFCMD)"
$(PROFCMD) +RTS -hc -RTS
hp2ps hledgerp.hp
$(VIEWPS) hledger.ps
# generate and display a code coverage report
coverage: samplejournals 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
2010-02-26 03:24:04 +03:00
$(VIEWHTML) profs/coverage/index.html
# get a debug prompt
ghci:
ghci -DMAKE $(OPTFLAGS) hledger.hs
# generate standard sample journals
samplejournals: data/sample.journal data/100x100x10.journal data/1000x1000x10.journal data/10000x1000x10.journal data/100000x1000x10.journal
data/sample.journal:
true # XXX should probably regenerate this
data/100x100x10.journal: tools/generatejournal
tools/generatejournal 100 100 10 >$@
data/1000x1000x10.journal: tools/generatejournal
tools/generatejournal 1000 1000 10 >$@
data/10000x1000x10.journal: tools/generatejournal
tools/generatejournal 10000 1000 10 >$@
data/100000x1000x10.journal: tools/generatejournal
tools/generatejournal 100000 1000 10 >$@
######################################################################
2009-06-02 23:54:45 +04:00
# DOCUMENTATION
2009-07-15 01:51:10 +04:00
# Documentation source files are UPPERCASE files in the top directory.
# site/ contains both html generated from these (UPPERCASE.html) and
# revision-controlled resource files (everything else). site/api-doc
2009-07-15 01:51:10 +04:00
# contains only generated files.
2009-06-02 23:54:45 +04:00
cleandocs:
rm -rf site/[A-Z]*.html site/api-doc/*
2009-06-02 23:54:45 +04:00
# rebuild all docs
2010-05-17 18:33:05 +04:00
docs: site apidocs
# build the hledger.org website
# Requires hakyll (cabal install hakyll)
2010-05-21 22:19:00 +04:00
.PHONY: site
site: site/hakyll site/_site/index.html site/_site/profs
2010-05-21 22:19:00 +04:00
cd site; ./hakyll build
site/_site/index.html:
cd site/_site; ln -sf README.html index.html; ln -sf ../../profs
site/_site/profs:
cd site/_site; ln -sf ../../profs
cleansite: site/hakyll
cd site; ./hakyll clean
2010-05-17 18:33:05 +04:00
previewsite: site/hakyll
cd site; ./hakyll preview
2010-05-21 22:19:00 +04:00
site/hakyll: site/hakyll.hs
cd site; ghc --make hakyll.hs $(PREFERMACUSRLIBFLAGS)
2010-05-17 18:33:05 +04:00
siteci:
cd site; sp --no-exts --no-default-map -o hakyll ghc --make hakyll.hs $(PREFERMACUSRLIBFLAGS) --run preview
2010-05-17 18:33:05 +04:00
viewsite: site
2010-05-21 22:19:00 +04:00
$(VIEWHTML) site/_site/index.html
# called on each darcs commit
commithook: site
# generate html versions of docs (and the hledger.org website)
# work around pandoc not handling full rst image directive
2010-05-17 18:33:05 +04:00
# html:
# for d in $(DOCFILES); do $(PANDOC) --toc -s -H site/header.html -A site/footer.html -r rst $$d >site/$$d.html; done
# cd site && ln -sf ../SCREENSHOTS && $(RST2HTML) SCREENSHOTS >SCREENSHOTS.html && rm -f SCREENSHOTS
# cd site; rm -f index.html; ln -s README.html index.html; rm -f profs; ln -s ../profs
2010-02-26 03:23:44 +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
# work around rst2pdf needing images in the same directory
docspdf:
-for d in $(DOCFILES); do (cd site && 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=site/{README,README2,MANUAL,NEWS,CONTRIBUTORS,SCREENSHOTS}.pdf code.pdf
viewall: pdf
2010-02-26 03:24:04 +03:00
$(VIEWPDF) $(PDFS)
# print all docs and code for offline reading
printall: pdf
2010-02-26 03:24:04 +03:00
$(PRINT) $(PDFS)
# push latest docs etc. and update the hledger.org site
2010-05-17 18:33:05 +04:00
pushdocs: push
2010-07-19 02:22:11 +04:00
ssh simon@joyful.com 'make -C/repos/hledger docs'
2009-06-02 23:54:45 +04:00
# generate api docs
# 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: ?
apidocs: haddock hscolour #sourcegraph #hoogle
sed -i -e 's%^></HEAD%><base target="main"></HEAD%' site/api-doc/modules-index.html ; \
cp site/api-doc-frames.html site/api-doc/index.html ; \
# cp site/hoogle-small.html site/api-doc
2009-06-02 23:54:45 +04:00
# generate and view the api docs
2010-03-13 03:19:05 +03:00
viewapidocs: apidocs
$(VIEWHTML) site/api-doc/index.html
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
2010-03-13 03:19:05 +03:00
HADDOCK=haddock -B `ghc --print-libdir` $(subst -D,--optghc=-D,$(DEFINEFLAGS)) --ignore-all-exports --no-warnings
haddock:
$(HADDOCK) -o site/api-doc -h --source-module=src-%{MODULE/./-}.html --source-entity=src-%{MODULE/./-}.html#%N $(MAIN) && \
cp site/api-doc/index.html site/api-doc/modules-index.html
cd hledger-lib; cabal haddock
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 \
$(HSCOLOUR) -anchor $$f -osite/api-doc/`echo "src/"$$f | sed -e's%/%-%g' | sed -e's%\.hs$$%.html%'` ; \
done ; \
cp site/api-doc/src-hledger.html site/api-doc/src-Main.html ; \
HsColour -print-css >site/api-doc/hscolour.css
sourcegraph:
-SourceGraph hledger.cabal
-cd hledger-lib; SourceGraph hledger-lib.cabal
#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
if test -f $(HOOGLE) ; then \
cd site/api-doc && \
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
2010-03-13 03:19:05 +03:00
hoogleindex:
$(HADDOCK) -o site/api-doc --hoogle $(MAIN) && \
cd site/api-doc && \
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:
# hledger --version
# hledger's cabal file
# darcs tags
# hackage tarball filenames
# hackage pages
#
2009-12-11 01:43:23 +03:00
# Some old version numbering goals:
# 1 automation, robustness, simplicity, platform independence
# 2 cabal versions must be all-numeric
# 3 release versions can be concise (without extra .0's)
# 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
# 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-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 simplebench" depends on version numbers in BENCHEXES, these also
2009-12-12 05:35:09 +03:00
# 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
release: releasetest setandrecordversion tagrelease sdist
2009-12-12 05:55:59 +03:00
# Upload the latest cabal package and update hledger.org
2010-05-24 03:45:12 +04:00
upload: hackageupload pushdocs
2009-12-12 05:55:59 +03:00
releaseandupload: release upload
2010-07-10 17:09:49 +04:00
# update the version number in local files, and prompt to record changes
# in these files. Triggered by "make release".
setandrecordversion: setversion
darcs record -m "bump version" $(VERSIONFILE) $(VERSIONSENSITIVEFILES)
2010-07-10 17:09:49 +04:00
# update the version string in local files. Triggered by "make".
setversion: $(VERSIONSENSITIVEFILES)
2010-07-18 02:02:19 +04:00
Hledger/Cli/Version.hs: $(VERSIONFILE)
perl -p -e "s/(^version *= *)\".*?\"/\1\"$(VERSION3)\"/" -i $@
hledger.cabal: $(VERSIONFILE)
perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@
perl -p -e "s/(^ *hledger-lib *[>=]=) *.*/\1 $(VERSION)/" -i $@
hledger-lib/hledger-lib.cabal: $(VERSIONFILE)
perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@
MANUAL.markdown: $(VERSIONFILE)
perl -p -e "s/(^This is the official.*?version) +[0-9.]+/\1 $(VERSION3)./" -i $@
2010-07-25 02:08:54 +04:00
DOWNLOAD.markdown: $(VERSIONFILE)
perl -p -e "s/hledger-[0-9.]+-/hledger-$(VERSION3)-/g" -i $@
tagrelease:
darcs tag $(VERSION3)
sdist:
2010-05-24 03:45:12 +04:00
cd hledger-lib; cabal sdist
cabal sdist
# display a hackage upload command reminder
hackageupload:
2010-05-24 03:45:12 +04:00
cabal upload hledger-lib/dist/hledger-lib-$(VERSION).tar.gz -v3
cabal upload dist/hledger-$(VERSION).tar.gz -v3
# send unpushed patches to the mail list
send:
darcs send http://joyful.com/repos/hledger --to=hledger@googlegroups.com --edit-description
# push patches and anything else pending to the public server
push: pushprofs pushbinary
2010-07-19 02:22:11 +04:00
darcs push simon@joyful.com:/repos/hledger
2008-10-18 08:34:41 +04:00
# pull anything pending from the public server
pull: pullprofs
2010-07-19 02:22:11 +04:00
darcs pull -a simon@joyful.com:/repos/hledger
# push any new profiles and benchmark results to the public site
# beware, results will vary depending on which machine generated them
pushprofs:
2010-07-19 02:22:11 +04:00
rsync -azP profs/ simon@joyful.com:/repos/hledger/profs/
# fetch any new profiles and benchmark results from the public site
pullprofs:
2010-07-19 02:22:11 +04:00
rsync -azP simon@joyful.com:/repos/hledger/profs/ profs/
# push a deployable binary for this platform to the public site
2009-06-28 07:17:02 +04:00
# make hledgerPLATFORM first
pushbinary:
-gzip -9 bin/$(BINARYFILENAME)
2010-09-06 03:52:18 +04:00
-rsync -aP bin/$(BINARYFILENAME).gz simon@joyful.com:/repos/hledger/site/download/
pushbinarywin:
cd bin; zip -9 $(BINARYFILENAME).zip $(BINARYFILENAME)
2010-09-06 03:52:18 +04:00
-rsync -aP bin/$(BINARYFILENAME).zip simon@joyful.com:/repos/hledger/site/download/
# show project stats useful for release notes
stats: showlastreleasedate showreleaseauthors showloc showcov showlocalchanges showreleasechanges #simplebench #showerrors
2009-01-21 01:27:32 +03:00
showreleaseauthors:
@echo Patch authors since last release:
@darcs changes --from-tag . |grep '^\w' |cut -c 31- |sort |uniq
@echo
showloc:
@echo Lines of code including tests:
@sloccount `ls $(SOURCEFILES)` | grep haskell:
@echo
showcov: hledgercov
@echo Test coverage:
@tools/coverage report test
showlastreleasedate:
@echo Last release date:
@darcs changes --from-tag . | tail -2
@echo
# showerrors:
# @echo Known errors:
# @awk '/^** errors/, /^** / && !/^** errors/' NOTES | grep '^\*\*\* ' | tail +1
# @echo
showlocalchanges:
@echo Local changes:
2010-07-19 02:22:11 +04:00
@-darcs push simon@joyful.com:/repos/hledger --dry-run | grep '*' | tac
@echo
showcodechanges:
@echo Code changes:
@darcs changes --matches "not (name docs: or name site: or name tools:)" | egrep '^ +(\*|tagged)'
@echo
showreleasechanges:
@echo "Feature/bugfix changes since last release: ("`darcs changes --from-tag . --count`")"
@darcs changes --from-tag . --matches "not (name docs: or name doc: or name site: or name tools:)" | grep '*'
@echo
######################################################################
# MISCELLANEOUS
2010-09-06 02:51:51 +04:00
#LOCAL
# deploy latest build at demo.hledger.org
deploy:
ssh -t simon@joyful.com make -C /repos/hledger deploy
# autobuild web ui showing my personal journal
autowebmine:
sp --no-exts --no-default-map -o bin/hledger ghc --make hledger.hs $(BUILDFLAGS) -DWEB --run web -B -f ~/personal/2010.journal
#
tag: emacstags
emacstags:
2010-07-10 17:50:54 +04:00
-@rm -f TAGS; hasktags -e $(SOURCEFILES) hledger.cabal Makefile
clean:
rm -rf `find . -name "*.o" -o -name "*.hi" -o -name "*~" -o -name "darcs-amend-record*" -o -name "*-darcs-backup*"`
2009-06-02 23:54:45 +04:00
Clean: clean cleandocs
rm -f bin/hledger TAGS tags
2008-10-03 11:40:28 +04:00