2008-09-28 07:24:29 +04:00
|
|
|
BUILD=ghc --make hledger.hs -o hledger
|
|
|
|
BUILDOPT=$(BUILD)opt -O2
|
|
|
|
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"`
|
|
|
|
|
2007-02-11 02:25:48 +03:00
|
|
|
build: Tags
|
2007-05-02 06:50:10 +04:00
|
|
|
$(BUILD)
|
|
|
|
|
2007-07-04 13:28:07 +04:00
|
|
|
buildopt opt: clean
|
2007-07-04 07:33:08 +04:00
|
|
|
$(BUILDOPT)
|
2007-07-02 20:31:47 +04:00
|
|
|
|
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
|
|
|
|
2007-03-10 02:21:49 +03:00
|
|
|
loc:
|
|
|
|
@darcs trackdown 'find . -name "*hs" |xargs wc -l |echo OUTPUT `tail -1`; false' |ruby -nae'puts $$F[1] if /^OUTPUT/'
|
2007-02-21 12:21:18 +03:00
|
|
|
|
2007-02-09 06:32:07 +03:00
|
|
|
Tags:
|
|
|
|
hasktags *hs
|
|
|
|
|
2007-02-09 06:17:18 +03:00
|
|
|
clean:
|
2007-07-04 07:33:08 +04:00
|
|
|
rm -f *.o *.hi *~ 1 2
|
2007-02-09 06:17:18 +03:00
|
|
|
|
2008-09-29 03:27:46 +04:00
|
|
|
clean-docs:
|
|
|
|
rm -rf api-doc hoogle
|
|
|
|
|
|
|
|
Clean: clean clean-docs
|
2008-09-28 07:27:17 +04:00
|
|
|
rm -f hledger hledgeropt TAGS tags
|
2008-09-28 07:24:29 +04:00
|
|
|
|
2008-09-29 03:27:46 +04:00
|
|
|
# docs
|
|
|
|
|
|
|
|
MAIN=hledger.hs
|
|
|
|
|
|
|
|
docs: haddock-with-source hoogleweb api-doc-frames
|
|
|
|
|
|
|
|
api-doc-dir:
|
|
|
|
mkdir -p api-doc
|
|
|
|
|
2008-10-01 03:53:27 +04:00
|
|
|
api-doc: api-doc-dir $(MAIN)
|
2008-09-29 03:27:46 +04:00
|
|
|
echo "Generating haddock api docs" ; \
|
|
|
|
haddock --no-warnings --ignore-all-exports -B `ghc --print-libdir` -o api-doc -h $(filter-out %api-doc-dir,$^) ; \
|
|
|
|
cp api-doc/index.html api-doc/modules-index.html
|
|
|
|
|
2008-10-01 03:53:27 +04:00
|
|
|
api-doc-with-source: api-doc-dir colourised-source $(MAIN)
|
2008-09-29 03:27:46 +04:00
|
|
|
echo "Generating haddock api docs" ; \
|
|
|
|
haddock --no-warnings --ignore-all-exports -B `ghc --print-libdir` -o api-doc -h --source-module=src-%{MODULE/./-}.html --source-entity=src-%{MODULE/./-}.html#%N $(filter-out %api-doc-dir colourised-source,$^) ; \
|
|
|
|
cp api-doc/index.html api-doc/modules-index.html
|
|
|
|
|
2008-10-01 03:53:27 +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: api-doc-with-source hoogleweb
|
2008-09-29 03:27:46 +04:00
|
|
|
echo "Converting api docs to frames" ; \
|
|
|
|
sed -i -e 's%^></HEAD%><base target="main"></HEAD%' api-doc/modules-index.html ; \
|
2008-10-01 03:53:27 +04:00
|
|
|
cp doc/misc/api-doc-frames.html api-doc/index.html ; \
|
|
|
|
cp doc/misc/hoogle-small.html hoogle
|
2008-09-29 03:27:46 +04:00
|
|
|
|
|
|
|
colourised-source: api-doc-dir
|
|
|
|
echo "Generating colourised source" ; \
|
|
|
|
for f in *hs; do \
|
|
|
|
HsColour -css -anchor $$f -oapi-doc/`echo "src/"$$f | sed -e's%/%-%g' | sed -e's%\.hs$$%.html%'` ; \
|
|
|
|
done ; \
|
|
|
|
HsColour -print-css >api-doc/hscolour.css
|
|
|
|
|
|
|
|
#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 && \
|
|
|
|
haddock --no-warnings --ignore-all-exports -B `ghc --print-libdir` -o hoogle --hoogle $^ && \
|
|
|
|
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
|