tools: makefile and makefile help cleanup

This commit is contained in:
Simon Michael 2015-06-17 13:52:04 -07:00
parent 9617380f3c
commit 88d0f38f4e
3 changed files with 164 additions and 468 deletions

440
Makefile
View File

@ -1,5 +1,17 @@
###############################################################################
# hledger project makefile # hledger project makefile
# import def-help* functions for documenting make rules. See the file for usage.
include help-system.mk
default: help \
$(call def-help,help,\
list all documented rules in this makefile\
)
###############################################################################
# VARS
# GHC-compiled executables require a locale (and not just C) or they # GHC-compiled executables require a locale (and not just C) or they
# will die on encountering non-ascii data. Set LANG to something if not already set. # will die on encountering non-ascii data. Set LANG to something if not already set.
export LANG?=en_US.UTF-8 export LANG?=en_US.UTF-8
@ -165,114 +177,35 @@ RELEASEBINARYSUFFIX=$(shell echo "-$(VERSION)-`uname`-`arch`" | tr '[:upper:]' '
TIME:=$(shell date +"%Y%m%d%H%M") TIME:=$(shell date +"%Y%m%d%H%M")
# import the def-help function for documenting make rules. ###############################################################################
# Standard usage: $(call def-help-section,INSTALLING)
# TARGET: PREREQUISITES \
# $(call def-help,TARGET,\
# HELP\
# )
# ACTIONS
#
# Also:
# $(call def-help-section,SECTION,\
# HELP\
# )
#
# Arguments to def-help etc. may not contain , so use eg ; instead.
# They should not contain ' as it breaks emacs font-lock.
# HELP is one or more lines, or can be blank.
#
include help-system.mk
default: help \ cabal-install: \
$(call def-help,help,\ $(call def-help,cabal-install,\
list all documented rules in this makefile\
)
######################################################################
# SETUP
# work in progress
# Some rules use a sandbox, some don't, ideally we'll handle both cases.
# Initial dev setup involves:
# initialising a sandbox, probably
# cabal update, perhaps
# cabal clean in hledger packages, perhaps
# cabal install dependencies for hledger packages
# cabal install hledger-lib and hledger, perhaps hledger-web
# at least start cabal build in hledger packages, to make cabal include files (dist/build/{Paths_PKG.hs,cabal_macros.h}) (not working with a sandbox)
# When done we should be able to make install, repl-{lib,cli,web}, ghci[-web], check etc.
$(call def-help-section,SETUP)
check: \
$(call def-help,check,\
developer environment checks\
)
@echo sanity-check developer environment:
@($(SHELLTESTV) checks \
&& echo $@ PASSED) || echo $@ FAILED
include sandbox.mk
# sandbox: .cabal-sandbox sandbox-links \
# $(call def-help,sandbox,\
# set up a cabal sandbox and some symlinks\
# )
# .cabal-sandbox: \
# $(call def-help,.cabal-sandbox,\
# initialise ./.cabal sandbox and add hledger packages as sources \
# )
# cabal sandbox init
# cabal sandbox add-source ./hledger-lib ./hledger ./hledger-web
sandbox-links: \
$(call def-help,sandbox-links,\
symlink sandbox build dirs to */dist/build so that make ghci[-web] works\
)
-for p in hledger{-lib,,-web}; do (cd $$p/dist; ln -s dist-*/build); done
install: \
$(call def-help,install,\
cabal install the main hledger packages and all their dependencies\ cabal install the main hledger packages and all their dependencies\
in the sandbox if any; otherwise in the users package db\ in the sandbox if any; otherwise in the users package db\
) )
$(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests $(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests
install-force: \ cabal-install-deps: \
$(call def-help,install-force,\ $(call def-help,cabal-install-deps,\
cabal install the main hledger packages and all their dependencies more forcibly\ cabal install the dependencies for the main hledger packages, but not the hledger packages \
(can break installed libs, requiring ghc-pkg-clean)\
)
$(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests --allow-newer --force-reinstalls
installdeps: \
$(call def-help,installdeps,\
install all cabal dependencies for the main hledger packages\
) )
$(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests --only-dependencies $(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests --only-dependencies
installdeps-force: \ # uninstall: \
$(call def-help,installdeps-force,\ # $(call def-help,uninstall,\
install all cabal dependencies for the main hledger packages, more forcibly\ # unregister all packages, assuming they are defined lowest-dependency first\
(may break installed libs, requiring ghc-pkg-clean)\ # avoids some reinstall noise when repeatedly doing make install\
) # )
$(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests --only-dependencies --allow-newer --force-reinstalls # -for p in $(call reverse,$(PACKAGES)); do $(GHCPKG) unregister $$p; done
uninstall: \
$(call def-help,uninstall,\
unregister all packages, assuming they are defined lowest-dependency first\
avoids some reinstall noise when repeatedly doing make install\
)
-for p in $(call reverse,$(PACKAGES)); do $(GHCPKG) unregister $$p; done
# utility function # utility function
reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1)) reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))
cabal%: \ cabal%: \
$(call def-help,cabal%,\ $(call def-help,cabalCMD,\
run a cabal command in all hledger package dirs\ run cabal CMD inside each hledger package directory\
) )
for p in $(PACKAGES); do (echo doing cabal $* in $$p; cd $$p; cabal $*; echo); done for p in $(PACKAGES); do (echo doing cabal $* in $$p; cd $$p; cabal $*; echo); done
@ -280,19 +213,19 @@ cabal%: \
# all%: # all%:
# for p in $(PACKAGES); do (echo doing $* in $$p; cd $$p; $*); done # for p in $(PACKAGES); do (echo doing $* in $$p; cd $$p; $*); done
Reset: \ ###############################################################################
$(call def-help,Reset,\ $(call def-help-section,DEVELOPER BUILDS)
\
)
cabal sandbox delete
######################################################################
# BUILDING
$(call def-help-section,BUILDING)
EXTRAINSTALLARGS= EXTRAINSTALLARGS=
check-setup: \
$(call def-help,check-setup,\
run some tests to validate the development environment\
)
@echo sanity-checking developer environment:
@($(SHELLTEST) checks \
&& echo $@ PASSED) || echo $@ FAILED
auto: auto---version \ auto: auto---version \
$(call def-help,auto,\ $(call def-help,auto,\
auto-recompile and run (something, eg --help or unit tests) whenever a module changes\ auto-recompile and run (something, eg --help or unit tests) whenever a module changes\
@ -536,9 +469,7 @@ tools/generatejournal: tools/generatejournal.hs \
) )
$(GHC) tools/generatejournal.hs $(GHC) tools/generatejournal.hs
###################################################################### ###############################################################################
# TESTING
$(call def-help-section,TESTING) $(call def-help-section,TESTING)
packdeps: \ packdeps: \
@ -547,98 +478,89 @@ packdeps: \
) )
for p in $(PACKAGES); do packdeps $$p/$$p.cabal; done for p in $(PACKAGES); do packdeps $$p/$$p.cabal; done
######################################################################
# 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
######################################################################
# MISCELLANEOUS
######################################################################
# OLD PRE PKG SPLIT
######################################################################
######################################################################
# TESTING
test: codetest \ test: codetest \
$(call def-help,test,\ $(call def-help,test,\
\ run default tests; ie codetest\
)
test-ghc-%: # bin/hledgerdev.ghc-$* \
$(call def-help,test-ghc-%,\
run default tests with a specific GHC version\
some functional tests (add, include, read-csv..) have bin/hledgerdev hard coded - might need to symlink it\
)
@echo; echo testing hledger built with ghc-$*
@(echo unit tests: \
&& bin/hledgerdev.ghc-$* test \
&& echo functional tests: \
&& $(SHELLTEST) tests -w bin/hledgerdev.ghc-$* \
&& echo $@ PASSED) || echo $@ FAILED
test-ghcall: bin/hledgerdev.ghcall \
test-ghc-7.6.1 \
test-ghc-7.4.1 \
test-ghc-7.2.2 \
test-ghc-7.0.4 \
$(call def-help,test-ghcall,\
run default tests with all supported GHC versions\
) )
codetest: unittest functest \ codetest: unittest functest \
$(call def-help,codetest,\ $(call def-help,codetest,\
quick code tests - run all the time\ quick code tests, to be run frequently\
) )
committest: hlinttest unittest doctest functest haddocktest warningstest quickcabaltest \ committest: hlinttest unittest doctest functest haddocktest warningstest quickcabaltest \
$(call def-help,committest,\ $(call def-help,committest,\
moderate pre-commit tests - run before record or before send/push, your choice\ more thorough pre-commit/pre-push tests\
) )
releasetest: Clean unittest functest fullcabaltest haddocktest #warningstest doctest \ # releasetest: Clean unittest functest fullcabaltest haddocktest #warningstest doctest \
$(call def-help,releasetest,\ # $(call def-help,releasetest,\
thorough pre-release tests - run before release\ # pre-release tests\
consider hiding dev-build symlinks in Hledger/ first\ # )
)
hlinttest hlint: \ hlinttest hlint: \
$(call def-help,hlinttest hlint,\ $(call def-help,hlinttest (or hlint),\
\ generate a hlint report\
) )
hlint --hint=hlint --report=hlint.html $(SOURCEFILES) hlint --hint=hlint --report=hlint.html $(SOURCEFILES)
unittest: unittest-builtin \ unittest: bin/hledgerdev \
$(call def-help,unittest,\ $(call def-help,unittest,\
run unit tests\ run built-in unit tests\
)
unittest-builtin: bin/hledgerdev \
$(call def-help,unittest-builtin,\
\
) )
@echo unit tests: @echo unit tests:
@(bin/hledgerdev test \ @(bin/hledgerdev test \
&& echo $@ PASSED) || echo $@ FAILED && echo $@ PASSED) || echo $@ FAILED
unittest-%: bin/hledgerdev \ unittest-%: bin/hledgerdev \
$(call def-help,unittest-%,\ $(call def-help,unittest-PAT,\
\ run built-in unit tests whose name contains PAT\
) )
@echo unit tests: @echo unit tests:
@(bin/hledgerdev test $* \ @(bin/hledgerdev test $* \
&& echo $@ PASSED) || echo $@ FAILED && echo $@ PASSED) || echo $@ FAILED
unittest-standalone: tools/unittest \ # unittest-standalone: tools/unittest \
$(call def-help,unittest-standalone,\ # $(call def-help,unittest-standalone,\
vv XXX doesnt rebuild on hledger source changes\ # XXX doesnt rebuild on hledger source changes\
) # )
@echo unit tests (standalone): # @echo unit tests (standalone):
@(tools/unittest \ # @(tools/unittest \
&& echo $@ PASSED) || echo $@ FAILED # && echo $@ PASSED) || echo $@ FAILED
unittest-interpreted: \ # unittest-interpreted: \
$(call def-help,unittest-interpreted,\ # $(call def-help,unittest-interpreted,\
run unit tests without waiting for compilation\ # run unit tests without waiting for compilation\
) # )
@echo "unit tests (interpreted)": # @echo "unit tests (interpreted)":
@(run$(GHC) $(MAIN) test \ # @(run$(GHC) $(MAIN) test \
&& echo $@ PASSED) || echo $@ FAILED # && echo $@ PASSED) || echo $@ FAILED
# shelltest -j16 sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless\
functest: bin/hledgerdev tests/addons/hledger-addon \ functest: bin/hledgerdev tests/addons/hledger-addon \
$(call def-help,functest,\ $(call def-help,functest,\
run functional tests, requires shelltestrunner >= 0.9 from hackage\ run functional tests; requires shelltestrunner >= 0.9 from hackage\
16 threads sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless\
) )
@echo functional tests: @echo functional tests:
@(COLUMNS=80 PATH=`pwd`/bin:$(PATH) $(SHELLTEST) tests \ @(COLUMNS=80 PATH=`pwd`/bin:$(PATH) $(SHELLTEST) tests \
@ -658,27 +580,6 @@ tests/addons/hledger-addon: \
mkdir tests/addons/hledger-addondir mkdir tests/addons/hledger-addondir
chmod +x tests/addons/hledger-* chmod +x tests/addons/hledger-*
test-ghc-%: # bin/hledgerdev.ghc-$* \
$(call def-help,test-ghc-%,\
run unit and functional tests with a specific GHC version\
some functional tests (add, include, read-csv..) have bin/hledgerdev hard coded - might need to symlink it\
)
@echo; echo testing hledger built with ghc-$*
@(echo unit tests: \
&& bin/hledgerdev.ghc-$* test \
&& echo functional tests: \
&& $(SHELLTEST) tests -w bin/hledgerdev.ghc-$* \
&& echo $@ PASSED) || echo $@ FAILED
test-ghcall: bin/hledgerdev.ghcall \
test-ghc-7.6.1 \
test-ghc-7.4.1 \
test-ghc-7.2.2 \
test-ghc-7.0.4 \
$(call def-help,test-ghcall,\
run unit and functional tests with main supported GHC versions\
)
DOCTESTFILES=\ DOCTESTFILES=\
hledger/Hledger/Cli/Tests.hs hledger/Hledger/Cli/Tests.hs
doctest: tools/doctest \ doctest: tools/doctest \
@ -846,54 +747,31 @@ ghci-web: \
samplejournals: data/sample.journal data/100x100x10.journal data/1000x1000x10.journal data/1000x10000x10.journal data/10000x1000x10.journal data/10000x10000x10.journal data/100000x1000x10.journal \ samplejournals: data/sample.journal data/100x100x10.journal data/1000x1000x10.journal data/1000x10000x10.journal data/10000x1000x10.journal data/10000x10000x10.journal data/100000x1000x10.journal \
$(call def-help,samplejournals,\ $(call def-help,samplejournals,\
generate standard sample journals\ generate standard sample journals in data/\
) )
data/sample.journal: \ data/sample.journal:
$(call def-help,data/sample.journal,\
\
)
true # XXX should probably regenerate this true # XXX should probably regenerate this
data/100x100x10.journal: tools/generatejournal \ data/100x100x10.journal: tools/generatejournal
$(call def-help,data/100x100x10.journal,\
\
)
tools/generatejournal 100 100 10 >$@ tools/generatejournal 100 100 10 >$@
data/1000x1000x10.journal: tools/generatejournal \ data/1000x1000x10.journal: tools/generatejournal
$(call def-help,data/1000x1000x10.journal,\
\
)
tools/generatejournal 1000 1000 10 >$@ tools/generatejournal 1000 1000 10 >$@
data/1000x10000x10.journal: tools/generatejournal \ data/1000x10000x10.journal: tools/generatejournal
$(call def-help,data/1000x10000x10.journal,\
\
)
tools/generatejournal 1000 10000 10 >$@ tools/generatejournal 1000 10000 10 >$@
data/10000x1000x10.journal: tools/generatejournal \ data/10000x1000x10.journal: tools/generatejournal
$(call def-help,data/10000x1000x10.journal,\
\
)
tools/generatejournal 10000 1000 10 >$@ tools/generatejournal 10000 1000 10 >$@
data/10000x10000x10.journal: tools/generatejournal \ data/10000x10000x10.journal: tools/generatejournal
$(call def-help,data/10000x10000x10.journal,\
\
)
tools/generatejournal 10000 10000 10 >$@ tools/generatejournal 10000 10000 10 >$@
data/100000x1000x10.journal: tools/generatejournal \ data/100000x1000x10.journal: tools/generatejournal
$(call def-help,data/100000x1000x10.journal,\
\
)
tools/generatejournal 100000 1000 10 >$@ tools/generatejournal 100000 1000 10 >$@
###################################################################### ###############################################################################
# DOCUMENTATION
$(call def-help-section,DOCUMENTATION) $(call def-help-section,DOCUMENTATION)
docs: site codedocs \ docs: site codedocs \
@ -1003,37 +881,26 @@ HADDOCKFLAGS= \
--ghc-options='-optP-P' \ --ghc-options='-optP-P' \
haddock: haddock-lib haddock-cli haddock-web \ haddock: haddock-lib haddock-cli haddock-web \
$(call def-help,haddock,\ $(call def-help,haddock,build all package haddocks using cabal)
build per-package haddocks using cabal\
)
haddock-lib: \ haddock-lib:
$(call def-help,haddock-lib,\
\
)
(cd hledger-lib; cabal haddock $(HADDOCKFLAGS)) (cd hledger-lib; cabal haddock $(HADDOCKFLAGS))
haddock-cli: \ haddock-cli:
$(call def-help,haddock-cli,\
\
)
(cd hledger; cabal haddock $(HADDOCKFLAGS)) (cd hledger; cabal haddock $(HADDOCKFLAGS))
haddock-web: \ haddock-web:
$(call def-help,haddock-web,\
\
)
(cd hledger-web; cabal haddock $(HADDOCKFLAGS)) (cd hledger-web; cabal haddock $(HADDOCKFLAGS))
view-haddock-cli: \ view-haddock-cli: \
$(call def-help,view-haddock-cli,\ $(call def-help,view-haddock-cli,\
view-haddock-cli\ view the haddock generated for the hledger package\
) )
$(VIEWHTML) hledger/dist/doc/html/hledger/index.html $(VIEWHTML) hledger/dist/doc/html/hledger/index.html
view-haddock-%: \ view-haddock-%: \
$(call def-help,view-haddock-%,\ $(call def-help,view-haddock-PKG,\
view-haddock-lib, view-haddock-web\ view the haddock generated for the hledger-PKG package\
) )
$(VIEWHTML) hledger-$*/dist/doc/html/hledger-$*/index.html $(VIEWHTML) hledger-$*/dist/doc/html/hledger-$*/index.html
@ -1097,12 +964,6 @@ sourcegraph: \
) )
for p in $(PACKAGES); do (cd $$p; SourceGraph $$p.cabal); done for p in $(PACKAGES); do (cd $$p; SourceGraph $$p.cabal); done
patchdeps: \
$(call def-help,patchdeps,\
\
)
darcs2dot > patchdeps.dot && dot -Tpng -O patchdeps.dot
# # generate external api docs for each package # # generate external api docs for each package
# allhaddock: cabalhaddock\ --hyperlink-source\ --executables # allhaddock: cabalhaddock\ --hyperlink-source\ --executables
@ -1142,11 +1003,10 @@ patchdeps: \
# cd site/api && \ # cd site/api && \
# hoogle --convert=main.txt --output=default.hoo # hoogle --convert=main.txt --output=default.hoo
###################################################################### ###############################################################################
# RELEASING
$(call def-help-section,RELEASING) $(call def-help-section,RELEASING)
# XXX UPDATE
# Version numbering. See also .version and Version.hs. # Version numbering. See also .version and Version.hs.
# #
# hledger's version number appears in: # hledger's version number appears in:
@ -1215,13 +1075,12 @@ releaseandupload: release upload \
\ \
) )
# setandrecordversion: setversion \
setandrecordversion: setversion \ # $(call def-help,setandrecordversion,\
$(call def-help,setandrecordversion,\ # update the version number in local files, and prompt to record changes\
update the version number in local files, and prompt to record changes\ # in these files. Triggered by "make release".\
in these files. Triggered by "make release".\ # )
) # darcs record -m "bump version" $(VERSIONFILE) $(VERSIONSENSITIVEFILES)
darcs record -m "bump version" $(VERSIONFILE) $(VERSIONSENSITIVEFILES)
setversion: $(VERSIONSENSITIVEFILES) \ setversion: $(VERSIONSENSITIVEFILES) \
$(call def-help,setversion,\ $(call def-help,setversion,\
@ -1237,13 +1096,13 @@ Setversion: \
hledger-lib/hledger-lib.cabal: $(VERSIONFILE) \ hledger-lib/hledger-lib.cabal: $(VERSIONFILE) \
$(call def-help,hledger-lib/hledger-lib.cabal,\ $(call def-help,hledger-lib/hledger-lib.cabal,\
\ update the version in this file when $(VERSIONFILE) has changed \
) )
perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@ perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@
hledger/hledger.cabal: $(VERSIONFILE) \ hledger/hledger.cabal: $(VERSIONFILE) \
$(call def-help,hledger/hledger.cabal,\ $(call def-help,hledger/hledger.cabal,\
\ update the version in this file when $(VERSIONFILE) has changed \
) )
perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@ perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@
perl -p -e "s/(^[ ,]*hledger(-lib)? *[>=]=) *.*/\1 $(VERSION)/" -i $@ perl -p -e "s/(^[ ,]*hledger(-lib)? *[>=]=) *.*/\1 $(VERSION)/" -i $@
@ -1251,54 +1110,36 @@ hledger/hledger.cabal: $(VERSIONFILE) \
hledger-web/hledger-web.cabal: $(VERSIONFILE) \ hledger-web/hledger-web.cabal: $(VERSIONFILE) \
$(call def-help,hledger-web/hledger-web.cabal,\ $(call def-help,hledger-web/hledger-web.cabal,\
\ update the version in this file when $(VERSIONFILE) has changed \
) )
perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@ perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@
perl -p -e "s/(^[ ,]*hledger(-lib|-web)? *[>=]=) *.*/\1 $(VERSION)/" -i $@ perl -p -e "s/(^[ ,]*hledger(-lib|-web)? *[>=]=) *.*/\1 $(VERSION)/" -i $@
perl -p -e "s/(-DVERSION=\")[^\"]+/\$${1}$(VERSION)/" -i $@ perl -p -e "s/(-DVERSION=\")[^\"]+/\$${1}$(VERSION)/" -i $@
doc/MANUAL.md: $(VERSIONFILE) \ doc/MANUAL.md: $(VERSIONFILE) \
$(call def-help,doc/MANUAL.md,\ $(call def-help,hledger-web/hledger-web.cabal,\
\ update the version in this file when $(VERSIONFILE) has changed \
) )
perl -p -e "s/(^Version:) +[0-9.]+/\1 $(VERSION)/" -i $@ perl -p -e "s/(^Version:) +[0-9.]+/\1 $(VERSION)/" -i $@
tagrelease: \ tagrelease: \
$(call def-help,tagrelease,\ $(call def-help,tagrelease,\
\ commit a release tag based on $(VERSIONFILE) for each package\
) )
for p in $(PACKAGES); do git tag $$p-$(VERSION); done for p in $(PACKAGES); do git tag $$p-$(VERSION); done
hackageupload-dry: \ hackageupload-dry: \
$(call def-help,hackageupload-dry,\ $(call def-help,hackageupload-dry,\
\ upload all packages to hackage; dry run\
) )
for p in $(PACKAGES); do cabal upload $$p/dist/$$p-$(VERSION).tar.gz -v2 --check; done for p in $(PACKAGES); do cabal upload $$p/dist/$$p-$(VERSION).tar.gz -v2 --check; done
hackageupload: \ hackageupload: \
$(call def-help,hackageupload,\ $(call def-help,hackageupload,\
\ upload all packages to hackage\
) )
for p in $(PACKAGES); do cabal upload $$p/dist/$$p-$(VERSION).tar.gz -v2; done for p in $(PACKAGES); do cabal upload $$p/dist/$$p-$(VERSION).tar.gz -v2; done
send: \
$(call def-help,send,\
send unpushed patches to the mail list\
)
darcs send http://joyful.com/repos/hledger --to=hledger@googlegroups.com --edit-description
push: pushprofs \
$(call def-help,push,\
push patches and anything else pending to the public server\
) # pushlatestbinary
darcs push simon@joyful.com:/repos/hledger
pull: pullprofs \
$(call def-help,pull,\
pull anything pending from the public server\
)
darcs pull -a simon@joyful.com:/repos/hledger
RSYNC=rsync RSYNC=rsync
pushprofs: \ pushprofs: \
@ -1320,6 +1161,7 @@ compressbinary: \
the win variant on windows.\ the win variant on windows.\
) )
gzip -9 bin/$(BINARYFILENAME) gzip -9 bin/$(BINARYFILENAME)
compressbinarywin: \ compressbinarywin: \
$(call def-help,compressbinarywin,\ $(call def-help,compressbinarywin,\
\ \
@ -1356,6 +1198,7 @@ showreleasedays: \
@tools/dayssincetag.hs $(FROMTAG) | head -1 | cut -d' ' -f-1 @tools/dayssincetag.hs $(FROMTAG) | head -1 | cut -d' ' -f-1
@echo @echo
# XXX
showunreleasedchangecount: \ showunreleasedchangecount: \
$(call def-help,showunreleasedchangecount,\ $(call def-help,showunreleasedchangecount,\
\ \
@ -1364,6 +1207,7 @@ showunreleasedchangecount: \
@darcs changes --from-tag $(FROMTAG) --count @darcs changes --from-tag $(FROMTAG) --count
@echo @echo
# XXX
showreleaseauthors: \ showreleaseauthors: \
$(call def-help,showreleaseauthors,\ $(call def-help,showreleaseauthors,\
\ \
@ -1425,6 +1269,7 @@ showunittestcoverage: \
# @awk '/^** errors/, /^** / && !/^** errors/' NOTES.org | grep '^\*\*\* ' | tail +1 # @awk '/^** errors/, /^** / && !/^** errors/' NOTES.org | grep '^\*\*\* ' | tail +1
# @echo # @echo
# XXX
showunpushedchanges showunpushed: \ showunpushedchanges showunpushed: \
$(call def-help,showunpushedchanges showunpushed,\ $(call def-help,showunpushedchanges showunpushed,\
\ \
@ -1433,6 +1278,7 @@ showunpushedchanges showunpushed: \
@-darcs push simon@joyful.com:/repos/hledger --dry-run | grep '*' | tac @-darcs push simon@joyful.com:/repos/hledger --dry-run | grep '*' | tac
@echo @echo
# XXX
showunreleasedcodechanges showunreleased showchanges: \ showunreleasedcodechanges showunreleased showchanges: \
$(call def-help,showunreleasedcodechanges showunreleased showchanges,\ $(call def-help,showunreleasedcodechanges showunreleased showchanges,\
\ \
@ -1441,6 +1287,7 @@ showunreleasedcodechanges showunreleased showchanges: \
@darcs changes --from-tag $(FROMTAG) --matches "not (name docs: or name doc: or name site: or name tools:)" | grep '*' @darcs changes --from-tag $(FROMTAG) --matches "not (name docs: or name doc: or name site: or name tools:)" | grep '*'
@echo @echo
# XXX
showcodechanges: \ showcodechanges: \
$(call def-help,showcodechanges,\ $(call def-help,showcodechanges,\
\ \
@ -1449,20 +1296,12 @@ showcodechanges: \
@darcs changes --matches "not (name docs: or name site: or name tools:)" | egrep '^ +(\*|tagged)' @darcs changes --matches "not (name docs: or name site: or name tools:)" | egrep '^ +(\*|tagged)'
@echo @echo
###################################################################### ###############################################################################
# MISCELLANEOUS
$(call def-help-section,MISCELLANEOUS) $(call def-help-section,MISCELLANEOUS)
fixperms: \
$(call def-help,fixperms,\
fix permissions (eg after darcs get)\
)
chmod +x tools/* $(MAIN) hledger-*/Main.hs
tag: emacstags \ tag: emacstags \
$(call def-help,tag,\ $(call def-help,tag,\
\ generate tag files for source code navigation; currently just emacs\
) )
emacstags: \ emacstags: \
@ -1473,38 +1312,33 @@ emacstags: \
cleanghc: \ cleanghc: \
$(call def-help,cleanghc,\ $(call def-help,cleanghc,\
\ remove object files etc. left over from non-cabal developer builds\
) )
rm -rf `find . -name "*.o" -o -name "*.hi" -o -name "*~" | grep -vE '(virthualenv|cabal-sandbox)'` rm -rf `find . -name "*.o" -o -name "*.hi" -o -name "*~" | grep -vE '(virthualenv|cabal-sandbox)'`
cleancabal: cabalclean \
$(call def-help,cleancabal,\
\
)
cleanbin: \ cleanbin: \
$(call def-help,cleanbin,\ $(call def-help,cleanbin,\
\ remove non-cabal executables\
) )
rm -f bin/hledgerdev bin/hledgerdev.ghc* rm -f bin/hledgerdev bin/hledgerdev.ghc*
cleantags: \ cleantags: \
$(call def-help,cleantags,\ $(call def-help,cleantags,\
\ remove tag files\
) )
rm -f TAGS tags rm -f TAGS tags
clean: cleanghc \ clean: cleanghc \
$(call def-help,clean,\ $(call def-help,clean,\
\ default cleanup - ghc object files\
) )
Clean: cleanghc cleancabal cleanbin cleantags \ Clean: cleanghc cabalclean cleanbin cleantags \
$(call def-help,Clean,\ $(call def-help,Clean,\
\ thorough cleanup - cabal and non-cabal builds and tags \
) )
###################################################################### ###############################################################################
# LOCAL NON-COMMITTED CUSTOMISATIONS, IF ANY # LOCAL UNTRACKED CUSTOMISATIONS
-include Makefile.local -include local.mk

View File

@ -1,5 +1,30 @@
# makefile self-documentation # Helpers for self-documenting makefiles.
# http://www.cmcrossroads.com/print/article/self-documenting-makefiles # Based on http://www.cmcrossroads.com/print/article/self-documenting-makefiles
#
# Standard usage:
#
# TARGET: PREREQUISITES $(call def-help,TARGET,HELP)
# ACTIONS
#
# or on multiple lines:
#
# TARGET: PREREQUISITES \
# $(call def-help,TARGET,\
# HELP\
# )
# ACTIONS
#
# Also:
#
# $(call def-help-section,SECTION,HELP)
#
# and:
#
# $(call def-help-subsection,SECTION,HELP)
#
# HELP is one or more lines, or can be blank.
# Certain characters such as comma and parentheses are not allowed.
# You may want to avoid ' also as it breaks emacs font-lock.
help: help:
@echo $(if $(need-help),,Type \'make$(dash-f) help\' to get help) @echo $(if $(need-help),,Type \'make$(dash-f) help\' to get help)

View File

@ -1,163 +0,0 @@
# some standard operations in a cabal sandbox, optionally with specified GHC version
#include help-system.mks
sandbox.mk-default: help
$(call def-help-subsection,-- Default sandbox)
sandbox-setup:\
$(call def-help,sandbox-setup, set up a cabal sandbox for hledger using the default GHC version)
@make sandbox-init sandbox-add-sources
sandbox-init:
cabal sandbox init
sandbox-add-sources:
cabal sandbox add-source hledger-lib hledger hledger-web
sandbox-list-sources:\
$(call def-help,sandbox-list-sources,)
cabal sandbox list-sources
sandbox-pkg-list:\
$(call def-help,sandbox-pkg-list,\
)
cabal sandbox hc-pkg list
sandbox-pkg-check:\
$(call def-help,sandbox-pkg-check,)
cabal sandbox hc-pkg check
sandbox-install-dry-lib:\
$(call def-help,sandbox-install-dry-lib,)
cabal install --dry ./hledger-lib
sandbox-install-dry-cli:\
$(call def-help,sandbox-install-dry-cli,)
cabal install --dry ./hledger
sandbox-install-dry-web:\
$(call def-help,sandbox-install-dry-web,)
cabal install --dry ./hledger-web
sandbox-install-dep-lib:\
$(call def-help,sandbox-install-dep-lib,)
cabal install --only-dep ./hledger-lib
sandbox-install-dep-cli:\
$(call def-help,sandbox-install-dep-cli,)
cabal install --only-dep ./hledger
sandbox-install-dep-web:\
$(call def-help,sandbox-install-dep-web,)
cabal install --only-dep ./hledger-web
sandbox-install-lib:\
$(call def-help,sandbox-install-lib, install hledger-lib)
cabal install ./hledger-lib
sandbox-install-cli:\
$(call def-help,sandbox-install-cli, install hledger-lib and hledger)
cabal install ./hledger
sandbox-install-web:\
$(call def-help,sandbox-install-web, install hledger-lib and hledger and hledger-web)
cabal install ./hledger-web
sandbox-repl-lib:\
$(call def-help,sandbox-repl-lib, start a cabal REPL for the hledger-lib package)
(cd hledger-lib; cabal --sandbox-config-file=../cabal.sandbox.config repl)
sandbox-repl-cli:\
$(call def-help,sandbox-repl-cli, start a cabal REPL for the hledger package)
(cd hledger; cabal --sandbox-config-file=../cabal.sandbox.config repl exe:hledger)
sandbox-repl-web:\
$(call def-help,sandbox-repl-web, start a cabal REPL for the hledger-web package)
(cd hledger-web; cabal --sandbox-config-file=../cabal.sandbox.config repl exe:hledger-web)
$(call def-help-subsection,-- Sandbox for specified GHC version (eg: make sandbox-7.8.4-setup))
# .cabal-sandbox.ghc%:
sandbox-%-setup: \
$(call def-help,sandbox-%-setup, set up a cabal sandbox for hledger using the specified GHC version)
@make sandbox-$*-init sandbox-$*-add-sources
sandbox-%-init:
cabal --sandbox-config-file=cabal.sandbox.$*.config sandbox init --sandbox .cabal-sandbox.$*
@echo "now manually fix the ghc version in package-db: in cabal.sandbox.$*.config"
sandbox-%-add-sources:
cabal --sandbox-config-file=cabal.sandbox.$*.config sandbox add-source --sandbox .cabal-sandbox.$* hledger-lib hledger hledger-web
sandbox-%-list-sources:\
$(call def-help,sandbox-%-list-sources,)
cabal --sandbox-config-file=cabal.sandbox.$*.config sandbox list-sources --sandbox .cabal-sandbox.$*
sandbox-%-pkg-list: \
$(call def-help,sandbox-%-pkg-list,\
)
ghc-pkg-$* --package-db .cabal-sandbox.$*/*$*-packages.conf.d list
# ghc-pkg-$* --global-package-db /usr/local/lib/ghc-$*/package.conf.d --package-db .cabal-sandbox.$*/*$*-packages.conf.d list
sandbox-%-pkg-check:\
$(call def-help,sandbox-%-pkg-check,)
ghc-pkg-$* --package-db .cabal-sandbox.$*/*$*-packages.conf.d check
# ghc-pkg-$* --global-package-db /usr/local/lib/ghc-$*/package.conf.d --package-db .cabal-sandbox.$*/*$*-packages.conf.d check
sandbox-%-install-dry-lib:\
$(call def-help,sandbox-%-install-dry-lib,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* --dry ./hledger-lib
sandbox-%-install-dry-cli:\
$(call def-help,sandbox-%-install-dry-cli,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* --dry ./hledger
sandbox-%-install-dry-web:\
$(call def-help,sandbox-%-install-dry-web,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* --dry ./hledger-web
sandbox-%-install-dep-lib:\
$(call def-help,sandbox-%-install-dep-lib,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* --only-dep ./hledger-lib
sandbox-%-install-dep-cli:\
$(call def-help,sandbox-%-install-dep-cli,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* --only-dep ./hledger
sandbox-%-install-dep-web:\
$(call def-help,sandbox-%-install-dep-web,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* --only-dep ./hledger-web
sandbox-%-install-lib:\
$(call def-help,sandbox-%-install-lib,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* ./hledger-lib
sandbox-%-install-cli:\
$(call def-help,sandbox-%-install-cli,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* ./hledger
sandbox-%-install-web:\
$(call def-help,sandbox-%-install-web,)
cabal --sandbox-config-file=cabal.sandbox.$*.config install -w ghc-$* ./hledger-web
sandbox-%-repl-lib:\
$(call def-help,sandbox-%-repl-lib,)
(cd hledger-lib; cabal --sandbox-config-file=../cabal.sandbox.$*.config repl)
sandbox-%-repl-cli:\
$(call def-help,sandbox-%-repl-cli,)
(cd hledger; cabal --sandbox-config-file=../cabal.sandbox.$*.config repl exe:hledger)
sandbox-%-repl-web:\
$(call def-help,sandbox-%-repl-web,)
(cd hledger-web; cabal --sandbox-config-file=../cabal.sandbox.$*.config repl exe:hledger-web)
Clean-sandboxes:\
$(call def-help,Clean-sandboxes, delete all sandboxes in this directory)
rm -rf .cabal-sandbox* cabal.sandbox*