2009-01-25 12:00:57 +03:00
# hledger project makefile
2008-12-10 21:43:14 +03:00
2010-09-03 06:08:47 +04:00
# ghc 6.12 executables need a locale
export LANG = en_US.UTF-8
2010-05-22 04:46:32 +04:00
# command line to run during "make prof" and "make heap"
2010-07-13 10:30:06 +04:00
PROFCMD = bin/hledgerp -f data/1000x1000x10.journal balance >/dev/null
2009-05-29 23:26:09 +04:00
2009-06-04 05:33:31 +04:00
# command to run during "make coverage"
COVCMD = test
2010-02-13 21:39:49 +03:00
# 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.
2011-04-18 11:26:58 +04:00
BENCHEXES = hledger-0.12.1 hledger-0.13 hledger-0.14-ghc6.12.3 ledger
2010-07-19 07:36:14 +04:00
#BENCHEXES=hledger
2009-06-03 00:37:34 +04:00
2010-02-13 23:21:08 +03:00
# misc. tools
2011-06-13 23:50:10 +04:00
BROWSE = google-chrome
2011-06-15 02:32:26 +04:00
BROWSE = open -a 'Google Chrome'
2011-06-13 23:50:10 +04:00
VIEWHTML = $( BROWSE)
VIEWPS = $( BROWSE)
VIEWPDF = $( BROWSE)
2010-02-13 23:21:08 +03:00
PRINT = lpr
2009-05-29 23:49:11 +04:00
2010-11-14 22:40:57 +03:00
PACKAGES = \
hledger-lib \
hledger \
hledger-web \
2012-01-30 08:22:11 +04:00
# hledger-vty \
# hledger-chart
2010-11-14 22:40:57 +03:00
INCLUDEPATHS = \
2011-10-19 23:55:01 +04:00
-i../hledger-lib \
-i../hledger \
-i../hledger-web \
2012-01-30 08:22:11 +04:00
# -i../hledger-vty \
# -i../hledger-chart
2011-10-19 23:55:01 +04:00
MAIN = hledger-cli.hs
2011-06-03 21:10:27 +04:00
2010-11-20 00:39:17 +03:00
# all source files in the project (plus a few strays like Setup.hs & hlint.hs)
2009-09-23 18:49:04 +04:00
SOURCEFILES := \
2010-09-10 02:54:34 +04:00
hledger/*hs \
2011-07-19 04:56:15 +04:00
hledger/Hledger/*hs \
2010-12-06 00:14:45 +03:00
hledger/Hledger/*/*hs \
2010-09-10 02:54:34 +04:00
hledger-*/*hs \
2010-09-24 06:06:58 +04:00
hledger-*/Hledger/*hs \
2011-09-13 02:45:02 +04:00
hledger-*/Hledger/*/*hs \
hledger-web/Hledger/Web/Settings/*hs
2011-06-03 21:10:27 +04:00
2010-11-20 00:39:17 +03:00
# a more careful list suitable for for haddock
2011-08-19 22:39:13 +04:00
HADDOCKSOURCEFILES := \
2011-08-19 22:55:26 +04:00
hledger-lib/*hs \
2010-11-20 00:39:17 +03:00
hledger-lib/Hledger/*hs \
hledger-lib/Hledger/*/*hs \
2011-07-19 05:00:08 +04:00
hledger/Hledger/*hs \
2011-08-08 02:14:14 +04:00
hledger/Hledger/*/*hs \
hledger-web/Hledger/*hs \
hledger-web/Hledger/*/*hs \
2011-09-13 02:45:02 +04:00
hledger-web/Hledger/Web/Settings/*hs \
2012-03-07 20:05:04 +04:00
# hledger-vty/Hledger/*hs \
# hledger-vty/Hledger/*/*hs
2011-08-19 22:55:26 +04:00
# hledger-chart/Hledger/*hs
2011-06-03 21:10:27 +04:00
# hledger-chart/Hledger/*/*hs
2010-09-10 02:54:34 +04:00
CABALFILES := \
hledger/hledger.cabal \
hledger-*/*.cabal
2011-06-04 21:01:45 +04:00
WEBFILES := \
2011-09-13 02:45:02 +04:00
hledger-web/static/*.js \
hledger-web/static/*.css
# hledger-web/templates/* \
2011-06-04 21:01:45 +04:00
2012-03-11 22:39:26 +04:00
DOCFILES := \
*.md
2009-06-03 00:37:34 +04:00
PATCHLEVEL := $( shell expr ` darcs changes --count --from-tag= \\ \\ \. ` - 1)
2012-05-14 23:24:03 +04:00
WARNINGS := -W -fwarn-tabs -fno-warn-name-shadowing #-fwarn-orphans -fwarn-simple-patterns -fwarn-monomorphism-restriction
2010-12-07 04:54:51 +03:00
DEFINEFLAGS :=
2010-07-09 06:11:12 +04:00
PREFERMACUSRLIBFLAGS = -L/usr/lib
2012-04-03 21:12:47 +04:00
GHCMEMFLAGS = +RTS -M200m -RTS
BUILDFLAGS := -DMAKE $( WARNINGS) $( INCLUDEPATHS) $( PREFERMACUSRLIBFLAGS) -DPATCHLEVEL= $( PATCHLEVEL) $( GHCMEMFLAGS)
2010-12-07 04:54:51 +03:00
LINUXRELEASEBUILDFLAGS := -DMAKE $( WARNINGS) $( INCLUDEPATHS) -O2 -static -optl-static -optl-pthread
2010-12-11 01:07:52 +03:00
MACRELEASEBUILDFLAGS := -DMAKE $( WARNINGS) $( INCLUDEPATHS) $( PREFERMACUSRLIBFLAGS) -O2 # -optl-L/usr/lib
2010-12-07 04:54:51 +03:00
#WINDOWSRELEASEBUILDFLAGS:=-DMAKE $(WARNINGS) $(INCLUDEPATHS)
2009-06-13 22:21:56 +04:00
TIME := $( shell date +"%Y%m%d%H%M" )
2009-06-03 00:37:34 +04:00
2012-04-03 21:12:47 +04:00
# searchpath executable used for automatic recompilation, http://joyful.com/repos/searchpath
2012-05-07 00:39:47 +04:00
GHC = ghc-7.4.1
AUTOBUILD = sp --no-exts --no-default-map $( GHC) --make -O0 $( GHCMEMFLAGS)
2012-04-03 21:12:47 +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
i f e q ( $( shell ghc -e "length ( filter ( =='.') \"$ ( VERSION ) \") ") , 1 )
VERSION3 := $( VERSION) .0
e l s e
VERSION3 := $( VERSION)
e n d i f
# files which should be updated when the version changes
VERSIONSENSITIVEFILES = \
2010-09-10 02:54:34 +04:00
$( CABALFILES) \
2011-09-02 19:17:22 +04:00
MANUAL.md \
# DOWNLOAD.md \
2012-01-31 10:01:31 +04:00
# source file which should be touched to ensure up to date version string
VERSIONHS = hledger/Hledger/Cli/Version.hs
2010-05-24 03:45:12 +04:00
2011-06-06 23:07:03 +04:00
# get an accurate binary filename from the current source on the current platform
# nb not := as that would break the makefile when hledger is not compiling.
BINARYFILENAME = $( shell touch $( VERSIONHS) ; runhaskell -ihledger -ihledger-lib $( MAIN) --binary-filename)
2010-12-11 01:00:42 +03:00
RELEASEBINARYSUFFIX := $( shell echo " - $( VERSION) -`uname`-`arch` " | tr '[:upper:]' '[:lower:]' )
2011-06-06 23:07:03 +04:00
default : tag bin /hledger
2009-05-29 12:29:04 +04:00
######################################################################
2009-06-04 05:33:31 +04:00
# BUILDING
2009-05-29 12:29:04 +04:00
2012-01-29 22:36:51 +04:00
# cabal install all hledger PACKAGES and dependencies in the proper order
# (or, as many as possible)
2012-03-05 11:23:35 +04:00
EXTRAINSTALLARGS =
2012-01-29 22:36:51 +04:00
install :
2012-03-05 11:23:35 +04:00
cabal install $( patsubst %,./%,$( PACKAGES) ) $( EXTRAINSTALLARGS)
2012-01-29 22:36:51 +04:00
2012-03-05 11:23:35 +04:00
# run a cabal command in all hledger package dirs
allcabal% :
for p in $( PACKAGES) ; do ( echo doing cabal $* in $$ p; cd $$ p; cabal $* ; echo ) ; done
2012-01-29 22:36:51 +04:00
# # run a command in all hledger package dirs
# all%:
# for p in $(PACKAGES); do (echo doing $* in $$p; cd $$p; $*); done
2008-10-17 20:59:05 +04:00
2011-10-19 23:55:01 +04:00
# auto-recompile and run (something, eg --help or unit tests) whenever a module changes
2012-05-14 23:24:03 +04:00
auto : sp
cd hledger; $( AUTOBUILD) $( MAIN) -o ../bin/hledger $( BUILDFLAGS) --run --version
autotest : sp
2011-10-19 23:55:01 +04:00
cd hledger; $( AUTOBUILD) $( MAIN) -o ../bin/hledger $( BUILDFLAGS) --run test
2010-09-10 05:57:41 +04:00
2012-05-27 22:15:36 +04:00
autotest-% : sp
cd hledger; $( AUTOBUILD) $( MAIN) -o ../bin/hledger $( BUILDFLAGS) --run test $*
2012-05-14 23:24:03 +04:00
autoweb : sp
2012-04-03 21:12:47 +04:00
cd hledger-web; $( AUTOBUILD) hledger-web.hs -o ../bin/hledger-web $( BUILDFLAGS) -DDEVELOPMENT --run -B --port 5001 --base-url http://localhost:5001 -f test.journal
2010-11-26 22:35:13 +03:00
2012-05-14 23:24:03 +04:00
autovty : sp
2011-10-19 23:55:01 +04:00
cd hledger-vty; $( AUTOBUILD) hledger-vty.hs -o ../bin/hledger-vty $( BUILDFLAGS) --run --help
2010-11-26 22:35:13 +03:00
2012-05-14 23:24:03 +04:00
autochart : sp
2011-10-19 23:55:01 +04:00
cd hledger-chart; $( AUTOBUILD) hledger-chart.hs -o ../bin/hledger-chart $( BUILDFLAGS) --run --help
2010-11-13 03:07:20 +03:00
2011-08-08 02:18:54 +04:00
# check for sp and explain how to get it if not found.
2011-06-23 22:15:01 +04:00
sp :
@/usr/bin/env which sp >/dev/null || \
2012-03-12 00:16:45 +04:00
( echo '"sp" is required for auto-compilation. darcs get http://joyful.com/darcsden/simon/searchpath, make it (cabal install-ing any needed packages) and add it to your PATH' ; exit 1)
2011-06-23 22:15:01 +04:00
2010-12-11 01:09:32 +03:00
hledgerall : bin /hledger hledger -web hledger -vty hledger -chart
2010-11-29 04:15:08 +03:00
2011-03-13 02:30:57 +03:00
# force a compile even if binary exists, since we don't specify dependencies
.PHONY : bin /hledger hledger -web hledger -vty hledger -chart
2011-10-19 23:55:01 +04:00
# build hledger binary as quickly as possible
2010-12-11 01:34:01 +03:00
bin/hledger :
2011-10-19 23:55:01 +04:00
cd hledger; ghc --make $( MAIN) -o ../bin/hledger $( BUILDFLAGS)
2010-11-29 04:15:08 +03:00
2012-03-26 22:18:18 +04:00
# build a GHC-version-specific hledger binary without disturbing with other GHC version builds
2012-03-30 00:41:47 +04:00
bin/hledger.ghc-% : $( SOURCEFILES )
2012-03-26 22:18:18 +04:00
cd hledger; ghc-$* --make $( MAIN) -o ../$@ $( BUILDFLAGS) -outputdir .ghc-$*
# build hledger with the main supported GHC versions
2012-03-30 00:41:47 +04:00
bin/hledger.ghcall : \
2012-03-26 22:18:18 +04:00
bin/hledger.ghc-7.4.1 \
2012-03-30 00:41:47 +04:00
bin/hledger.ghc-7.2.2 \
bin/hledger.ghc-7.0.4 \
2012-05-29 04:53:52 +04:00
# bin/hledger.ghc-6.12.3 \
2012-03-26 22:18:18 +04:00
2011-10-19 23:55:01 +04:00
# build the fastest binary we can
hledgeropt :
cd hledger; ghc --make $( MAIN) -o bin/hledgeropt $( BUILDFLAGS) -O2 # -fvia-C # -fexcess-precision -optc-O3 -optc-ffast-math
2010-11-29 04:15:08 +03:00
2011-10-19 23:55:01 +04:00
# build the time profiling binary. cabal install --reinstall -p some libs may be required.
hledgerp :
cd hledger; ghc --make $( MAIN) -prof -auto-all -o ../bin/hledgerp $( BUILDFLAGS)
2011-09-13 04:10:00 +04:00
2011-10-19 23:55:01 +04:00
# build the heap profiling binary for coverage reports and heap profiles.
# Keep these .o files separate from the regular ones.
hledgerhpc :
cd hledger; ghc --make $( MAIN) -fhpc -o ../bin/hledgerhpc -outputdir .hledgerhpcobjs $( BUILDFLAGS)
2010-11-29 04:15:08 +03:00
2011-10-19 23:55:01 +04:00
# build other executables quickly
2010-09-10 02:54:34 +04:00
2011-10-19 23:55:01 +04:00
bin/hledger-web :
cd hledger-web; ghc --make hledger-web.hs -o ../bin/hledger-web $( BUILDFLAGS)
2010-09-10 02:54:34 +04:00
2011-10-19 23:55:01 +04:00
bin/hledger-web-production :
2012-04-03 21:25:24 +04:00
cd hledger-web; ghc --make hledger-web.hs -o ../$@ $( BUILDFLAGS)
2010-09-10 02:54:34 +04:00
2011-10-19 23:55:01 +04:00
bin/hledger-vty :
cd hledger-vty; ghc --make hledger-vty.hs -o ../bin/hledger-vty $( BUILDFLAGS)
2010-09-10 02:54:34 +04:00
2011-10-19 23:55:01 +04:00
bin/hledger-chart :
cd hledger-chart; ghc --make hledger-chart.hs -o ../bin/hledger-chart $( BUILDFLAGS)
2010-09-10 02:54:34 +04:00
2010-12-11 01:34:01 +03:00
# build portable releaseable binaries for gnu/linux
linuxbinaries : linuxbinary -hledger \
linuxbinary-hledger-web \
linuxbinary-hledger-vty \
linuxbinary-hledger-chart
@echo 'Please check the binaries look portable, then make compressbinaries:'
-file bin/*` arch`
2010-09-10 02:54:34 +04:00
2010-12-11 01:00:42 +03:00
linuxbinary-% :
ghc --make $* /$* .hs -o bin/$* $( RELEASEBINARYSUFFIX) $( LINUXRELEASEBUILDFLAGS)
# XXX link errors
linuxbinary-hledger-chart :
ghc --make hledger-chart/hledger-chart.hs -o bin/hledger-chart$( RELEASEBINARYSUFFIX) $( LINUXRELEASEBUILDFLAGS) -lpixman-1 -v
2011-04-23 02:57:00 +04:00
macbinaries : macbinary -hledger \
macbinary-hledger-vty \
macbinary-hledger-web \
macbinary-hledger-chart
@echo 'Please check the binaries are portable, then make compressbinaries'
2010-12-11 01:34:01 +03:00
otool -L bin/*` arch`
2010-09-10 02:54:34 +04:00
2011-04-23 02:57:00 +04:00
# build a deployable mac binary for the specified hledger package, munging
# the link command to use only standard osx libs. Specifically we link
# without the non-standard GMP framework, which causes no apparent harm.
# Clunky, does the link twice.
macbinary-% :
BINARY = ` echo $( BINARYFILENAME) | sed -e 's/hledger/$*/' ` ; \
2011-10-19 23:55:01 +04:00
LINKCMD = ` cd $* && ghc -v --make $* .hs $( MACRELEASEBUILDFLAGS) -o ../bin/$$ BINARY 2>& 1 | egrep " bin/gcc.*bin/ $$ BINARY " ` ; \
2011-04-23 02:57:00 +04:00
PORTABLELINKCMD = ` echo $$ LINKCMD | sed -e 's/ -framework GMP//' ` ; \
echo $$ PORTABLELINKCMD; $$ PORTABLELINKCMD
# Run this on a windows machine or in a wine session, and probably in a
# separate copy of the repo (hledger-win).
# Builds and gather deployable binaries for windows, if cygwin tools are
# present and all packages are buildable. Otherwise, cabal install each
# package and gather the binaries by hand.
windowsbinaries : install
2010-09-10 02:54:34 +04:00
cp ~/.cabal/bin/hledger.exe bin/` echo $( BINARYFILENAME) | dos2unix`
2010-12-07 04:54:51 +03:00
-cp ~/.cabal/bin/hledger-web.exe bin/` echo $( BINARYFILENAME) | sed -e 's/hledger/hledger-web/' | dos2unix`
-cp ~/.cabal/bin/hledger-vty.exe bin/` echo $( BINARYFILENAME) | sed -e 's/hledger/hledger-vty/' | dos2unix`
-cp ~/.cabal/bin/hledger-chart.exe bin/` echo $( BINARYFILENAME) | sed -e 's/hledger/hledger-chart/' | dos2unix`
2011-04-23 02:57:00 +04:00
@echo 'Please check the binaries are portable, then make compressbinaries'
2010-12-07 04:54:51 +03:00
ls -l bin/*` arch`
2011-09-27 00:51:09 +04:00
# One way to get a wine command prompt
wine :
wineconsole cmd.exe &
2010-12-07 04:54:51 +03:00
compressbinaries :
2011-04-23 02:57:00 +04:00
cd bin; for f in *-windows-*.exe ; do echo zipping $$ f; rm -f $$ f.zip; zip $$ f.zip $$ f; done
# for f in bin/*-{linux,mac-}* ; do echo gzipping $$f; gzip -q $$f >$$f.gz; done
# gzip bin/*`arch`
2011-10-19 23:55:01 +04:00
# build the standalone unit test runner. Requires test-framework, which
# may not work on windows.
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
######################################################################
# DOCUMENTATION
######################################################################
# RELEASING
# set up this repo copy for previewing a release:
# ensure download links work
set-up-rc-repo :
cd site/_site; ln -s ../download
2011-04-23 02:57:00 +04:00
2011-10-19 23:55:01 +04:00
######################################################################
# MISCELLANEOUS
######################################################################
# OLD PRE PKG SPLIT
######################################################################
2010-09-10 02:54:34 +04:00
######################################################################
# TESTING
2012-03-30 00:41:47 +04:00
SHELLTEST = shelltest
2012-03-28 22:16:46 +04:00
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
2010-09-07 01:00:19 +04:00
# consider hiding dev-build symlinks in Hledger/ first
releasetest : Clean 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
2009-11-25 14:41:25 +03:00
unittest : unittest -builtin
2009-06-28 07:17:02 +04:00
2010-12-11 01:09:32 +03:00
unittest-builtin : bin /hledger
2012-03-26 22:18:18 +04:00
@echo unit tests:
2010-05-24 02:49:03 +04:00
@( bin/hledger test \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
2009-06-05 15:15:32 +04:00
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
2012-03-26 22:18:18 +04:00
@echo unit tests ( standalone) :
2009-06-28 07:17:02 +04:00
@( tools/unittest \
2010-09-06 03:24:34 +04:00
&& 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
2012-03-26 22:18:18 +04:00
unittest-interpreted :
@echo unit tests ( interpreted) :
2010-11-14 22:40:57 +03:00
@( runghc $( MAIN) test \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
2008-12-05 12:28:24 +03:00
2010-09-03 06:08:47 +04:00
# run functional tests, requires shelltestrunner >= 0.9 from hackage
2010-07-18 03:09:24 +04:00
# 16 threads sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless
2011-08-26 01:51:54 +04:00
functest : bin /hledger
2012-03-26 22:18:18 +04:00
@echo functional tests:
2012-03-28 22:16:46 +04:00
( $( SHELLTEST) tests -- --threads= 16 --hide-successes \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
2009-06-27 12:15:00 +04:00
2012-03-26 22:18:18 +04:00
# run unit and functional tests with a specific GHC version
2012-03-30 00:41:47 +04:00
# some functional tests (add, include, read-csv..) have bin/hledger hard coded - might need to symlink it
2012-03-26 22:18:18 +04:00
test-ghc-% : # bin/hledger.ghc-$*
2012-03-28 22:16:46 +04:00
@echo; echo testing hledger built with ghc-$*
2012-03-26 22:18:18 +04:00
@( echo unit tests: \
&& bin/hledger.ghc-$* test \
&& echo functional tests: \
2012-03-28 22:16:46 +04:00
&& $( SHELLTEST) tests -w bin/hledger.ghc-$* -- --threads= 16 --hide-successes \
2012-03-26 22:18:18 +04:00
&& echo $@ PASSED) || echo $@ FAILED
# run unit and functional tests with main supported GHC versions
2012-03-30 00:41:47 +04:00
test-ghcall : bin /hledger .ghcall \
test-ghc-7.4.1 \
test-ghc-7.2.2 \
test-ghc-7.0.4 \
test-ghc-6.12.3 \
2012-03-26 22:18:18 +04:00
2009-03-15 08:15:59 +03:00
# run doc tests
2010-09-10 02:54:34 +04:00
DOCTESTFILES = \
hledger/Hledger/Cli/Tests.hs
doctest : tools /doctest
@for f in $( DOCTESTFILES) ; do \
( tools/doctest $$ f && echo $@ PASSED) || echo $@ FAILED ; done
2009-03-15 11:47:23 +03:00
2009-05-29 12:29:04 +04:00
# make sure we have no haddock errors
haddocktest :
2011-08-19 23:58:56 +04:00
@( make --quiet haddock \
2010-09-06 03:24:34 +04:00
&& echo $@ PASSED) || echo $@ FAILED
2009-06-05 15:15:32 +04:00
2010-12-11 01:09:32 +03:00
# needs updating
2009-06-05 15:15:32 +04:00
# 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-05 15:15:32 +04:00
2011-04-18 11:26:58 +04:00
# make sure cabal is reasonably happy
quickcabaltest :
@( make --no-print-directory allcabalclean allcabalcheck allcabalconfigure \
&& echo $@ PASSED) || echo $@ FAILED
2010-12-11 01:09:32 +03:00
2009-06-28 07:17:02 +04:00
# make sure cabal is happy in all possible ways
2011-04-18 11:26:58 +04:00
fullcabaltest :
2011-04-22 23:04:47 +04:00
( for p in $( PACKAGES) ; do ( echo " testing $$ p package " && cd $$ p && cabal clean && cabal check && cabal install && cabal sdist && cabal upload dist/$$ p-$( VERSION) .tar.gz --check -v3) ; done \
2011-04-18 11:26:58 +04:00
&& echo $@ PASSED) || echo $@ FAILED
2009-03-15 08:15:59 +03:00
2010-11-20 01:04:20 +03:00
# run simple performance benchmarks without saving results
2010-05-23 01:24:07 +04:00
# Requires some commands defined in bench.tests and some BENCHEXES defined above.
2010-07-13 10:30:06 +04:00
quickbench : samplejournals bench .tests tools /simplebench
2010-05-23 01:24:07 +04:00
tools/simplebench -fbench.tests $( BENCHEXES)
@rm -f benchresults.*
2010-11-20 01:04:20 +03:00
# run simple performance benchmarks and archive results
2009-12-12 05:25:27 +03:00
# Requires some commands defined in bench.tests and some BENCHEXES defined above.
2010-07-13 10:30:06 +04:00
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.*
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
2010-02-13 21:39:49 +03:00
# run criterion benchmark tests and save graphical results
2010-07-13 10:30:06 +04:00
criterionbench : samplejournals tools /criterionbench
2010-02-13 21:39:49 +03:00
tools/criterionbench -t png -k png
# run progression benchmark tests and save graphical results
2010-07-13 10:30:06 +04:00
progressionbench : samplejournals tools /progressionbench
2010-02-13 21:39:49 +03:00
tools/progressionbench -- -t png -k png
2010-11-20 01:04:20 +03:00
# generate and archive an execution profile
2010-07-13 10:30:06 +04:00
prof : samplejournals hledgerp
2010-05-22 04:46:32 +04:00
@echo " Profiling: $( PROFCMD) "
-$( PROFCMD) +RTS -p -RTS
2010-11-20 01:04:20 +03:00
mv hledgerp.prof profs/$( TIME) .prof
( cd profs; rm -f latest*.prof; ln -s $( TIME) .prof latest.prof)
# generate, archive, simplify and display an execution profile
viewprof : prof
tools/simplifyprof.hs profs/latest.prof
2009-06-04 05:33:31 +04:00
2010-05-22 04:46:32 +04:00
# generate and display an execution profile, don't save or simplify
2010-07-13 10:30:06 +04:00
quickprof : samplejournals hledgerp
2010-05-22 04:46:32 +04:00
@echo " Profiling: $( PROFCMD) "
-$( PROFCMD) +RTS -p -RTS
echo; cat hledgerp.prof
2010-11-20 01:04:20 +03:00
# generate and archive a graphical heap profile
2010-07-13 10:30:06 +04:00
heap : samplejournals hledgerp
2010-05-22 04:46:32 +04:00
@echo " Profiling heap with: $( PROFCMD) "
$( PROFCMD) +RTS -hc -RTS
2009-06-04 05:33:31 +04:00
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-11-20 01:04:20 +03:00
viewheap : heap
2010-02-26 03:24:04 +03:00
$( VIEWPS) profs/latest.ps
2009-06-04 05:33:31 +04:00
2010-05-22 04:46:32 +04:00
# generate and display a graphical heap profile, don't save
2010-07-13 10:30:06 +04:00
quickheap : samplejournals hledgerp
2010-05-22 04:46:32 +04:00
@echo " Profiling heap with: $( PROFCMD) "
$( PROFCMD) +RTS -hc -RTS
hp2ps hledgerp.hp
$( VIEWPS) hledger.ps
2011-04-22 22:47:12 +04:00
# display a code coverage text report from running hledger COVCMD
quickcoverage :
@echo " Generating code coverage text report for hledger command: $( COVCMD) "
tools/runhledgerhpc "report" $( COVCMD)
# generate a code coverage html report from running hledger COVCMD
coverage : samplejournals hledgerhpc
@echo " Generating code coverage html report for hledger command: $( COVCMD) "
tools/runhledgerhpc "markup --destdir=profs/coverage" $( COVCMD)
2009-06-04 05:33:31 +04:00
cd profs/coverage; rm -f index.html; ln -s hpc_index.html index.html
2010-11-20 01:04:20 +03:00
2011-04-22 22:47:12 +04:00
# view the last html code coverage report
viewcoverage :
2010-02-26 03:24:04 +03:00
$( VIEWHTML) profs/coverage/index.html
2009-06-04 05:33:31 +04:00
2009-06-05 15:15:32 +04:00
# get a debug prompt
ghci :
2012-01-04 16:01:21 +04:00
cd hledger; ghci $( INCLUDEPATHS) $( MAIN)
2009-06-05 15:15:32 +04:00
2011-06-21 00:36:50 +04:00
ghci-vty :
ghci $( INCLUDEPATHS) hledger-vty/Hledger/Vty/Main.hs
2010-07-13 10:30:06 +04:00
# generate standard sample journals
samplejournals : data /sample .journal data /100x 100x 10.journal data /1000x 1000x 10.journal data /10000x 1000x 10.journal data /100000x 1000x 10.journal
2009-05-29 12:29:04 +04:00
2010-07-13 10:30:06 +04:00
data/sample.journal :
2009-05-29 12:29:04 +04:00
true # XXX should probably regenerate this
2010-07-13 10:30:06 +04:00
data/100x100x10.journal : tools /generatejournal
tools/generatejournal 100 100 10 >$@
2009-05-29 12:29:04 +04:00
2010-07-13 10:30:06 +04:00
data/1000x1000x10.journal : tools /generatejournal
tools/generatejournal 1000 1000 10 >$@
2008-11-26 22:00:55 +03:00
2010-07-13 10:30:06 +04:00
data/10000x1000x10.journal : tools /generatejournal
tools/generatejournal 10000 1000 10 >$@
2009-05-17 18:13:06 +04:00
2010-07-13 10:30:06 +04:00
data/100000x1000x10.journal : tools /generatejournal
tools/generatejournal 100000 1000 10 >$@
2009-05-29 12:29:04 +04:00
######################################################################
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.
2010-05-31 05:23:30 +04:00
# site/ contains both html generated from these (UPPERCASE.html) and
2011-09-02 02:18:59 +04:00
# revision-controlled resource files (everything else). site/api
2009-07-15 01:51:10 +04:00
# contains only generated files.
2009-06-02 23:54:45 +04:00
cleandocs :
2011-09-02 02:18:59 +04:00
rm -rf site/[ A-Z] *.html site/api/*
2009-06-02 10:20:19 +04:00
2009-06-02 23:54:45 +04:00
# rebuild all docs
2010-11-20 00:39:17 +03:00
docs : site codedocs
2010-05-17 18:33:05 +04:00
# build the hledger.org website
# Requires hakyll (cabal install hakyll)
2010-05-21 22:19:00 +04:00
.PHONY : site
2011-09-23 02:24:02 +04:00
site : site /site
cd site; ./site build
2010-09-03 06:08:47 +04:00
2011-09-23 02:24:02 +04:00
cleansite : site /site
cd site; ./site clean
2010-05-17 18:33:05 +04:00
2011-09-23 02:24:02 +04:00
previewsite : site /site
cd site; ./site preview
2010-05-31 05:23:30 +04:00
2011-09-23 02:24:02 +04:00
site/site : site /site .hs
cd site; ghc --make site.hs $( PREFERMACUSRLIBFLAGS)
2010-05-17 18:33:05 +04:00
2011-08-28 22:03:20 +04:00
autosite :
2011-09-23 02:24:02 +04:00
cd site; $( AUTOBUILD) site.hs -o site $( PREFERMACUSRLIBFLAGS) --run preview
2010-07-18 03:09:24 +04:00
2010-05-17 18:33:05 +04:00
viewsite : site
2010-05-21 22:19:00 +04:00
$( VIEWHTML) site/_site/index.html
2009-05-29 12:29:04 +04:00
2010-05-26 04:32:19 +04:00
# called on each darcs commit
2011-06-03 21:08:09 +04:00
commithook : docs
2010-05-26 04:32:19 +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
2010-05-17 18:33:05 +04:00
# html:
2010-05-31 05:23:30 +04:00
# 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
2009-06-02 10:58:43 +04:00
2010-02-26 03:23:44 +03: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-09-10 02:54:34 +04:00
# docspdf:
# -for d in $(DOCFILES); do (cd site && ln -sf ../$$d && pandoc $$d -w pdf && rm -f $$d); done
2010-02-13 23:21:08 +03:00
# format all code as a pdf for offline reading
2011-09-02 05:00:53 +04:00
ENSCRIPT = enscript -q --header= '$$n|$$D{%+}|Page $$% of $$=' --highlight= haskell --line-numbers --font= Courier6 --color -o-
2010-02-13 23:21:08 +03:00
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
2010-05-31 05:23:30 +04:00
PDFS = site/{ README,README2,MANUAL,NEWS,CONTRIBUTORS,SCREENSHOTS} .pdf code.pdf
2010-02-13 23:21:08 +03:00
viewall : pdf
2010-02-26 03:24:04 +03:00
$( VIEWPDF) $( PDFS)
2010-02-13 23:21:08 +03:00
# print all docs and code for offline reading
printall : pdf
2010-02-26 03:24:04 +03:00
$( PRINT) $( PDFS)
2010-02-13 23:21:08 +03:00
# 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-05-29 12:29:04 +04:00
2011-04-22 20:16:31 +04:00
# dump all executables' command line help into files for review
EXES = hledger hledger-vty hledger-web hledger-chart
savehelp :
for e in $( EXES) ; do $$ e --help >.HELP_$$ e; done
2010-11-20 00:39:17 +03:00
# generate api & other code docs
2011-08-30 17:48:24 +04:00
codedocs : haddock hscolour coverage #sourcegraph #hoogle
2010-11-20 00:39:17 +03:00
#http://www.haskell.org/haddock/doc/html/invoking.html
#$(subst -D,--optghc=-D,$(DEFINEFLAGS))
2011-04-22 23:04:47 +04:00
HADDOCK = haddock --no-warnings --prologue .haddockprologue #--optghc='-hide-package monads-tf'
2010-11-20 00:39:17 +03:00
.haddocksynopsis : hledger /hledger .cabal
grep synopsis $< | sed -e 's/synopsis: *//' >$@
.haddockprologue : hledger /hledger .cabal
cat $< | perl -ne 'print if (/^description:/../^$$/)' | sed -e 's/^description: *//' >$@
printf "\nThis haddock covers all hledger-* packages, for individual package haddocks see hackage.\n" >>$@
2011-08-30 17:48:24 +04:00
# generate api docs for the whole project
2012-03-07 20:05:04 +04:00
# we define HADDOCK to disable cabal-file-th code which requires a cabal file in the current dir
2011-10-20 00:00:08 +04:00
haddock : .haddockprologue
2011-08-30 17:48:24 +04:00
$( HADDOCK) --title "hledger-* API docs" \
2012-03-07 20:05:04 +04:00
--optghc '-DHADDOCK' \
2011-09-02 02:18:59 +04:00
-o site/api \
2010-11-20 00:39:17 +03:00
--html \
2011-08-30 17:48:24 +04:00
--source-module= src/%{ MODULE/./-} .html \
--source-entity= src/%{ MODULE/./-} .html#%N \
2011-08-19 22:39:13 +04:00
$( HADDOCKSOURCEFILES)
2010-11-20 00:39:17 +03:00
2011-08-30 17:48:24 +04:00
# browse the api docs
viewhaddock :
2012-03-30 03:38:36 +04:00
$( VIEWHTML) site/api/frames.html
2011-08-30 17:48:24 +04:00
2011-06-03 21:10:27 +04:00
# http://www.cs.york.ac.uk/fp/darcs/hscolour/
HSCOLOUR = HsColour -css
2011-09-02 02:18:59 +04:00
hscolour : site /api /src site /api /src /hscolour .css
2011-08-19 22:39:13 +04:00
for f in $( HADDOCKSOURCEFILES) ; do \
2011-09-02 02:18:59 +04:00
$( HSCOLOUR) -anchor $$ f -osite/api/src/` echo $$ f | sed -e's%[^/]*/%%' | sed -e's%/%-%g' | sed -e's%\.hs$$%.html%' ` ; \
2010-11-20 00:39:17 +03:00
done
2009-05-29 12:29:04 +04:00
2011-09-02 02:18:59 +04:00
site/api/src/hscolour.css : site /api /src
$( HSCOLOUR) -print-css >site/api/src/hscolour.css
2011-06-06 23:06:26 +04:00
2011-09-02 02:18:59 +04:00
site/api/src :
mkdir -p site/api/src
2011-06-06 23:06:26 +04:00
2010-04-07 03:44:51 +04:00
sourcegraph :
2010-11-20 00:39:17 +03:00
for p in $( PACKAGES) ; do ( cd $$ p; SourceGraph $$ p.cabal) ; done
2012-05-14 23:24:03 +04:00
patchdeps :
darcs2dot > patchdeps.dot && dot -Tpng -O patchdeps.dot
2010-11-20 00:39:17 +03:00
# # generate external api docs for each package
# allhaddock: allcabalhaddock\ --hyperlink-source\ --executables
# # generate internal code docs for each package
# allhaddockinternal: allcabalhaddock\ --hyperlink-source\ --executables\ --internal
# # generate hoogle indices for each package
# allhoogle: allcabalhaddock\ --hoogle\ --executables
2010-04-07 03:44:51 +04:00
2009-05-29 12:29:04 +04:00
#set up the hoogle web interface
2010-11-20 00:39:17 +03: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".
## XXX move the framed index building into haddock: ?
2011-09-02 02:18:59 +04:00
# sed -i -e 's%^></HEAD%><base target="main"></HEAD%' site/api/modules-index.html ; \
# cp site/api-frames.html site/api/index.html ; \
# # cp site/hoogle-small.html site/api
2010-11-20 00:39:17 +03:00
#
2009-05-29 12:29:04 +04:00
#uses a hoogle source tree configured with --datadir=., patched to fix haddock urls/target frame
2010-11-20 00:39:17 +03:00
# HOOGLESRC=/usr/local/src/hoogle
# HOOGLE=$(HOOGLESRC)/dist/build/hoogle/hoogle
# HOOGLEVER=`$(HOOGLE) --version |tail -n 1 | sed -e 's/Version /hoogle-/'`
# hoogle: hoogleindex
# if test -f $(HOOGLE) ; then \
2011-09-02 02:18:59 +04:00
# cd site/api && \
2010-11-20 00:39:17 +03: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
#
2009-05-29 12:29:04 +04:00
#generate a hoogle index
2010-11-20 00:39:17 +03:00
# hoogleindex:
2011-09-02 02:18:59 +04:00
# $(HADDOCK) -o site/api --hoogle $(MAIN) && \
# cd site/api && \
2010-11-20 00:39:17 +03:00
# hoogle --convert=main.txt --output=default.hoo
2009-05-29 12:29:04 +04:00
######################################################################
# 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.
#
2010-02-13 21:39:49 +03:00
# - "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
2010-09-07 01:00:19 +04:00
# First update VERSION. Eg:
# a normal release: echo 0.7 >VERSION; make release
2009-12-12 23:40:54 +03:00
# a bugfix release: echo 0.7.1 >VERSION; make release
2010-09-07 01:00:19 +04:00
release : releasetest setandrecordversion tagrelease
2009-06-22 23:52:58 +04:00
2009-12-12 05:55:59 +03:00
# Upload the latest cabal package and update hledger.org
2010-12-11 01:09:32 +03:00
upload : allcabalsdist hackageupload pushdocs
2009-12-12 05:55:59 +03:00
releaseandupload : release upload
2009-02-27 05:55:54 +03:00
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".
2011-04-18 11:26:58 +04:00
setandrecordversion : setversion
2010-07-18 03:09:24 +04:00
darcs record -m "bump version" $( VERSIONFILE) $( VERSIONSENSITIVEFILES)
2010-07-10 17:09:49 +04:00
2010-12-07 04:54:51 +03:00
# update the version string in local files. This should be run immediately
# after editing the VERSION file.
2010-07-10 17:09:49 +04:00
setversion : $( VERSIONSENSITIVEFILES )
2010-12-07 04:54:51 +03:00
# re-update version string even if it seems unchanged
2010-09-10 02:54:34 +04:00
Setversion :
touch $( VERSIONFILE) ; make setversion
hledger-lib/hledger-lib.cabal : $( VERSIONFILE )
perl -p -e " s/(^ *version:) *.*/\1 $( VERSION) / " -i $@
2010-12-07 04:54:51 +03:00
hledger/hledger.cabal : $( VERSIONFILE )
2010-04-15 02:36:11 +04:00
perl -p -e " s/(^ *version:) *.*/\1 $( VERSION) / " -i $@
2010-09-10 02:54:34 +04:00
perl -p -e " s/(^[ ,]*hledger-lib *[>=]=) *.*/\1 $( VERSION) / " -i $@
2009-02-27 05:55:54 +03:00
2010-09-10 02:54:34 +04:00
hledger-chart/hledger-chart.cabal : $( VERSIONFILE )
perl -p -e " s/(^ *version:) *.*/\1 $( VERSION) / " -i $@
perl -p -e " s/(^[ ,]*hledger *[>=]=) *.*/\1 $( VERSION) / " -i $@
perl -p -e " s/(^[ ,]*hledger-lib *[>=]=) *.*/\1 $( VERSION) / " -i $@
hledger-vty/hledger-vty.cabal : $( VERSIONFILE )
perl -p -e " s/(^ *version:) *.*/\1 $( VERSION) / " -i $@
perl -p -e " s/(^[ ,]*hledger *[>=]=) *.*/\1 $( VERSION) / " -i $@
perl -p -e " s/(^[ ,]*hledger-lib *[>=]=) *.*/\1 $( VERSION) / " -i $@
hledger-web/hledger-web.cabal : $( VERSIONFILE )
2010-04-15 02:36:11 +04:00
perl -p -e " s/(^ *version:) *.*/\1 $( VERSION) / " -i $@
2010-09-10 02:54:34 +04:00
perl -p -e " s/(^[ ,]*hledger *[>=]=) *.*/\1 $( VERSION) / " -i $@
perl -p -e " s/(^[ ,]*hledger-lib *[>=]=) *.*/\1 $( VERSION) / " -i $@
2009-02-27 05:55:54 +03:00
2012-01-31 09:17:15 +04:00
MANUAL.md : $( VERSIONFILE )
perl -p -e " s/(^This is the.*?manual.*? for hledger.*?) +[0-9.]+/\1 $( VERSION3) ./ " -i $@
2010-07-18 03:09:24 +04:00
2012-01-31 09:17:15 +04:00
DOWNLOAD.md : $( VERSIONFILE )
2011-04-18 11:26:58 +04:00
perl -p -e " s/hledger(|-chart|-web|-vty)-[0-9.]+-/hledger\1- $( VERSION) -/g " -i $@
2010-07-25 02:08:54 +04:00
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
2009-05-29 12:29:04 +04:00
# display a hackage upload command reminder
2009-02-27 05:55:54 +03:00
hackageupload :
2010-12-11 01:09:32 +03:00
for p in $( PACKAGES) ; do cabal upload $$ p/dist/$$ p-$( VERSION) .tar.gz -v3; done
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
2011-04-23 02:57:00 +04:00
push : pushprofs # pushlatestbinary
2010-07-19 02:22:11 +04:00
darcs push simon@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
2010-07-19 02:22:11 +04:00
darcs pull -a simon@joyful.com:/repos/hledger
2009-05-30 01:00:38 +04:00
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 :
2010-07-19 02:22:11 +04:00
rsync -azP profs/ simon@joyful.com:/repos/hledger/profs/
2009-05-30 01:00:38 +04:00
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 :
2010-07-19 02:22:11 +04:00
rsync -azP simon@joyful.com:/repos/hledger/profs/ profs/
2009-05-29 23:26:09 +04:00
2010-09-07 01:00:19 +04:00
# compress the just-built platform binary. make hledgerPLATFORM first. Use
# the win variant on windows.
compressbinary :
gzip -9 bin/$( BINARYFILENAME)
compressbinarywin :
2010-07-19 02:23:00 +04:00
cd bin; zip -9 $( BINARYFILENAME) .zip $( BINARYFILENAME)
2010-09-07 01:00:19 +04:00
# push the last-updated platform binary to the public download directory
2011-04-23 02:57:00 +04:00
pushlatestbinary :
2010-09-07 01:00:19 +04:00
cd bin; rsync -aP ` ls -t | head -1` simon@joyful.com:/repos/hledger/site/download/
2010-07-19 02:23:00 +04:00
2009-06-05 04:55:20 +04:00
2009-05-29 12:29:04 +04:00
# show project stats useful for release notes
2011-09-02 05:00:53 +04:00
showreleasestats stats : \
2011-04-22 22:47:57 +04:00
showreleasedays \
showunreleasedchangecount \
showloc \
showtestcount \
showunittestcoverage \
showreleaseauthors \
showunreleasedcodechanges \
showunpushedchanges
# simplebench
# showerrors
2011-09-25 22:29:23 +04:00
FROMTAG = .
2011-04-22 22:47:57 +04:00
showreleasedays :
@echo Days since last release:
2011-09-25 22:29:23 +04:00
@tools/dayssincetag.hs $( FROMTAG) | head -1 | cut -d' ' -f-1
2011-04-22 22:47:57 +04:00
@echo
2011-04-18 11:26:58 +04:00
2011-04-22 22:47:57 +04:00
showunreleasedchangecount :
@echo Commits since last release:
2011-09-25 22:29:23 +04:00
@darcs changes --from-tag $( FROMTAG) --count
2011-04-18 11:26:58 +04:00
@echo
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:
2011-09-25 22:29:23 +04:00
@darcs changes --from-tag $( FROMTAG) | grep '^\w' | cut -c 31- | sort | uniq
2009-05-29 12:29:04 +04:00
@echo
2008-11-24 00:50:38 +03:00
2011-08-19 22:39:58 +04:00
showloc sloccount :
2011-04-22 22:47:57 +04:00
@echo Current lines of code including tests:
2010-05-24 02:46:40 +04:00
@sloccount ` ls $( SOURCEFILES) ` | grep haskell:
2009-05-29 12:29:04 +04:00
@echo
2009-05-17 18:13:06 +04:00
2011-04-22 22:47:57 +04:00
showtestcount :
@echo "Unit tests:"
@hledger test 2>& 1 | cut -d' ' -f2
@echo "Functional tests:"
@make --no-print functest | egrep '^ Total' | awk '{print $$2}'
@echo
showunittestcoverage :
@echo Unit test coverage:
@make --no-print quickcoverage | grep 'expressions'
@echo
2009-06-04 05:33:31 +04:00
2010-05-24 02:46:40 +04:00
# showerrors:
# @echo Known errors:
2012-02-23 18:47:10 +04:00
# @awk '/^** errors/, /^** / && !/^** errors/' NOTES.org | grep '^\*\*\* ' | tail +1
2010-05-24 02:46:40 +04:00
# @echo
2009-05-17 18:13:06 +04:00
2011-04-22 22:47:57 +04:00
showunpushedchanges unpushed :
@echo "Changes not yet pushed upstream (to `darcs show repo | grep 'Default Remote' | cut -c 17-`):"
2010-07-19 02:22:11 +04:00
@-darcs push simon@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
2011-04-22 22:47:57 +04:00
showunreleasedcodechanges unreleased :
@echo "hledger code changes since last release:"
2011-09-25 22:29:23 +04:00
@darcs changes --from-tag $( FROMTAG) --matches "not (name docs: or name doc: or name site: or name tools:)" | grep '*'
2010-02-27 21:16:36 +03:00
@echo
2011-04-22 22:47:57 +04:00
showcodechanges :
@echo "hledger code changes:"
@darcs changes --matches "not (name docs: or name site: or name tools:)" | egrep '^ +(\*|tagged)'
2009-05-29 12:29:04 +04:00
@echo
######################################################################
# MISCELLANEOUS
2010-09-10 05:57:41 +04:00
# fix permissions (eg after darcs get)
fixperms :
chmod +x tools/* $( MAIN) hledger-*/Main.hs
2009-05-29 12:29:04 +04:00
tag : emacstags
emacstags :
2012-03-11 22:39:26 +04:00
-@rm -f TAGS; hasktags -e $( SOURCEFILES) $( WEBFILES) $( CABALFILES) $( DOCFILES) Makefile
2009-05-29 12:29:04 +04:00
clean :
2012-01-30 08:30:41 +04:00
rm -rf ` find . -name "*.o" -o -name "*.hi" -o -name "*~" -o -name "darcs-amend-record*" -o -name "*-darcs-backup*" | grep -v .virthualenv`
2009-05-29 12:29:04 +04:00
2012-03-30 00:41:47 +04:00
cleanbin :
rm -f bin/hledger bin/hledger.ghc*
Clean : clean cleanbin cleandocs
rm -f TAGS tags
2008-10-03 11:40:28 +04:00