2008-10-17 21:00:53 +04:00
|
|
|
BUILD=ghc --make hledger.hs -o hledger -O2
|
2008-09-28 07:24:29 +04:00
|
|
|
BUILDPROF=$(BUILD) -prof -auto-all
|
2007-07-04 07:33:08 +04:00
|
|
|
PROFILE=./hledger -s balance +RTS -p
|
2007-05-02 06:50:10 +04:00
|
|
|
TIME=`date +"%Y%m%d%H%M"`
|
|
|
|
|
2008-10-10 05:44:40 +04:00
|
|
|
build: tag
|
2007-05-02 06:50:10 +04:00
|
|
|
$(BUILD)
|
|
|
|
|
2008-10-17 20:59:05 +04:00
|
|
|
# build and run whenever a module changes, see http://searchpath.org
|
|
|
|
continuous:
|
|
|
|
sp -o hledger ghc --make hledger.hs --run
|
|
|
|
|
2007-07-04 07:33:08 +04:00
|
|
|
profile: build
|
|
|
|
$(PROFILE)
|
|
|
|
mv hledger.prof profs/$(TIME).prof
|
2007-07-03 09:42:43 +04:00
|
|
|
rm -f last.prof
|
2007-07-04 07:33:08 +04:00
|
|
|
ln -s profs/$(TIME).prof last.prof
|
|
|
|
head -20 profs/$(TIME).prof >simple.prof
|
2007-07-03 13:11:03 +04:00
|
|
|
cat simple.prof
|
|
|
|
./simplifyprof.hs <last.prof >>simple.prof
|
2007-05-02 06:50:10 +04:00
|
|
|
|
2007-07-04 07:33:08 +04:00
|
|
|
xprofile: build
|
|
|
|
$(PROFILE) -x
|
|
|
|
mv hledger.prof profs/$(TIME).xprof
|
|
|
|
ghcprof profs/$(TIME).xprof
|
2007-02-21 12:21:18 +03:00
|
|
|
|
2007-07-11 12:25:05 +04:00
|
|
|
test:
|
|
|
|
@./hledger.hs test
|
|
|
|
@./regtest.py
|
2007-07-04 06:23:37 +04:00
|
|
|
|
2008-11-24 01:15:51 +03:00
|
|
|
VERSION=`grep 'versionno =' Options.hs | perl -pe 's/.*"(.*?)"/\1/'`
|
|
|
|
release:
|
|
|
|
cabal sdist && darcs tag $(VERSION) && cabal upload dist/hledger-$(VERSION).tar.gz
|
|
|
|
|
2008-10-18 08:34:41 +04:00
|
|
|
tag:
|
|
|
|
rm -f TAGS; hasktags -e *hs Ledger/*hs
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f {,Ledger/}*{.o,.hi,~} darcs-amend-record*
|
|
|
|
|
|
|
|
Clean: clean clean-docs
|
|
|
|
rm -f hledger TAGS tags
|
|
|
|
|
2008-09-29 03:27:46 +04:00
|
|
|
# docs
|
|
|
|
|
|
|
|
MAIN=hledger.hs
|
|
|
|
|
|
|
|
api-doc-dir:
|
|
|
|
mkdir -p api-doc
|
|
|
|
|
2008-10-03 11:40:28 +04:00
|
|
|
HSCOLOUR=HsColour -css
|
|
|
|
colourised-source hscolour: api-doc-dir
|
2008-09-29 03:27:46 +04:00
|
|
|
echo "Generating colourised source" ; \
|
2008-10-03 06:02:25 +04:00
|
|
|
for f in *hs Ledger/*hs; do \
|
2008-10-03 11:40:28 +04:00
|
|
|
$(HSCOLOUR) -anchor $$f -oapi-doc/`echo "src/"$$f | sed -e's%/%-%g' | sed -e's%\.hs$$%.html%'` ; \
|
2008-09-29 03:27:46 +04:00
|
|
|
done ; \
|
2008-10-01 14:18:07 +04:00
|
|
|
cp api-doc/src-hledger.html api-doc/src-Main.html ; \
|
2008-09-29 03:27:46 +04:00
|
|
|
HsColour -print-css >api-doc/hscolour.css
|
|
|
|
|
2008-10-03 11:40:28 +04:00
|
|
|
# nb --ignore-all-exports means these are actually implementation docs
|
|
|
|
HADDOCK=haddock -B `ghc --print-libdir` --no-warnings --ignore-all-exports
|
|
|
|
api-doc-with-source haddock: api-doc-dir colourised-source $(MAIN)
|
|
|
|
echo "Generating haddock api docs" ; \
|
|
|
|
$(HADDOCK) -o api-doc -h --source-module=src-%{MODULE/./-}.html $(filter-out %api-doc-dir colourised-source,$^) ; \
|
|
|
|
cp api-doc/index.html api-doc/modules-index.html
|
|
|
|
#--source-entity=src-%{MODULE/./-}.html#%N
|
|
|
|
|
2008-09-29 03:27:46 +04:00
|
|
|
#generate a hoogle index
|
|
|
|
#uses system hoogle, works around http://code.google.com/p/ndmitchell/issues/detail?id=93
|
|
|
|
#to use: hoogle --data=hoogle/default ...
|
|
|
|
hoogleindex: $(MAIN)
|
|
|
|
echo "Generating hoogle index" ; \
|
|
|
|
mkdir -p hoogle && \
|
2008-10-03 11:40:28 +04:00
|
|
|
$(HADDOCK) -o hoogle --hoogle $^ && \
|
2008-09-29 03:27:46 +04:00
|
|
|
cd hoogle && \
|
|
|
|
sed -i -e 's/^(_/-- (_/' main.txt && \
|
|
|
|
hoogle --convert=main.txt --output=default.hoo
|
|
|
|
|
|
|
|
#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-/'`
|
|
|
|
hoogleweb: hoogleindex
|
|
|
|
echo "Configuring hoogle web interface" ; \
|
|
|
|
if test -f $(HOOGLE) ; then \
|
|
|
|
mkdir -p hoogle && \
|
|
|
|
cd hoogle && \
|
|
|
|
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
|
2008-10-03 11:40:28 +04:00
|
|
|
|
|
|
|
# munge haddock and hoogle into a rough but useful framed layout
|
|
|
|
# ensure that the hoogle cgi is built with base target "main"
|
|
|
|
api-doc-frames docs: api-doc-with-source hoogleweb
|
|
|
|
echo "Converting api docs to frames" ; \
|
|
|
|
sed -i -e 's%^></HEAD%><base target="main"></HEAD%' api-doc/modules-index.html ; \
|
|
|
|
cp doc/misc/api-doc-frames.html api-doc/index.html ; \
|
|
|
|
cp doc/misc/hoogle-small.html hoogle
|
|
|
|
|
|
|
|
BROWSER=open
|
|
|
|
test-docs: api-doc-frames
|
|
|
|
$(BROWSER) api-doc/index.html
|
|
|
|
|
|
|
|
clean-docs:
|
|
|
|
rm -rf api-doc hoogle
|
|
|
|
|
2008-10-18 08:34:41 +04:00
|
|
|
# misc
|
|
|
|
|
2008-10-17 22:04:24 +04:00
|
|
|
show-changes:
|
|
|
|
@echo Changes since last release:
|
|
|
|
@echo
|
|
|
|
@darcs changes --from-tag . | grep '*'
|
|
|
|
|
2008-10-18 08:34:41 +04:00
|
|
|
sloc:
|
2008-11-24 00:50:47 +03:00
|
|
|
@echo "test code:"
|
2008-10-18 08:34:41 +04:00
|
|
|
@sloccount Tests.hs | grep haskell:
|
2008-11-24 00:50:47 +03:00
|
|
|
@echo "non-test code:"
|
2008-10-18 08:34:41 +04:00
|
|
|
@sloccount `ls {,Ledger/}*.hs |grep -v Tests.hs` | grep haskell:
|
2008-10-03 11:40:28 +04:00
|
|
|
|