tools: new makefile updates

The makefile now uses stack primarily.
The following updated rules are available:

$ make
Makefile:35: -------------------- hledger make rules --------------------
Makefile:37: make [help] -- list documented rules in this makefile. make -n RULE shows more detail.
Makefile:202: (INSTALLING:)
Makefile:204: make install -- download dependencies and install hledger executables to ~/.local/bin or equivalent (with stack)
Makefile:229: (BUILDING:)
Makefile:233: make build -- download dependencies and build hledger executables (with stack)
Makefile:302: make hledgerdev -- quickly build the hledger executable (with ghc and -DDEVELOPMENT)
Makefile:487: (TESTING:)
Makefile:495: make test -- run default tests
Makefile:541: make pkgtest -- run the test suites for each package
Makefile:548: make builtintest -- run tests built in to the hledger executable (subset of pkg tests)
Makefile:572: make functest -- run hledger functional tests with the stack build
Makefile:606: make haddocktest -- run haddock and make sure it succeeds
Makefile:787: (DOCUMENTATION:)
Makefile:895: make haddock -- generate haddock docs for the hledger packages
Makefile:974: (RELEASING:)
Makefile:1053: make setversion -- update all version strings to match .version
Makefile:1056: make setversionforce -- update all version strings even if .version seems unchanged
Makefile:1080: make tagrelease -- commit a release tag based on .version for each package
Makefile:1253: (MISCELLANEOUS:)
Makefile:1255: make usage -- show size of various dirs
Makefile:1260: make stackusage -- show size of stack working dirs
Makefile:1264: make cabalusage -- show size of cabal working dirs if any
Makefile:1268: make tag -- generate tag files for source code navigation (for emacs)
Makefile:1294: make clean -- default cleanup (ghc build leftovers)
Makefile:1297: make Clean -- thorough cleanup (stack/cabal/ghc builds and tags)
Makefile:1302: make cabalCMD -- run cabal CMD inside each hledger package directory
Makefile:1306: make all"CMD" -- run CMD inside each hledger package directory
This commit is contained in:
Simon Michael 2015-07-12 12:03:43 -07:00
parent c83fcab8cb
commit 1dd51b3e8b

451
Makefile
View File

@ -1,13 +1,41 @@
############################################################################### ###############################################################################
# hledger project makefile. A restart after Makefile.old. # hledger project makefile
#
# This is a reboot of Makefile.old. The old rules are commented out below,
# to be removed or updated over the next while.
#
# Users of this makefile: hledger developers, contributors, probably not end-users.
#
# Every user-relevant rule in this makefile should use def-help to define
# a help string. Use "make help" to see the available rules.
#
# Supplementary tools:
#
# - stack, installs dependencies and drives cabal & ghc
# - shelltestrunner (latest version from hackage or possibly git), runs functional tests
# - hasktags, generates tag files for code navigation
#
# Kinds of hledger builds:
#
# - stack build: built with stack
# (hledger/.stack-work/dist/ARCH/CABAL/build/hledger/hledger,
# .stack-work/install/ARCH/SNAPSHOT/GHC/bin/hledger, installs to ~/.local/bin)
# - cabal build: built with cabal (and maybe a sandbox)
# (hledger/dist/build/hledger/hledger, installs to ~/.cabal/bin)
# - ghc build: built quickly with ghc only, unoptimised, with DEVELOPMENT flag
# (bin/hledgerdev)
#
# This makefile mostly uses stack to get things done (slow but robust).
# Secondarily it uses ghc directly to do some developer tasks (faster).
# # Also if needed it uses cabal directly for a few tasks.
# import def-help* functions for documenting make rules. See the file for usage. # def-help* functions for documenting make rules. See the file for usage.
include help-system.mk include help-system.mk
default: help \ $(call def-help-section, hledger make rules )
$(call def-help,help,\
list all documented rules in this makefile\ help2: \
) $(call def-help,[help], list documented rules in this makefile. make -n RULE shows more detail. )
############################################################################### ###############################################################################
# VARS # VARS
@ -36,99 +64,90 @@ default: help \
# VIEWPDF=$(BROWSE) # VIEWPDF=$(BROWSE)
# PRINT=lpr # PRINT=lpr
# GHC=ghc GHC=ghc
# GHCI=ghci # GHCI=ghci
# GHCPKG=ghc-pkg # GHCPKG=ghc-pkg
# HADDOCK=haddock # HADDOCK=haddock
# CABAL=cabal # CABAL=cabal
# CABALINSTALL=cabal install -w $(GHC) # CABALINSTALL=cabal install -w $(GHC)
# TESTFRAMEWORKOPTS=-j16 --hide-successes
# SHELLTEST=cabal exec -- shelltest --execdir -- $(TESTFRAMEWORKOPTS) # -j16 sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" but seems harmless
SHELLTESTOPTS=--execdir -- -j16 --hide-successes
# run shell tests using the executable specified in tests
SHELLTEST=shelltest $(SHELLTESTOPTS)
# run shell tests using the stack build
SHELLTESTSTK=stack exec -- shelltest $(SHELLTESTOPTS)
#SHELLTESTSTK=shelltest -w `stack exec which hledger` $(SHELLTESTOPTS)
# # used for make auto, http://joyful.com/repos/searchpath # # used for make auto, http://joyful.com/repos/searchpath
# SP=sp # SP=sp
# PACKAGES=\ PACKAGES=\
# hledger-lib \ hledger-lib \
# hledger \ hledger \
# hledger-web hledger-web
# INCLUDEPATHS=\ INCLUDEPATHS=\
# -ihledger-lib \ -ihledger-lib \
# -ihledger \ -ihledger \
# -ihledger-web \ -ihledger-web \
# -ihledger-web/app -ihledger-web/app
# MAIN=hledger/app/hledger-cli.hs MAIN=hledger/app/hledger-cli.hs
# # all source files in the project (plus a few strays like Setup.hs & hlint.hs) # all source files in the project (plus a few strays like Setup.hs & hlint.hs)
# SOURCEFILES:= \ SOURCEFILES:= \
# hledger/*hs \ hledger/*hs \
# hledger/Hledger/*hs \ hledger/Hledger/*hs \
# hledger/Hledger/*/*hs \ hledger/Hledger/*/*hs \
# hledger-*/*hs \ hledger-*/*hs \
# hledger-*/Hledger/*hs \ hledger-*/Hledger/*hs \
# hledger-*/Hledger/*/*hs \ hledger-*/Hledger/*/*hs \
# hledger-web/app/*.hs \ hledger-web/app/*.hs \
# hledger-web/Handler/*.hs \ hledger-web/Handler/*.hs \
# hledger-web/Hledger/*.hs \ hledger-web/Hledger/*.hs \
# hledger-web/Settings/*.hs hledger-web/Settings/*.hs
# # # a more careful list suitable for for haddock-all CABALFILES:= \
# # HADDOCKSOURCEFILES:= \ hledger/hledger.cabal \
# # hledger-lib/Hledger.hs \ hledger-*/*.cabal
# # hledger-lib/Hledger/*hs \
# # hledger-lib/Hledger/*/*hs \
# # hledger/Hledger/*hs \
# # hledger/Hledger/*/*hs \
# # hledger-web/Application.hs \
# # hledger-web/Foundation.hs \
# # hledger-web/Hledger/*hs \
# # hledger-web/Hledger/*/*hs \
# # hledger-web/Import.hs \
# # hledger-web/Settings.hs \
# # hledger-web/Settings/*hs \
# # hledger-web/app/*hs \
# CABALFILES:= \ WEBFILES:= \
# hledger/hledger.cabal \ hledger-web/templates/* \
# hledger-*/*.cabal hledger-web/static/*.js \
hledger-web/static/*.css
# WEBFILES:= \ DOCFILES:= \
# hledger-web/templates/* \ doc/*.md
# hledger-web/static/*.js \
# hledger-web/static/*.css
# DOCFILES:= \ # files which should be updated when the version changes
# doc/*.md VERSIONSENSITIVEFILES=\
$(CABALFILES) \
# # files which should be updated when the version changes doc/manual.md \
# VERSIONSENSITIVEFILES=\
# $(CABALFILES) \
# doc/manual.md \
# # file(s) which require recompilation for a build to have an up-to-date version string # # file(s) which require recompilation for a build to have an up-to-date version string
# VERSIONSOURCEFILE=hledger/Hledger/Cli/Version.hs # VERSIONSOURCEFILE=hledger/Hledger/Cli/Version.hs
# # master file defining the current release/build version # master file defining the current release/build version
# VERSIONFILE=.version VERSIONFILE=.version
# # two or three-part version string, whatever's in VERSION # two or three-part version string, whatever's in VERSION
# VERSION:=$(shell cat $(VERSIONFILE)) VERSION:=$(shell cat $(VERSIONFILE))
# # the number of commits since the last tag # # the number of commits since the last tag
# PATCHLEVEL:=$(shell git describe --long | awk -F - '{print $$2}') # PATCHLEVEL:=$(shell git describe --long | awk -F - '{print $$2}')
# # the number of commits since the last_release tag # # the number of commits since the last_release tag
# #PATCHLEVEL:=$(shell git rev-list last_release..HEAD | wc -l) # #PATCHLEVEL:=$(shell git rev-list last_release..HEAD | wc -l)
# # build flags # flags for ghc builds
# # comment the below to see more warnings
# WARNINGS:=\ WARNINGS:=\
# -Wall \ -Wall \
# -fno-warn-unused-do-bind \ -fno-warn-unused-do-bind \
# -fno-warn-name-shadowing \ -fno-warn-name-shadowing \
# -fno-warn-missing-signatures \ -fno-warn-missing-signatures \
# -fno-warn-orphans \ -fno-warn-orphans \
# -fno-warn-type-defaults \ -fno-warn-type-defaults \
# # For ghc-only dev builds of hledger-web: enable the language # # For ghc-only dev builds of hledger-web: enable the language
# # extensions specified in hledger-web.cabal, except for some which are # # extensions specified in hledger-web.cabal, except for some which are
@ -153,12 +172,14 @@ default: help \
# PREFERMACUSRLIBFLAGS=-L/usr/lib # PREFERMACUSRLIBFLAGS=-L/usr/lib
# GHCMEMFLAGS= #+RTS -M200m -RTS # GHCMEMFLAGS= #+RTS -M200m -RTS
# # include the macro definitions generated by cabal build, # ghc builds need the macro definitions generated by cabal
# # from either dist or dist-sandbox (hopefully you don't have both) # from cabal's dist or dist-sandbox, hopefully there's just one
# CABALMACROSFLAGS=-optP-include -optP hledger/dist*/build/autogen/cabal_macros.h #CABALMACROSFLAGS=-optP-include -optP hledger/dist*/build/autogen/cabal_macros.h
# from stack's dist, hopefully there's just one
CABALMACROSFLAGS=-optP-include -optP hledger/.stack-work/dist/*/*/build/autogen/cabal_macros.h
# BUILDFLAGS1:=-rtsopts $(WARNINGS) $(INCLUDEPATHS) $(PREFERMACUSRLIBFLAGS) $(GHCMEMFLAGS) $(CABALMACROSFLAGS) -DPATCHLEVEL=$(PATCHLEVEL) -DDEVELOPMENT BUILDFLAGS1:=-rtsopts $(WARNINGS) $(INCLUDEPATHS) $(PREFERMACUSRLIBFLAGS) $(GHCMEMFLAGS) $(CABALMACROSFLAGS) -DPATCHLEVEL=$(PATCHLEVEL) -DDEVELOPMENT
# BUILDFLAGS:=$(BUILDFLAGS1) -DVERSION='"$(VERSION)dev"' BUILDFLAGS:=$(BUILDFLAGS1) -DVERSION='"$(VERSION)dev"'
# PROFBUILDFLAGS:=-prof -fprof-auto -osuf hs_p # PROFBUILDFLAGS:=-prof -fprof-auto -osuf hs_p
# # sp needs different quoting: # # sp needs different quoting:
# AUTOBUILDFLAGS:=$(BUILDFLAGS1) -DVERSION='\"$(VERSION)dev\"' # $(PROFBUILDFLAGS) # AUTOBUILDFLAGS:=$(BUILDFLAGS1) -DVERSION='\"$(VERSION)dev\"' # $(PROFBUILDFLAGS)
@ -178,7 +199,11 @@ default: help \
############################################################################### ###############################################################################
# $(call def-help-section,INSTALLING) $(call def-help-subsection,INSTALLING:)
install: \
$(call def-help,install, download dependencies and install hledger executables to ~/.local/bin or equivalent (with stack))
stack install
# cabal-install: \ # cabal-install: \
# $(call def-help,cabal-install,\ # $(call def-help,cabal-install,\
@ -200,24 +225,15 @@ default: help \
# # ) # # )
# # -for p in $(call reverse,$(PACKAGES)); do $(GHCPKG) unregister $$p; done # # -for p in $(call reverse,$(PACKAGES)); do $(GHCPKG) unregister $$p; done
# # utility function
# reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))
# cabal%: \
# $(call def-help,cabalCMD,\
# run cabal CMD inside each hledger package directory\
# )
# for p in $(PACKAGES); do (echo doing cabal $* in $$p; cd $$p; cabal $*; echo); done
# # # run a command in all hledger package dirs
# # all%:
# # for p in $(PACKAGES); do (echo doing $* in $$p; cd $$p; $*); done
############################################################################### ###############################################################################
# $(call def-help-section,DEVELOPER BUILDS) $(call def-help-subsection,BUILDING:)
# EXTRAINSTALLARGS= # EXTRAINSTALLARGS=
build: \
$(call def-help,build, download dependencies and build hledger executables (with stack))
stack build
# check-setup: \ # check-setup: \
# $(call def-help,check-setup,\ # $(call def-help,check-setup,\
# run some tests to validate the development environment\ # run some tests to validate the development environment\
@ -282,12 +298,10 @@ default: help \
# # force a compile even if binary exists, since we don't specify dependencies for these # # force a compile even if binary exists, since we don't specify dependencies for these
# .PHONY: bin/hledgerdev bin/hledger-prof bin/hledgeropt bin/hledger-webdev # .PHONY: bin/hledgerdev bin/hledger-prof bin/hledgeropt bin/hledger-webdev
# bin/hledgerdev: \ # NB requires cabal macros generated by cabal build in hledger/
# $(call def-help,bin/hledgerdev,\ bin/hledgerdev hledgerdev: \
# build hledger developer binary, ie as quickly as possible\ $(call def-help,hledgerdev, quickly build the hledger executable (with ghc and -DDEVELOPMENT) )
# requires cabal macros, generated by doing a cabal build in hledger/\ $(GHC) $(MAIN) -o bin/hledgerdev $(BUILDFLAGS)
# )
# $(GHC) $(MAIN) -o bin/hledgerdev $(BUILDFLAGS)
# bin/hledgerdev.ghc-%: $(SOURCEFILES) \ # bin/hledgerdev.ghc-%: $(SOURCEFILES) \
# $(call def-help,bin/hledgerdev.ghc-%,\ # $(call def-help,bin/hledgerdev.ghc-%,\
@ -472,7 +486,7 @@ default: help \
# $(GHC) tools/generatejournal.hs # $(GHC) tools/generatejournal.hs
############################################################################### ###############################################################################
# $(call def-help-section,TESTING) $(call def-help-subsection,TESTING:)
# packdeps: \ # packdeps: \
# $(call def-help,packdeps,\ # $(call def-help,packdeps,\
@ -480,10 +494,8 @@ default: help \
# ) # )
# for p in $(PACKAGES); do packdeps $$p/$$p.cabal; done # for p in $(PACKAGES); do packdeps $$p/$$p.cabal; done
# test: codetest \ test: pkgtest builtintest functest \
# $(call def-help,test,\ $(call def-help,test, run default tests )
# run default tests; ie codetest\
# )
# test-ghc-%: # bin/hledgerdev.ghc-$* \ # test-ghc-%: # bin/hledgerdev.ghc-$* \
# $(call def-help,test-ghc-%,\ # $(call def-help,test-ghc-%,\
@ -527,47 +539,49 @@ default: help \
# ) # )
# hlint --hint=hlint --report=hlint.html $(SOURCEFILES) # hlint --hint=hlint --report=hlint.html $(SOURCEFILES)
# unittest: bin/hledgerdev \ #@echo package tests:
# $(call def-help,unittest,\ pkgtest: \
# run built-in unit tests\ $(call def-help,pkgtest, run the test suites for each package )
# ) @(stack test \
# @echo unit tests: && echo $@ PASSED) || echo $@ FAILED
# NB ensure hledger executable is current (eg do pkgtest first)
#@echo "built-in tests (hledger cli unit tests)":
builtintest: \
$(call def-help,builtintest, run tests built in to the hledger executable (subset of pkg tests) )
@(stack exec hledger test \
&& echo $@ PASSED) || echo $@ FAILED
# builtintestghc: bin/hledgerdev \
# $(call def-help,builtintest, run built-in unit tests with ghc build )
# @(bin/hledgerdev test \ # @(bin/hledgerdev test \
# && echo $@ PASSED) || echo $@ FAILED # && echo $@ PASSED) || echo $@ FAILED
# unittest-%: bin/hledgerdev \ # builtintestghc-%: bin/hledgerdev \
# $(call def-help,unittest-PAT,\ # $(call def-help,builtintest-PAT, run built-in unit tests whose name contains PAT )
# run built-in unit tests whose name contains PAT\
# )
# @echo unit tests:
# @(bin/hledgerdev test $* \ # @(bin/hledgerdev test $* \
# && echo $@ PASSED) || echo $@ FAILED # && echo $@ PASSED) || echo $@ FAILED
# # unittest-standalone: tools/unittest \ # builtintestghc-interpreted: \
# # $(call def-help,unittest-standalone,\ # $(call def-help,builtintest-interpreted,\
# # XXX doesnt rebuild on hledger source changes\ # run built-in unit tests without waiting for compilation\
# # )
# # @echo unit tests (standalone):
# # @(tools/unittest \
# # && echo $@ PASSED) || echo $@ FAILED
# # unittest-interpreted: \
# # $(call def-help,unittest-interpreted,\
# # run unit tests without waiting for compilation\
# # )
# # @echo "unit tests (interpreted)":
# # @(run$(GHC) $(MAIN) test \
# # && echo $@ PASSED) || echo $@ FAILED
# # shelltest -j16 sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" here but seems harmless
# functest: bin/hledgerdev tests/addons/hledger-addon \
# $(call def-help,functest,\
# run functional tests; requires shelltestrunner >= 0.9 from hackage\
# ) # )
# @echo functional tests: # @echo "builtin tests (interpreted)":
# @(COLUMNS=80 PATH=`pwd`/bin:$(PATH) $(SHELLTEST) tests \ # @(run$(GHC) $(MAIN) test \
# && echo $@ PASSED) || echo $@ FAILED # && echo $@ PASSED) || echo $@ FAILED
# NB ensure hledger executable is current (eg do pkgtest first)
functest: tests/addons/hledger-addon \
$(call def-help,functest, run hledger functional tests with the stack build )
@(COLUMNS=80 PATH=`pwd`/bin:$(PATH) $(SHELLTESTSTK) tests \
&& echo $@ PASSED) || echo $@ FAILED
#@echo functional tests:
functestdef: bin/hledgerdev tests/addons/hledger-addon \
$(call def-help-hide,functestdef, run hledger functional tests with the hledger in PATH )
@(COLUMNS=80 PATH=`pwd`/bin:$(PATH) $(SHELLTEST) tests \
&& echo $@ PASSED) || echo $@ FAILED
# ADDONEXTS=pl py rb sh hs lhs rkt exe com bat # ADDONEXTS=pl py rb sh hs lhs rkt exe com bat
# tests/addons/hledger-addon: \ # tests/addons/hledger-addon: \
# $(call def-help,tests/addons/hledger-addon,\ # $(call def-help,tests/addons/hledger-addon,\
@ -591,12 +605,10 @@ default: help \
# @for f in $(DOCTESTFILES); do \ # @for f in $(DOCTESTFILES); do \
# (tools/doctest $$f && echo $@ PASSED) || echo $@ FAILED ; done # (tools/doctest $$f && echo $@ PASSED) || echo $@ FAILED ; done
# haddocktest: \ haddocktest: \
# $(call def-help,haddocktest,\ $(call def-help,haddocktest, run haddock and make sure it succeeds )
# make sure we have no haddock errors\ @(make --quiet haddock \
# ) && echo $@ PASSED) || echo $@ FAILED
# @(make --quiet haddock \
# && echo $@ PASSED) || echo $@ FAILED
# warningstest: \ # warningstest: \
# $(call def-help,warningstest,\ # $(call def-help,warningstest,\
@ -774,7 +786,7 @@ default: help \
# tools/generatejournal 100000 1000 10 >$@ # tools/generatejournal 100000 1000 10 >$@
############################################################################### ###############################################################################
# $(call def-help-section,DOCUMENTATION) $(call def-help-subsection,DOCUMENTATION:)
# docs: site codedocs \ # docs: site codedocs \
# $(call def-help,docs,\ # $(call def-help,docs,\
@ -883,7 +895,7 @@ HADDOCKFLAGS= \
--ghc-options='-optP-P' \ --ghc-options='-optP-P' \
haddock: \ haddock: \
$(call def-help,haddock,build haddock docs for hledger packages) $(call def-help,haddock, generate haddock docs for the hledger packages )
stack haddock --no-haddock-deps --no-keep-going # && echo OK stack haddock --no-haddock-deps --no-keep-going # && echo OK
# stack -v haddock --no-haddock-deps --no-keep-going # && echo OK # stack -v haddock --no-haddock-deps --no-keep-going # && echo OK
@ -961,8 +973,8 @@ haddock: \
# # hoogle --convert=main.txt --output=default.hoo # # hoogle --convert=main.txt --output=default.hoo
############################################################################### ###############################################################################
# $(call def-help-section,RELEASING) $(call def-help-subsection,RELEASING:)
# cf developer guide -> how to -> major/minor release #$(call def-help-subsection,see also developer guide -> how to -> do a release)
# # XXX UPDATE # # XXX UPDATE
# # Version numbering. See also .version and Version.hs. # # Version numbering. See also .version and Version.hs.
@ -1040,51 +1052,36 @@ haddock: \
# # ) # # )
# # 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, update all version strings to match $(VERSIONFILE) )
# update the version string in local files. This should be run immediately\
# after editing the VERSION file.\
# )
# Setversion: \ setversionforce:\
# $(call def-help,Setversion,\ $(call def-help,setversionforce, update all version strings even if $(VERSIONFILE) seems unchanged)
# re-update version string even if it seems unchanged\ touch $(VERSIONFILE); make setversion
# )
# touch $(VERSIONFILE); make setversion
# hledger-lib/hledger-lib.cabal: $(VERSIONFILE) \ hledger-lib/hledger-lib.cabal: $(VERSIONFILE) \
# $(call def-help,hledger-lib/hledger-lib.cabal,\ $(call def-help-hide,hledger-lib/hledger-lib.cabal, update the version in this file )
# 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-hide,hledger/hledger.cabal, update the version in this file )
# update the version in this file when $(VERSIONFILE) has changed \ perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@
# ) perl -p -e "s/(^[ ,]*hledger(-lib)? *[>=]=) *.*/\1 $(VERSION)/" -i $@
# perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@ perl -p -e "s/(-DVERSION=\")[^\"]+/\$${1}$(VERSION)/" -i $@
# perl -p -e "s/(^[ ,]*hledger(-lib)? *[>=]=) *.*/\1 $(VERSION)/" -i $@
# perl -p -e "s/(-DVERSION=\")[^\"]+/\$${1}$(VERSION)/" -i $@
# hledger-web/hledger-web.cabal: $(VERSIONFILE) \ hledger-web/hledger-web.cabal: $(VERSIONFILE) \
# $(call def-help,hledger-web/hledger-web.cabal,\ $(call def-help-hide,hledger-web/hledger-web.cabal, update the version in this file )
# update the version in this file when $(VERSIONFILE) has changed \ perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@
# ) perl -p -e "s/(^[ ,]*hledger(-lib|-web)? *[>=]=) *.*/\1 $(VERSION)/" -i $@
# perl -p -e "s/(^ *version:) *.*/\1 $(VERSION)/" -i $@ perl -p -e "s/(-DVERSION=\")[^\"]+/\$${1}$(VERSION)/" -i $@
# perl -p -e "s/(^[ ,]*hledger(-lib|-web)? *[>=]=) *.*/\1 $(VERSION)/" -i $@
# perl -p -e "s/(-DVERSION=\")[^\"]+/\$${1}$(VERSION)/" -i $@
# doc/MANUAL.md: $(VERSIONFILE) \ doc/MANUAL.md: $(VERSIONFILE) \
# $(call def-help,hledger-web/hledger-web.cabal,\ $(call def-help-hide,doc/MANUAL.md, update the version in this file )
# 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 )
# 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,\
@ -1255,48 +1252,66 @@ haddock: \
# @echo # @echo
############################################################################### ###############################################################################
# $(call def-help-section,MISCELLANEOUS) $(call def-help-subsection,MISCELLANEOUS:)
# tag: emacstags \ usage: cabalusage stackusage \
# $(call def-help,tag,\ $(call def-help,usage, show size of various dirs )
# generate tag files for source code navigation; currently just emacs\ du -sh .git bin data doc extra
# ) du -sh .
# emacstags: \ stackusage: \
# $(call def-help,emacstags,\ $(call def-help,stackusage, show size of stack working dirs )
# \ -du -shc `find . -name '.stack*'`
# )
# -@rm -f TAGS; hasktags -e $(SOURCEFILES) $(WEBFILES) $(CABALFILES) $(DOCFILES) Makefile
# cleanghc: \ cabalusage: \
# $(call def-help,cleanghc,\ $(call def-help,cabalusage, show size of cabal working dirs if any )
# remove object files etc. left over from non-cabal developer builds\ -du -shc */dist* 2>/dev/null
# )
# rm -rf `find . -name "*.o" -o -name "*.hi" -o -name "*~" | grep -vE '(virthualenv|cabal-sandbox)'`
# cleanbin: \ tag: emacstags \
# $(call def-help,cleanbin,\ $(call def-help,tag, generate tag files for source code navigation (for emacs) )
# remove non-cabal executables\
# )
# rm -f bin/hledgerdev bin/hledgerdev.ghc*
# cleantags: \ emacstags:
# $(call def-help,cleantags,\ -@rm -f TAGS; hasktags -e $(SOURCEFILES) $(WEBFILES) $(CABALFILES) $(DOCFILES) Makefile
# remove tag files\
# )
# rm -f TAGS tags
# clean: cleanghc \ cleantags: \
# $(call def-help,clean,\ $(call def-help-hide,cleantags, remove tag files )
# default cleanup - ghc object files\ rm -f TAGS tags
# )
# Clean: cleanghc cabalclean cleanbin cleantags \ stackclean: \
# $(call def-help,Clean,\ $(call def-help-hide,stackclean, remove .stack-work/* in packages (but not in project) )
# thorough cleanup - cabal and non-cabal builds and tags \ stack clean
# )
Stackclean: \
$(call def-help-hide,Stackclean, remove all stack working dirs )
stack clean
cleanghco: \
$(call def-help-hide,cleanghc, remove ghc build leftovers )
rm -rf `find . -name "*.o" -o -name "*.hi" -o -name "*~" | grep -vE '(virthualenv|cabal-sandbox)'`
cleanghc: cleanghco \
$(call def-help-hide,cleanghc, remove ghc builds )
rm -f bin/hledgerdev bin/hledgerdev.ghc*
clean: cleanghco \
$(call def-help,clean, default cleanup (ghc build leftovers) )
Clean: stackclean cabalclean cleanghc cleantags \
$(call def-help,Clean, thorough cleanup (stack/cabal/ghc builds and tags) )
# reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))
cabal%: \
$(call def-help,cabalCMD, run cabal CMD inside each hledger package directory )
for p in $(PACKAGES); do (cd $$p; cabal $*); done
all%: \
$(call def-help,all"CMD", run CMD inside each hledger package directory )
for p in $(PACKAGES); do (cd $$p; $*); done
############################################################################### ###############################################################################
# LOCAL UNTRACKED CUSTOMISATIONS # LOCAL UNTRACKED CUSTOMISATIONS
-include local.mk -include local.mk
$(call def-help-section,------------------)