2016-10-28 21:15:10 +03:00
# One of two project scripts files (Makefile, Shake.hs).
# This one is usually the simplest to use.
# It requires GNU Make (https://www.gnu.org/software/make/).
# Also, some rules require:
# - stack (http://haskell-lang.org/get-started, installs libs and runs ghc)
# - shelltestrunner (hackage, runs functional tests)
# - quickbench (hackage/stackage, runs benchmarks)
# - hasktags (hackage, generates tag files for code navigation)
# - profiteur (hackage/stackage, renders profiles as html)
# - hpack (hackage/stackage, generates cabal files from package.yaml files)
# - site/hakyll-std/hakyll-std (generic site-building hakyll script)
# - perl
# This was a reboot of Makefile.old. The old rules were commented out below,
2015-07-12 22:03:43 +03:00
# to be removed or updated over the next while.
#
2016-10-28 21:15:10 +03:00
# Target users: hledger developers, contributors, probably not end-users.
2015-07-12 22:03:43 +03:00
#
# 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.
2017-08-01 02:12:59 +03:00
# XXX do we need this ?
#SHELL=/bin/bash
#.SHELLFLAGS="-O extglob -c" # example
# help system
2016-10-28 21:15:10 +03:00
# Every user-relevant rule in this makefile should use def-help to define
# a help string. Use "make help" to see the available rules.
2015-07-12 22:03:43 +03:00
# def-help* functions for documenting make rules. See the file for usage.
2017-09-27 04:32:30 +03:00
- i n c l u d e h e l p - s y s t e m . m k
2015-06-17 23:52:04 +03:00
2018-05-18 05:39:19 +03:00
$( call def -help -heading ,Main make rules in the hledger project .)
$( call def -help -heading ,( not always entirely up to date ) )
2017-08-16 16:00:59 +03:00
$( call def -help -heading ,---------------------------------------)
$( call def -help -heading , )
2015-07-12 22:03:43 +03:00
2017-08-17 01:25:09 +03:00
add-to-help-1 : $( call def -help ,[help ], list documented rules in this makefile )
2017-08-16 16:19:32 +03:00
2018-08-18 21:22:15 +03:00
help-% : $( call def -help ,help -SECTION , list documented rules containing some string )
make help 2>& 1 | grep -i $*
2015-06-17 23:52:04 +03:00
2017-08-17 01:25:09 +03:00
%-help : $( call def -help ,SECTION -help , same but easier to type ( can append "-help " to any "make RULE ") )
2018-08-18 21:22:15 +03:00
@make help 2>& 1 | grep -i $*
2017-08-17 01:25:09 +03:00
add-to-help-2 : $( call def -help ,RULE -n , show what RULE would do )
2015-06-17 23:52:04 +03:00
###############################################################################
# VARS
2015-07-15 03:52:14 +03:00
# 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.
export LANG ?= en_US.UTF-8
2015-07-12 06:29:14 +03:00
2015-07-22 18:52:30 +03:00
# command to run during profiling (time and heap)
2017-01-08 16:20:04 +03:00
PROFCMD = stack exec -- hledgerprof balance -f examples/10000x1000x10.journal >/dev/null
2015-07-12 06:29:14 +03:00
2015-07-22 18:52:30 +03:00
#PROFRTSFLAGS=-p
PROFRTSFLAGS = -P
2015-07-12 06:29:14 +03:00
# # command to run during "make coverage"
# COVCMD=test
# COVCMD=-f test-wf.csv print
2015-07-22 18:59:41 +03:00
# misc. system tools
BROWSE = open
2015-07-12 06:29:14 +03:00
# VIEWHTML=$(BROWSE)
2015-07-22 18:59:41 +03:00
VIEWPS = $( BROWSE)
2015-07-12 06:29:14 +03:00
# VIEWPDF=$(BROWSE)
# PRINT=lpr
2015-07-12 22:03:43 +03:00
GHC = ghc
2016-05-25 05:19:56 +03:00
GHCI = ghci #-package ghc-datasize #-package ghc-heap-view
2015-07-12 06:29:14 +03:00
# GHCPKG=ghc-pkg
# HADDOCK=haddock
# CABAL=cabal
# CABALINSTALL=cabal install -w $(GHC)
2018-04-12 17:14:57 +03:00
STACK = stack
# if using an unreleased stack with a newer hpack than the one mentioned in */*.cabal,
# it will give warnings. To silence these, put the old hpack-X.Y in $PATH and uncomment:
#STACK=stack --with-hpack=hpack-0.20
2015-07-12 22:03:43 +03:00
# -j16 sometimes gives "commitAndReleaseBuffer: resource vanished (Broken pipe)" but seems harmless
2018-07-24 10:33:00 +03:00
SHELLTESTOPTS = --execdir -j16 --hide-successes --exclude= /_
2017-05-25 01:51:33 +03:00
# make sure shelltest is a released version of shelltestrunner
2015-07-12 22:03:43 +03:00
# run shell tests using the executable specified in tests
2017-03-22 11:13:04 +03:00
# SHELLTEST=COLUMNS=80 PATH=~/.local/bin:/usr/bin:/bin shelltest $(SHELLTESTOPTS)
2017-05-25 01:51:33 +03:00
# run shell tests using the stack build of hledger
2015-07-12 22:03:43 +03:00
#SHELLTESTSTK=shelltest -w `stack exec which hledger` $(SHELLTESTOPTS)
2017-03-29 04:28:33 +03:00
SHELLTESTSTK = COLUMNS = 80 $( STACK) exec -- shelltest $( SHELLTESTOPTS)
2015-07-12 22:03:43 +03:00
2015-07-12 06:29:14 +03:00
# # used for make auto, http://joyful.com/repos/searchpath
# SP=sp
2015-07-12 22:03:43 +03:00
PACKAGES = \
hledger-lib \
hledger \
2015-08-20 05:41:07 +03:00
hledger-ui \
2016-10-26 23:39:00 +03:00
hledger-web \
hledger-api \
2015-07-12 22:03:43 +03:00
INCLUDEPATHS = \
-ihledger-lib \
2016-11-13 00:53:55 +03:00
-ihledger-lib/other/ledger-parse \
2015-07-12 22:03:43 +03:00
-ihledger \
2015-08-20 05:41:07 +03:00
-ihledger-ui \
2015-07-12 22:03:43 +03:00
-ihledger-web \
2016-10-26 23:39:00 +03:00
-ihledger-web/app \
-ihledger-api \
2015-07-12 22:03:43 +03:00
MAIN = hledger/app/hledger-cli.hs
# all source files in the project (plus a few strays like Setup.hs & hlint.hs)
SOURCEFILES := \
2015-10-26 16:54:07 +03:00
dev.hs \
2015-07-12 22:03:43 +03:00
hledger/*hs \
2015-09-27 04:59:11 +03:00
hledger/bench/*hs \
2015-07-12 22:03:43 +03:00
hledger/Hledger/*hs \
hledger/Hledger/*/*hs \
2017-09-13 04:06:20 +03:00
hledger/Hledger/*/*/*hs \
2015-07-12 22:03:43 +03:00
hledger-*/*hs \
hledger-*/Hledger/*hs \
hledger-*/Hledger/*/*hs \
2017-03-28 14:47:36 +03:00
hledger-lib/other/ledger-parse/Ledger/Parser/*hs \
2018-06-24 17:25:22 +03:00
hledger-web/**/*.hs \
2017-08-01 02:12:59 +03:00
HPACKFILES := \
hledger/*package.yaml \
hledger-*/*package.yaml \
2015-07-12 22:03:43 +03:00
CABALFILES := \
hledger/hledger.cabal \
2015-07-15 01:19:05 +03:00
hledger-*/*.cabal \
2015-07-12 22:03:43 +03:00
2017-08-01 02:12:59 +03:00
MANUALSOURCEFILES := \
doc/lib.m4 \
2017-12-07 05:16:35 +03:00
*/*.m4.md \
2017-08-01 02:12:59 +03:00
MANUALGENFILES := \
2017-12-07 05:16:35 +03:00
hledger*/hledger*.{ 1,5,info,txt} \
2015-08-13 08:50:30 +03:00
2017-08-01 02:12:59 +03:00
# site/*.md includes website source files and generated web manual files
# WEBDOCFILES:= \
# site/*.md \
WEBCODEFILES := \
2015-07-12 22:03:43 +03:00
hledger-web/templates/* \
hledger-web/static/*.js \
2017-08-01 02:12:59 +03:00
hledger-web/static/*.css \
2015-07-12 22:03:43 +03:00
2017-08-01 02:12:59 +03:00
DOCSOURCEFILES := \
README.md \
$( MANUALSOURCEFILES) \
2015-07-12 22:03:43 +03:00
# files which should be updated when the version changes
VERSIONSENSITIVEFILES = \
2015-08-13 08:50:30 +03:00
$( HPACKFILES) \
2017-08-01 02:12:59 +03:00
hledger-api/hledger-api.hs \
doc/lib.m4 \
2015-07-12 06:29:14 +03:00
# # file(s) which require recompilation for a build to have an up-to-date version string
# VERSIONSOURCEFILE=hledger/Hledger/Cli/Version.hs
2015-07-12 22:03:43 +03:00
# master file defining the current release/build version
VERSIONFILE = .version
2015-07-12 06:29:14 +03:00
2015-07-12 22:03:43 +03:00
# two or three-part version string, whatever's in VERSION
2017-08-17 01:25:09 +03:00
VERSION = $( shell cat $( VERSIONFILE) )
2015-07-12 06:29:14 +03:00
2015-07-19 19:31:20 +03:00
# the number of commits since the last tag
2017-08-17 01:25:09 +03:00
PATCHLEVEL = $( shell git describe --tags --match 'hledger-[0-9]*' --long | awk -F- '{print $$3}' )
2015-09-03 22:24:35 +03:00
#PATCHLEVEL:=$(shell git describe --tags --match 'hledger-web-[0-9]*' --long | awk -F- '{print $$4}')
2015-07-19 19:31:20 +03:00
# the number of commits since the last_release tag
#PATCHLEVEL:=$(shell git rev-list last_release..HEAD | wc -l)
2015-07-12 06:29:14 +03:00
2015-07-12 22:03:43 +03:00
# flags for ghc builds
WARNINGS := \
-Wall \
-fno-warn-unused-do-bind \
-fno-warn-name-shadowing \
-fno-warn-missing-signatures \
-fno-warn-orphans \
-fno-warn-type-defaults \
2015-07-12 06:29:14 +03:00
# # For ghc-only dev builds of hledger-web: enable the language
# # extensions specified in hledger-web.cabal, except for some which are
# # not compatible with hledger-lib and hledger, or little-used; those
# # are enabled with source file pragmas instead. Note: compilation
# # warnings and errors might differ between ghc-only and cabal builds.
# WEBLANGEXTS:=\
# -XCPP \
# -XMultiParamTypeClasses \
# -XQuasiQuotes \
# -XRecordWildCards \
# -XTemplateHaskell \
# # -XOverloadedStrings \
# # -XNoImplicitPrelude \
# # -XTypeFamilies \
# # -XGADTs \
# # -XGeneralizedNewtypeDeriving \
# # -XFlexibleContexts \
# # -XEmptyDataDecls \
# # -XNoMonomorphismRestriction
# PREFERMACUSRLIBFLAGS=-L/usr/lib
# GHCMEMFLAGS= #+RTS -M200m -RTS
2015-07-12 22:03:43 +03:00
# ghc builds need the macro definitions generated by cabal
2016-12-31 01:33:14 +03:00
# from cabal's dist or dist-sandbox dir, hopefully there's just one
2015-07-12 22:03:43 +03:00
#CABALMACROSFLAGS=-optP-include -optP hledger/dist*/build/autogen/cabal_macros.h
2016-12-31 01:33:14 +03:00
# from stack's dist dir, hopefully there's just one. If not (after cabal upgrade), will get warnings. Maybe obsolete ?
#CABALMACROSFLAGS=-optP-include -optP hledger/.stack-work/dist/*/*/build/autogen/cabal_macros.h
2015-07-12 06:29:14 +03:00
2017-08-17 01:25:09 +03:00
BUILDFLAGS1 = -rtsopts $( WARNINGS) $( INCLUDEPATHS) $( PREFERMACUSRLIBFLAGS) $( GHCMEMFLAGS) $( CABALMACROSFLAGS) -DPATCHLEVEL= $( PATCHLEVEL) -DDEVELOPMENT
2018-08-15 13:14:24 +03:00
BUILDFLAGS = $( BUILDFLAGS1) -DVERSION= " \" $( VERSION) \" "
2015-07-12 06:29:14 +03:00
# PROFBUILDFLAGS:=-prof -fprof-auto -osuf hs_p
# # sp needs different quoting:
2016-02-21 13:34:36 +03:00
# AUTOBUILDFLAGS:=$(BUILDFLAGS1) -DVERSION='\"$(VERSION)dev\"' # $(PROFBUILDFLAGS)
2015-07-12 06:29:14 +03:00
# LINUXRELEASEBUILDFLAGS:=-DMAKE $(WARNINGS) $(INCLUDEPATHS) -O2 -static -optl-static -optl-pthread
# MACRELEASEBUILDFLAGS:=-DMAKE $(WARNINGS) $(INCLUDEPATHS) $(PREFERMACUSRLIBFLAGS) -O2 # -optl-L/usr/lib
# #WINDOWSRELEASEBUILDFLAGS:=-DMAKE $(WARNINGS) $(INCLUDEPATHS)
# AUTOBUILD=$(SP) --no-exts --no-default-map $(GHC) -O0 $(GHCMEMFLAGS)
# # get an accurate binary filename for the current source and platform, slow but reliable. Avoid := here.
# BINARYFILENAME=$(shell touch $(VERSIONSOURCEFILE); runhaskell -ihledger -ihledger-lib $(MAIN) --binary-filename)
# # some other thing for linux binary filenames
# RELEASEBINARYSUFFIX=$(shell echo "-$(VERSION)-`uname`-`arch`" | tr '[:upper:]' '[:lower:]')
2017-08-17 01:25:09 +03:00
TIME = $( shell date +"%Y%m%d%H%M" )
MONTHYEAR = $( shell date +'%B %Y' )
2010-05-24 03:45:12 +04:00
2015-06-17 23:52:04 +03:00
###############################################################################
2017-08-16 16:00:59 +03:00
$(call def-help-subheading,INSTALLING : )
2015-07-12 22:03:43 +03:00
install : \
$( call def-help,install, download dependencies and install hledger executables to ~/.local/bin or equivalent ( with stack) )
2016-05-27 18:12:48 +03:00
$( STACK) install
2014-08-14 04:48:24 +04:00
2015-07-12 06:29:14 +03:00
# cabal-install: \
# $(call def-help,cabal-install,\
# cabal install the main hledger packages and all their dependencies\
# in the sandbox if any; otherwise in the users package db\
# )
# $(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests
2014-08-07 19:44:31 +04:00
2015-07-12 06:29:14 +03:00
# cabal-install-deps: \
# $(call def-help,cabal-install-deps,\
# cabal install the dependencies for the main hledger packages, but not the hledger packages \
2015-06-17 23:52:04 +03:00
# )
2015-07-12 06:29:14 +03:00
# $(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests --only-dependencies
2014-10-18 21:19:00 +04:00
2015-07-12 06:29:14 +03:00
# # 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
2014-10-18 21:19:00 +04:00
2015-06-17 23:52:04 +03:00
###############################################################################
2017-08-16 16:00:59 +03:00
$(call def-help-subheading,BUILDING : )
2014-08-14 04:48:24 +04:00
2015-07-12 06:29:14 +03:00
# EXTRAINSTALLARGS=
2011-10-19 23:55:01 +04:00
2015-07-12 22:03:43 +03:00
build : \
$( call def-help,build, download dependencies and build hledger executables ( with stack) )
2016-05-27 18:12:48 +03:00
$( STACK) build
2015-07-12 22:03:43 +03:00
2015-07-12 06:29:14 +03:00
# 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
2015-06-17 23:52:04 +03:00
2015-07-12 06:29:14 +03:00
# auto: auto---version \
# $(call def-help,auto,\
# auto-recompile and run (something, eg --help or unit tests) whenever a module changes\
# )
2012-05-14 23:24:03 +04:00
2015-07-12 06:29:14 +03:00
# auto-%: sp \
# $(call def-help,auto-%,\
# \
# )
# $(AUTOBUILD) $(MAIN) -o bin/hledgerdev $(AUTOBUILDFLAGS) --run $*
2012-05-27 22:15:36 +04:00
2015-07-12 06:29:14 +03:00
# autoweb: sp link-web-dirs \
# $(call def-help,autoweb,\
# \
# )
# $(AUTOBUILD) hledger-web/app/main.hs -o bin/hledger-webdev $(AUTOBUILDFLAGS) $(WEBLANGEXTS) --run -B --port 5001 --base-url http://localhost:5001 -f webtest.j
2012-11-16 22:49:00 +04:00
2017-04-29 22:15:19 +03:00
link-web-dirs : config messages static templates \
$( call def-help,link-web-dirs,\
\
)
2013-01-11 17:30:15 +04:00
2017-04-29 22:15:19 +03:00
config : \
$( call def-help,config,\
\
)
ln -sf hledger-web/$@
2013-01-11 17:30:15 +04:00
2017-04-29 22:15:19 +03:00
messages : \
$( call def-help,messages,\
\
)
ln -sf hledger-web/$@
2013-01-11 17:30:15 +04:00
2017-04-29 22:15:19 +03:00
static : \
$( call def-help,static,\
\
)
ln -sf hledger-web/$@
2013-01-11 17:30:15 +04:00
2017-04-29 22:15:19 +03:00
templates : \
$( call def-help,templates,\
\
)
ln -sf hledger-web/$@
2010-11-13 03:07:20 +03:00
2015-07-12 06:29:14 +03:00
# sp: \
# $(call def-help,sp,\
# check for sp and explain how to get it if not found.\
# )
# @/usr/bin/env which sp >/dev/null || \
# (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
2015-07-22 18:52:30 +03:00
# force a compile even if binary exists, since we don't specify dependencies for these
.PHONY : bin /hledgerdev bin /hledgerprof # bin/hledger-webdev
2011-03-13 02:30:57 +03:00
2015-07-12 22:03:43 +03:00
# NB requires cabal macros generated by cabal build in hledger/
bin/hledgerdev hledgerdev : \
2015-07-22 18:52:30 +03:00
$( call def-help,hledgerdev, build an unoptimised "bin/hledgerdev" executable quickly ( with ghc) )
2015-07-12 22:03:43 +03:00
$( GHC) $( MAIN) -o bin/hledgerdev $( BUILDFLAGS)
2010-11-29 04:15:08 +03:00
2015-07-12 06:29:14 +03:00
# bin/hledgerdev.ghc-%: $(SOURCEFILES) \
# $(call def-help,bin/hledgerdev.ghc-%,\
# build a GHC-version-specific hledger binary without disturbing with other GHC version builds\
# )
# ghc-$* $(MAIN) -o $@ $(BUILDFLAGS) -outputdir .ghc-$*
# bin/hledgerdev.ghcall: \
# bin/hledgerdev.ghc-7.6.1 \
# bin/hledgerdev.ghc-7.4.1 \
# bin/hledgerdev.ghc-7.2.2 \
# bin/hledgerdev.ghc-7.0.4 \
# $(call def-help,bin/hledgerdev.ghcall,\
# build hledger with the main supported GHC versions\
# )
2012-03-26 22:18:18 +04:00
2015-07-22 18:52:30 +03:00
hledgerprof : \
$( call def-help,hledgerprof, build "hledgerprof" for profiling ( with stack) )
2016-05-27 18:12:48 +03:00
$( STACK) build hledger-lib hledger --library-profiling --executable-profiling --ghc-options= -fprof-auto
cp ` $( STACK) exec which hledger` { ,prof}
@echo to profile, use $( STACK) exec -- hledgerprof ...
2015-07-13 01:23:42 +03:00
2015-07-22 18:52:30 +03:00
# bin/hledgerprof: \
# $(call def-help,bin/hledgerprof,\
2015-07-12 06:29:14 +03:00
# build the "production" cabal build with profiling enabled.\
# )
2015-07-22 18:52:30 +03:00
# rm -f bin/hledgerprof
2015-07-12 06:29:14 +03:00
# cabal install --enable-profiling --ghc-options=-fprof-auto ./hledger-lib ./hledger \
2015-07-22 18:52:30 +03:00
# && mv $(CABALINSTALLDIR)/bin/hledger bin/hledgerprof
2015-07-12 06:29:14 +03:00
# # build the dev build with profiling enabled.
# # not working with cabal sandbox
# # bin/hledgerdev-prof:
# # $(GHC) $(BUILDFLAGS) $(PROFBUILDFLAGS) $(MAIN) -o $@
2015-07-22 18:52:30 +03:00
hledgercov : \
$( call def-help,hledgercov, build "bin/hledgercov" for coverage reports ( with ghc) )
$( GHC) $( MAIN) -fhpc -o bin/hledgercov -outputdir .hledgercovobjs $( BUILDFLAGS)
2016-04-13 07:10:02 +03:00
# hledger-lib/Hledger/Read/TimeclockReaderPP.hs
2015-07-22 18:52:30 +03:00
dev : dev .hs $( SOURCEFILES ) \
$( call def-help,dev, build the dev.hs script for quick experiments ( with ghc) )
2016-05-27 18:12:48 +03:00
$( STACK) ghc -- $( CABALMACROSFLAGS) -ihledger-lib dev.hs \
2015-07-22 18:52:30 +03:00
2015-09-27 05:00:16 +03:00
# dev0: dev.hs $(SOURCEFILES) \
# $(call def-help,dev, build the dev.hs script for quick experiments (with ghc -O0) )
2016-05-27 18:12:48 +03:00
# $(STACK) ghc -- -O0 $(CABALMACROSFLAGS) -ihledger-lib dev.hs -o dev0 \
2015-09-27 05:00:16 +03:00
# dev2: dev.hs $(SOURCEFILES) \
# $(call def-help,dev, build the dev.hs script for quick experiments (with ghc -O2) )
2016-05-27 18:12:48 +03:00
# $(STACK) ghc -- -O2 $(CABALMACROSFLAGS) -ihledger-lib dev.hs -o dev2 \
2015-09-27 05:00:16 +03:00
# to get profiling deps installed, first do something like:
# stack build --library-profiling hledger-lib timeit criterion
devprof : dev .hs $( SOURCEFILES ) \
$( call def-help,devprof, build the dev.hs script with profiling support )
2016-05-27 18:12:48 +03:00
$( STACK) ghc -- $( CABALMACROSFLAGS) -ihledger-lib dev.hs -rtsopts -prof -fprof-auto -osuf p_o -o devprof
2015-09-27 05:00:16 +03:00
2015-10-13 20:31:43 +03:00
dev-profile : devprof \
$( call def-help,dev-profile, get a time & space profile of the dev.hs script )
2015-09-27 05:00:16 +03:00
time ./devprof +RTS -P \
&& cp devprof.prof devprof.prof.$( TIME) \
&& profiteur devprof.prof
2010-11-29 04:15:08 +03:00
2015-10-13 20:31:43 +03:00
dev-heap : devprof \
2015-10-17 21:23:39 +03:00
$( call def-help,dev-heap, get heap profiles of the dev.hs script )
time ./devprof +RTS -hc -L1000 && cp devprof.hp devprof-hc.hp && hp2ps devprof-hc.hp
time ./devprof +RTS -hr -L1000 && cp devprof.hp devprof-hr.hp && hp2ps devprof-hr.hp
dev-heap-upload :
curl -F "file=@devprof-hc.hp" -F "title='hledger parser'" http://heap.ezyang.com/upload
curl -F "file=@devprof-hr.hp" -F "title='hledger parser'" http://heap.ezyang.com/upload
2015-10-13 20:31:43 +03:00
2015-07-12 06:29:14 +03:00
# # build other executables quickly
2010-09-10 02:54:34 +04:00
2015-07-12 06:29:14 +03:00
# bin/hledger-webdev: link-web-dirs \
# $(call def-help,bin/hledger-webdev,\
# \
# )
# $(GHC) -o $@ $(BUILDFLAGS) $(WEBLANGEXTS) hledger-web/app/main.hs
2010-09-10 02:54:34 +04:00
2015-07-12 06:29:14 +03:00
# bin/hledger-web-production: \
# $(call def-help,bin/hledger-web-production,\
# \
# )
# $(GHC) -o $@ $(BUILDFLAGS) $(WEBLANGEXTS) hledger-web/app/main.hs
2010-09-10 02:54:34 +04:00
2015-07-12 06:29:14 +03:00
# linuxbinaries: linuxbinary-hledger \
# linuxbinary-hledger-web \
# $(call def-help,linuxbinaries,\
# build portable releaseable binaries for gnu/linux\
# )
# @echo 'Please check the binaries look portable, then make compressbinaries:'
# -file bin/*`arch`
2010-09-10 02:54:34 +04:00
2015-07-12 06:29:14 +03:00
# linuxbinary-hledger: \
# $(call def-help,linuxbinary-hledger,\
# work around for inconsistently-named (why ?) hledger/app/hledger-cli.hs\
# )
# $(GHC) hledger/app/hledger-cli.hs -o bin/$*$(RELEASEBINARYSUFFIX) $(LINUXRELEASEBUILDFLAGS)
2012-10-22 01:09:24 +04:00
2015-07-12 06:29:14 +03:00
# linuxbinary-%: \
# $(call def-help,linuxbinary-%,\
# \
# )
# $(GHC) $*/$*.hs -o bin/$*$(RELEASEBINARYSUFFIX) $(LINUXRELEASEBUILDFLAGS)
2010-12-11 01:00:42 +03:00
2015-07-12 06:29:14 +03:00
# macbinaries: macbinary-hledger \
# macbinary-hledger-web \
# $(call def-help,macbinaries,\
# \
# )
# @echo 'Please check the binaries are portable, then make compressbinaries'
# otool -L bin/*`arch`
# macbinary-%: \
# $(call def-help,macbinary-%,\
# 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.\
# )
# BINARY=`echo $(BINARYFILENAME) | sed -e 's/hledger/$*/'` ; \
# LINKCMD=`$(GHC) -v $*/$*.hs $(MACRELEASEBUILDFLAGS) -o bin/$$BINARY 2>&1 | egrep "bin/gcc.*bin/$$BINARY"` ; \
# PORTABLELINKCMD=`echo $$LINKCMD | sed -e 's/ -framework GMP//'` ; \
# echo $$PORTABLELINKCMD; $$PORTABLELINKCMD
# windowsbinaries: install \
# $(call def-help,windowsbinaries,\
# 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.\
# )
# cp ~/.cabal/bin/hledger.exe bin/`echo $(BINARYFILENAME) | dos2unix`
# -cp ~/.cabal/bin/hledger-web.exe bin/`echo $(BINARYFILENAME) | sed -e 's/hledger/hledger-web/' | dos2unix`
# @echo 'Please check the binaries are portable, then make compressbinaries'
# ls -l bin/*`arch`
# wine-cmd: \
# $(call def-help,wine-cmd,\
# various ways of getting a wine shell\
# command-line windows command prompt. Works eg in an emacs shell buffer.\
# )
# wine cmd
2014-04-19 22:58:55 +04:00
2015-07-12 06:29:14 +03:00
# wine-cmd2: \
# $(call def-help,wine-cmd2,\
# as above but try to cd somewhere useful (doesnt work), also ctrl-d exits quickly\
# )
# (echo c:; echo cd \\mingw\\msys\\1.0; cat) | wine cmd
2014-04-19 22:58:55 +04:00
2015-07-12 06:29:14 +03:00
# wine-cmd-window: \
# $(call def-help,wine-cmd-window,\
# windows command prompt in a new window\
# )
# wineconsole cmd &
2014-04-19 22:58:55 +04:00
2015-07-12 06:29:14 +03:00
# wine-mintty: \
# $(call def-help,wine-mintty,\
# msys bash shell in a mintty window\
# )
# wine c:/mingw/msys/1.0/bin/mintty - &
2011-09-27 00:51:09 +04:00
2015-07-12 06:29:14 +03:00
# compressbinaries: \
# $(call def-help,compressbinaries,\
# \
# )
# 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`
# tools/unittest: tools/unittest.hs \
# $(call def-help,tools/unittest,\
# build the standalone unit test runner. Requires test-framework, which\
# may not work on windows.\
# )
# $(GHC) -threaded -O2 tools/unittest.hs
2011-10-19 23:55:01 +04:00
2015-07-12 06:29:14 +03:00
# tools/doctest: tools/doctest.hs \
# $(call def-help,tools/doctest,\
# build the doctest runner\
# )
# $(GHC) tools/doctest.hs
2011-10-19 23:55:01 +04:00
2015-07-12 06:29:14 +03:00
# tools/criterionbench: tools/criterionbench.hs \
# $(call def-help,tools/criterionbench,\
# build the criterion-based benchmark runner. Requires criterion.\
# )
# $(GHC) tools/criterionbench.hs
2011-10-19 23:55:01 +04:00
2015-07-12 06:29:14 +03:00
# tools/progressionbench: tools/progressionbench.hs \
# $(call def-help,tools/progressionbench,\
# build the progression-based benchmark runner. Requires progression.\
# )
# $(GHC) tools/progressionbench.hs
2011-10-19 23:55:01 +04:00
2015-08-24 07:41:20 +03:00
tools/generatejournal : tools /generatejournal .hs \
$( call def-help,tools/generatejournal, build the generatejournal tool )
$( GHC) tools/generatejournal.hs
2011-10-19 23:55:01 +04:00
2018-05-18 05:39:19 +03:00
ghcid : $( call def -help ,ghcid , start ghcid autobuilder on hledger -lib + hledger )
ghcid -c 'make ghci'
ghcid-ui : $( call def -help ,ghcid -ui , start ghcid autobuilder on hledger -lib + hledger + hledger -ui )
ghcid -c 'make ghci-ui'
ghcid-web : $( call def -help ,ghcid -web , start ghcid autobuilder on hledger -lib + hledger + hledger -web )
ghcid -c 'make ghci-web'
ghcid-api : $( call def -help ,ghcid -api , start ghcid autobuilder on hledger -lib + hledger + hledger -api )
ghcid -c 'make ghci-api'
2018-06-08 16:01:36 +03:00
ghcid-test : $( call def -help ,ghcid -test , start ghcid autobuilding and running the test command )
ghcid -c 'make ghci' --test ':main test'
2018-08-17 11:37:09 +03:00
ghcid-test-% : $( call def -help ,ghcid -test -TESTPATTERN , start ghcid autobuilding and running the test command with the given TESTPATTERN )
ghcid -c 'make ghci' --test ':main test $*'
2018-06-08 16:01:36 +03:00
ghcid-doctest : $( call def -help ,ghcid -doctest , start ghcid autobuilding and running hledger -lib doctests )
2018-05-18 05:39:19 +03:00
ghcid -c 'cd hledger-lib; $(STACK) ghci hledger-lib:test:doctests' --test ':main' --reload hledger-lib
ghcid-shake : $( call def -help ,ghcid -shake , start ghcid autobuilder on Shake .hs )
stack exec \
--package base-prelude \
--package directory \
--package extra \
--package safe \
--package shake \
--package time \
-- ghcid Shake.hs
# same packages as in Shake.hs
# multi-package GHCI prompts
ghci : $( call def -help ,ghci , start ghci REPL on hledger -lib + hledger )
$( STACK) exec -- $( GHCI) $( BUILDFLAGS) hledger/Hledger/Cli/Main.hs
ghci-prof : $( call def -help ,ghci -prof , start ghci REPL on hledger -lib + hledger with profiling information )
stack build --profile hledger --only-dependencies
$( STACK) exec -- $( GHCI) $( BUILDFLAGS) -fexternal-interpreter -prof -fprof-auto hledger/Hledger/Cli/Main.hs
ghci-dev : $( call def -help ,ghci -dev , start ghci REPL on hledger -lib + hledger + dev .hs script )
$( STACK) exec -- $( GHCI) $( BUILDFLAGS) -fno-warn-unused-imports -fno-warn-unused-binds dev.hs
ghci-ui : $( call def -help ,ghci -ui , start ghci REPL on hledger -lib + hledger + hledger -ui )
$( STACK) exec -- $( GHCI) $( BUILDFLAGS) hledger-ui/Hledger/UI/Main.hs
ghci-web : link -web -dirs $( call def -help ,ghci -web , start ghci REPL on hledger -lib + hledger + hledger -web )
$( STACK) exec -- $( GHCI) $( BUILDFLAGS) hledger-web/app/main.hs
2018-08-18 15:31:39 +03:00
ghci-api : $( call def -help ,ghci -api , start ghci REPL on hledger -lib + hledger + hledger -api )
2018-05-18 05:39:19 +03:00
$( STACK) exec -- $( GHCI) $( BUILDFLAGS) hledger-api/hledger-api.hs
# ghci-all: $(call def-help,ghci-all, start ghci REPL on all the hledger)
# $(STACK) exec -- $(GHCI) $(BUILDFLAGS) \
# hledger-ui/Hledger/UI/Main.hs \
# hledger-web/app/main.hs \
# hledger-api/hledger-api.hs \
2018-08-03 20:09:00 +03:00
ghci-doctest : $( call def -help ,ghci -doctest , start ghci REPL on hledger -lib doctests )
2018-05-18 05:39:19 +03:00
cd hledger-lib; $( STACK) ghci hledger-lib:test:doctests
2018-05-18 04:09:54 +03:00
2015-06-17 23:52:04 +03:00
###############################################################################
2017-08-16 16:00:59 +03:00
$(call def-help-subheading,TESTING : )
2011-10-19 23:55:01 +04:00
2017-06-07 17:20:25 +03:00
test : pkgtest functest \
2018-05-18 04:09:54 +03:00
$( call def-help,test, run default tests: package tests plus functional tests)
2009-06-28 07:17:02 +04:00
2018-05-18 04:09:54 +03:00
# For quieter tests add --silent. It may hide troubleshooting info.
2018-05-18 06:42:14 +03:00
# For very verbose tests add --verbosity=debug. It seems hard to get something in between.
2018-05-18 05:39:45 +03:00
STACKTEST = $( STACK) test
2017-04-01 03:57:12 +03:00
2018-10-24 19:47:48 +03:00
buildplantest : $( call def -help ,buildplantest , stack build --dry -run all hledger packages ensuring an install plan with default snapshot ) \
buildplantest-stack.yaml
buildplantest-all : $( call def -help ,buildplantest -all , stack build --dry -run all hledger packages ensuring an install plan with each ghc version /stackage snapshot )
for F in stack-*.yaml stack.yaml; do make --no-print-directory buildplantest-$$ F; done
buildplantest-% : $( call def -help ,buildplantest -STACKFILE , stack build --dry -run all hledger packages ensuring an install plan with the given stack yaml file ; eg make buildplantest -stack -ghc 8.2.yaml )
$( STACK) build --dry-run --test --bench --stack-yaml= $*
2018-06-04 03:04:02 +03:00
buildtest : $( call def -help ,buildtest , force -rebuild all hledger packages /modules quickly ensuring no warnings with default snapshot ) \
2018-05-18 05:39:45 +03:00
buildtest-stack.yaml
2018-06-04 03:04:02 +03:00
buildtest-all : $( call def -help ,buildtest -all , force -rebuild all hledger packages /modules quickly ensuring no warnings with each ghc version /stackage snapshot )
2018-06-03 22:31:24 +03:00
for F in stack-*.yaml stack.yaml; do make --no-print-directory buildtest-$$ F; done
2009-03-15 08:15:59 +03:00
2018-06-04 03:04:02 +03:00
buildtest-% : $( call def -help ,buildtest -STACKFILE , force -rebuild all hledger packages /modules quickly ensuring no warnings with the given stack yaml file ; eg make buildtest -stack -ghc 8.2.yaml )
2018-05-18 06:42:14 +03:00
$( STACK) build --test --bench --fast --force-dirty --ghc-options= -fforce-recomp --ghc-options= -Werror --stack-yaml= $*
2018-06-04 03:04:02 +03:00
incr-buildtest : $( call def -help ,incr -buildtest , build any outdated hledger packages /modules quickly ensuring no warnings with default snapshot . Wont detect warnings in up -to -date modules .) \
incr-buildtest-stack.yaml
incr-buildtest-all : $( call def -help ,incr -buildtest -all , build any outdated hledger packages /modules quickly ensuring no warnings with each ghc version /stackage snapshot . Wont detect warnings in up -to -date modules . )
for F in stack-*.yaml stack.yaml; do make --no-print-directory incr-buildtest-$$ F; done
incr-buildtest-% : $( call def -help ,incr -buildtest -STACKFILE , build any outdated hledger packages /modules quickly ensuring no warnings with the stack yaml file ; eg make buildtest -stack -ghc 8.2.yaml . Wont detect warnings in up -to -date modules . )
$( STACK) build --test --bench --fast --ghc-options= -Werror --stack-yaml= $*
2018-05-18 04:09:54 +03:00
pkgtest : $( call def -help ,pkgtest , run the test suites in each package )
@( $( STACKTEST) && echo $@ PASSED) || ( echo $@ FAILED; false )
2009-06-28 07:17:02 +04:00
2018-08-03 20:08:05 +03:00
# doctest with ghc 8.4 on mac requires a workaround, see hledger-lib/package.yaml.
# Or, could run it with ghc 8.2:
# @($(STACKTEST) --stack-yaml stack-ghc8.2.yaml hledger-lib:test:doctests && echo $@ PASSED) || (echo $@ FAILED; false)
2018-09-09 18:33:06 +03:00
doctest : $( call def -help ,doctest , run the doctests in hledger -lib module /function docs )
2018-08-03 20:08:05 +03:00
@( $( STACKTEST) hledger-lib:test:doctests && echo $@ PASSED) || ( echo $@ FAILED; false )
2015-07-12 22:03:43 +03:00
2018-09-09 18:35:03 +03:00
easytest : $( call def -help ,easytest , run the easytest unit tests in hledger -lib )
2018-05-18 04:09:54 +03:00
@( $( STACKTEST) hledger-lib:test:easytests && echo $@ PASSED) || ( echo $@ FAILED; false )
2013-01-11 17:32:27 +04:00
2018-09-09 18:35:03 +03:00
# assumes an up to date hledger executable is built.
2018-05-18 04:09:54 +03:00
# I think we don't do it automatically to minimise unnecessary rebuilding.
builtintest : $( call def -help ,builtintest , run hledgers built in test command )
@( $( STACK) exec hledger test && echo $@ PASSED) || ( echo $@ FAILED; false )
2008-12-05 12:28:24 +03:00
2018-01-14 03:26:11 +03:00
#functest: addons tests/addons/hledger-addon
functest : tests /addons /hledger -addon \
2018-08-04 18:12:13 +03:00
$( call def-help,functest, build hledger quickly and run the functional tests ( and some unit tests) )
@stack build --fast hledger
@( $( SHELLTESTSTK) -w ` stack exec -- which hledger` tests \
2017-03-29 08:10:46 +03:00
&& echo $@ PASSED) || ( echo $@ FAILED; false )
2015-07-12 22:03:43 +03:00
2016-04-21 17:52:20 +03:00
ADDONEXTS = pl py rb sh hs lhs rkt exe com bat
tests/addons/hledger-addon : \
$( call def-help,tests/addons/hledger-addon,\
generate dummy add-ons for testing ( hledger-addon the rest) \
)
rm -rf tests/addons/hledger-*
printf '#!/bin/sh\necho add-on: $$0\necho args: $$*\n' >tests/addons/hledger-addon
for E in '' $( ADDONEXTS) ; do \
cp tests/addons/hledger-addon tests/addons/hledger-addon.$$ E; done
for F in addon. addon2 addon2.hs addon3.exe addon3.lhs addon4.exe add reg; do \
cp tests/addons/hledger-addon tests/addons/hledger-$$ F; done
mkdir tests/addons/hledger-addondir
chmod +x tests/addons/hledger-*
2015-07-12 06:29:14 +03:00
2018-05-18 04:09:54 +03:00
# hlinttest hlint: $(call def-help,hlinttest (or hlint),generate a hlint report)
# hlint --hint=hlint --report=hlint.html $(SOURCEFILES)
2015-07-13 01:23:42 +03:00
2018-09-09 18:33:06 +03:00
haddocktest : $( call def -help ,haddocktest , run haddock to make sure it can generate docs without dying )
2018-05-18 04:09:54 +03:00
@( make --quiet haddock && echo $@ PASSED) || ( echo $@ FAILED; false )
2010-12-11 01:09:32 +03:00
2018-05-18 04:09:54 +03:00
cabalfiletest : $( call def -help ,cabalfiletest , run cabal check to test cabal file syntax )
@( make --no-print-directory cabalcheck && echo $@ PASSED) || ( echo $@ FAILED; false )
2010-05-23 01:24:07 +04:00
2018-05-18 04:09:54 +03:00
allghcstest : $( call def -help ,allghcstest , build /test /benchmark with all supported GHC versions /stackage snapshots and warning -free ) \
2018-05-16 21:41:46 +03:00
test-stack-ghc7.10.yaml \
test-stack-ghc8.0.yaml \
test-stack-ghc8.2.yaml \
2017-09-08 20:36:54 +03:00
test-stack.yaml \
test-stack%yaml :
2018-05-18 04:09:54 +03:00
$( STACK) --stack-yaml stack$* yaml clean
$( STACK) --stack-yaml stack$* yaml build --ghc-options= " $( WARNINGS) -Werror " --test --bench --haddock --no-haddock-deps
travistest : $( call def -help ,travistest , run tests similar to our travis CI tests )
2018-06-04 03:12:32 +03:00
$( STACK) clean
$( STACK) build --ghc-options= -Werror --test --haddock --no-haddock-deps hledger-lib
$( STACK) build --ghc-options= -Werror --test --haddock --no-haddock-deps hledger
$( STACK) build --ghc-options= -Werror --test --haddock --no-haddock-deps hledger-ui
$( STACK) build --ghc-options= -Werror --test --haddock --no-haddock-deps hledger-web
$( STACK) build --ghc-options= -Werror --test --haddock --no-haddock-deps hledger-api
2018-05-18 04:09:54 +03:00
make functest
2018-05-18 05:39:45 +03:00
# committest: hlinttest unittest doctest functest haddocktest buildtest quickcabaltest \
2018-05-18 04:09:54 +03:00
# $(call def-help,committest,more thorough pre-commit/pre-push tests)
2018-05-18 05:39:45 +03:00
# releasetest: Clean unittest functest fullcabaltest haddocktest #buildtest doctest \
2018-05-18 04:09:54 +03:00
# $(call def-help,releasetest,pre-release tests)
2018-07-02 09:49:11 +03:00
HLEDGERINSTALLSH = $( PWD) /hledger-install/hledger-install.sh
installtest : $( call def -help ,installtest , run hledger -install .sh from another directory )
( cd; $( HLEDGERINSTALLSH) )
2018-05-18 04:09:54 +03:00
###############################################################################
$(call def-help-subheading,BENCHMARKING : )
2017-09-08 20:36:54 +03:00
2018-05-18 05:39:19 +03:00
samplejournals : $( call def -help ,samplejournals , regenerate standard sample journals in examples /) \
examples/sample.journal \
examples/100x100x10.journal \
examples/1000x1000x10.journal \
examples/1000x10000x10.journal \
examples/10000x1000x10.journal \
examples/10000x10000x10.journal \
examples/100000x1000x10.journal \
examples/1000000x1000x10.journal \
examples/ascii.journal \
examples/chinese.journal \
examples/mixed.journal \
examples/sample.journal :
true # XXX should probably regenerate this
examples/100x100x10.journal : tools /generatejournal
tools/generatejournal 100 100 10 >$@
examples/1000x1000x10.journal : tools /generatejournal
tools/generatejournal 1000 1000 10 >$@
examples/1000x10000x10.journal : tools /generatejournal
tools/generatejournal 1000 10000 10 >$@
examples/10000x1000x10.journal : tools /generatejournal
tools/generatejournal 10000 1000 10 >$@
examples/10000x10000x10.journal : tools /generatejournal
tools/generatejournal 10000 10000 10 >$@
examples/100000x1000x10.journal : tools /generatejournal
tools/generatejournal 100000 1000 10 >$@
examples/1000000x1000x10.journal : tools /generatejournal
tools/generatejournal 1000000 1000 10 >$@
examples/ascii.journal : tools /generatejournal
tools/generatejournal 3 5 5 >$@
examples/chinese.journal : tools /generatejournal
tools/generatejournal 3 5 5 --chinese >$@
examples/mixed.journal : tools /generatejournal
tools/generatejournal 3 5 5 --mixed >$@
2017-12-06 01:32:28 +03:00
BENCHEXES = hledger
# or, eg: BENCHEXES=ledger,hledger-1.4,hledger
2016-10-21 05:05:07 +03:00
2017-11-29 18:41:53 +03:00
bench : samplejournals bench .sh $( call def -help ,bench , benchmark commands in bench .sh with quickbench and $ ( BENCHEXES ) )
2016-10-21 05:05:07 +03:00
quickbench -v -w $( BENCHEXES)
2008-12-10 23:46:18 +03:00
2015-07-12 06:29:14 +03:00
# bench: samplejournals tests/bench.tests tools/simplebench \
# $(call def-help,bench,\
# run simple performance benchmarks and archive results\
# Requires some commands defined in tests/bench.tests and some BENCHEXES defined above.\
# )
# tools/simplebench -v -ftests/bench.tests $(BENCHEXES) | tee doc/profs/$(TIME).bench
# @rm -f benchresults.*
# @(cd doc/profs; rm -f latest.bench; ln -s $(TIME).bench latest.bench)
2010-02-13 21:39:49 +03:00
2015-07-12 06:29:14 +03:00
# criterionbench: samplejournals tools/criterionbench \
# $(call def-help,criterionbench,\
# run criterion benchmark tests and save graphical results\
# )
# tools/criterionbench -t png -k png
2011-04-22 22:47:12 +04:00
2015-07-12 06:29:14 +03:00
# progressionbench: samplejournals tools/progressionbench \
# $(call def-help,progressionbench,\
# run progression benchmark tests and save graphical results\
# )
# tools/progressionbench -- -t png -k png
# prof: samplejournals \
# $(call def-help,prof,\
# generate and archive an execution profile\
2015-07-22 18:52:30 +03:00
# ) #bin/hledgerprof
2015-07-12 06:29:14 +03:00
# @echo "Profiling: $(PROFCMD)"
# -$(PROFCMD) +RTS $(PROFRTSFLAGS) -RTS
2015-07-22 18:52:30 +03:00
# mv hledgerprof.prof doc/profs/$(TIME).prof
2015-07-12 06:29:14 +03:00
# (cd doc/profs; rm -f latest*.prof; ln -s $(TIME).prof latest.prof)
# viewprof: prof \
# $(call def-help,viewprof,\
# generate, archive, simplify and display an execution profile\
# )
# tools/simplifyprof.hs doc/profs/latest.prof
2015-07-22 18:52:30 +03:00
quickprof-% : hledgerprof samplejournals \
2015-07-22 18:59:41 +03:00
$( call def-help,quickprof-"CMD" , run some command against a sample journal and display the execution profile )
2017-01-08 16:20:04 +03:00
$( STACK) exec -- hledgerprof +RTS $( PROFRTSFLAGS) -RTS $* -f examples/10000x1000x10.journal >/dev/null
2015-07-22 18:52:30 +03:00
profiteur hledgerprof.prof
@echo
@head -20 hledgerprof.prof
@echo ...
@echo
@echo see hledgerprof.prof or hledgerprof.prof.html for the full report
2015-07-12 06:29:14 +03:00
# heap: samplejournals \
# $(call def-help,heap,\
# generate and archive a graphical heap profile\
2015-07-22 18:52:30 +03:00
# ) #bin/hledgerprof
2015-07-12 06:29:14 +03:00
# @echo "Profiling heap with: $(PROFCMD)"
# $(PROFCMD) +RTS -hc -RTS
2015-07-22 18:52:30 +03:00
# mv hledgerprof.hp doc/profs/$(TIME).hp
2015-07-12 06:29:14 +03:00
# (cd doc/profs; rm -f latest.hp; ln -s $(TIME).hp latest.hp; \
# hp2ps $(TIME).hp; rm -f latest.ps; ln -s $(TIME).ps latest.ps; rm -f *.aux)
# viewheap: heap \
# $(call def-help,viewheap,\
# \
# )
# $(VIEWPS) doc/profs/latest.ps
2015-07-22 18:59:41 +03:00
quickheap-% : hledgerprof samplejournals \
$( call def-help,quickheap-"CMD" , run some command against a sample journal and display the heap profile )
2017-01-08 16:20:04 +03:00
$( STACK) exec -- hledgerprof +RTS -hc -RTS $* -f examples/10000x1000x10.journal >/dev/null
2015-07-22 18:59:41 +03:00
hp2ps hledgerprof.hp
@echo generated hledgerprof.ps
$( VIEWPS) hledgerprof.ps
2015-07-12 06:29:14 +03:00
2015-07-22 18:52:30 +03:00
# quickcoverage: hledgercov \
2015-07-12 06:29:14 +03:00
# $(call def-help,quickcoverage,\
# display a code coverage text report from running hledger COVCMD\
# )
# @echo "Generating code coverage text report for hledger command: $(COVCMD)"
2015-07-22 18:52:30 +03:00
# tools/runhledgercov "report" $(COVCMD)
2010-11-20 01:04:20 +03:00
2015-07-22 18:52:30 +03:00
# coverage: samplejournals hledgercov \
2015-07-12 06:29:14 +03:00
# $(call def-help,coverage,\
# generate a code coverage html report from running hledger COVCMD\
# )
# @echo "Generating code coverage html report for hledger command: $(COVCMD)"
2015-07-22 18:52:30 +03:00
# tools/runhledgercov "markup --destdir=doc/profs/coverage" $(COVCMD)
2015-07-12 06:29:14 +03:00
# cd doc/profs/coverage; rm -f index.html; ln -s hpc_index.html index.html
2009-06-04 05:33:31 +04:00
2015-07-12 06:29:14 +03:00
# viewcoverage: \
# $(call def-help,viewcoverage,\
# view the last html code coverage report\
# )
# $(VIEWHTML) doc/profs/coverage/index.html
2014-07-06 21:47:45 +04:00
2015-07-12 06:29:14 +03:00
# # XXX with a sandbox, use sandbox-repl-* instead
# repl-lib:\
# $(call def-help,repl-lib, start a cabal REPL and load the hledger-lib package)
# (cd hledger-lib; cabal repl)
2014-07-06 21:47:45 +04:00
2015-07-12 06:29:14 +03:00
# repl-cli:\
# $(call def-help,repl-cli, start a cabal REPL and load the hledger package)
# (cd hledger; cabal repl exe:hledger)
2014-07-06 21:47:45 +04:00
2015-07-12 06:29:14 +03:00
# repl-web:\
# $(call def-help,repl-web, start a cabal REPL and load the hledger-web package)
# (cd hledger-web; cabal repl exe:hledger-web)
2014-10-18 21:20:32 +04:00
2015-06-17 23:52:04 +03:00
###############################################################################
2017-08-16 16:00:59 +03:00
$(call def-help-subheading,DOCUMENTATION : )
2015-03-30 22:02:48 +03:00
2015-07-12 06:29:14 +03:00
# docs: site codedocs \
# $(call def-help,docs,\
# rebuild all docs\
# )
2010-05-17 18:33:05 +04:00
2015-07-12 06:29:14 +03:00
# cleandocs: site-clean \
# $(call def-help,cleandocs,\
# \
# )
2014-01-13 03:15:09 +04:00
2015-11-06 07:21:02 +03:00
hakyll-std site/hakyll-std/hakyll-std : \
site/hakyll-std/hakyll-std.hs \
site/hakyll-std/TableOfContents.hs \
2015-07-15 01:19:05 +03:00
$( call def-help,hakyll-std, build a generic hakyll site builder script )
2016-12-29 22:14:36 +03:00
cd site/hakyll-std; ./hakyll-std.hs
2015-07-14 06:34:07 +03:00
2016-02-20 09:39:13 +03:00
site-build : site /hakyll -std /hakyll -std site /manual .md \
2015-11-06 06:32:17 +03:00
$( call def-help,site-build, generate the hledger.org website with hakyll-std )
2015-11-06 07:21:02 +03:00
-cd site; hakyll-std/hakyll-std build
2015-07-14 06:34:07 +03:00
2018-04-28 23:46:44 +03:00
site/index.md : wiki /_Sidebar .md \
2018-05-15 04:07:29 +03:00
$( call def-help,site/index.md, update home page with ./wiki/_Sidebar content )
2018-04-28 23:46:44 +03:00
( sed -ne '1,/<!-- WIKICONTENT -->/ p' site/index.md ; \
2018-04-10 16:55:52 +03:00
sed -ne '/^#.*User/,$$ p' wiki/_Sidebar.md \
| perl -p \
-e 's/\[\[([^\|]*)\|([^\]]*)\]\]/[\1](https:\/\/github.com\/simonmichael\/hledger\/wiki\/\2)/g;' \
-e 's/\[\[([^\]]*)\]\]/[\1](https:\/\/github.com\/simonmichael\/hledger\/wiki\/\1)/g;' \
2018-04-28 23:46:44 +03:00
-e 's/^# >/##/;' \
2018-04-10 16:55:52 +03:00
; \
2018-04-28 23:46:44 +03:00
sed -ne '/<!-- ENDWIKICONTENT -->/,$$ p' site/index.md ) \
> site/_index.md.$$ $$ && \
mv site/_index.md.$$ $$ site/index.md
2018-03-10 02:15:45 +03:00
2018-05-16 21:58:08 +03:00
site/index.md-push : \
$( call def-help,site/index.md-push, update home page with ./wiki/_Sidebar content and commit and do a git push if changed )
2018-05-15 04:12:10 +03:00
git diff --quiet site/index.md && \
2018-05-15 04:07:29 +03:00
make -s site/index.md && \
2018-05-16 21:58:08 +03:00
( git diff --quiet site/index.md || ( git commit -q -m 'site: home: update from wiki' -m '[ci skip]' site/index.md && git push) )
2018-05-15 04:07:29 +03:00
2015-11-06 07:21:02 +03:00
site-clean : site /hakyll -std /hakyll -std \
2015-07-13 21:48:48 +03:00
$( call def-help,site-clean, remove hakyll-generated files ( & take down the website) ) #cleanolddocs
2015-11-06 07:21:02 +03:00
-cd site; hakyll-std/hakyll-std clean
2015-11-06 06:32:17 +03:00
# rm -rf site/_site/*
2015-07-12 06:29:14 +03:00
2017-04-27 20:00:26 +03:00
# regenerate html whenever markdown files change (and serve it on port 8000)
# XXX hakyll preview/watch often fail to notice changes in large files
# XXX can get confused when docs are generated concurrently by a Shake command
2018-03-09 07:18:32 +03:00
# XXX individual file updates loses the stylesheets for some reason
# more robust: "ls site/*.md | entr ./Shake website" and reload file:///Users/simon/src/hledger/site/_site/docs.html
2015-11-06 07:21:02 +03:00
site-preview : site /hakyll -std /hakyll -std \
2015-11-06 06:32:17 +03:00
$( call def-help,site-preview, run a hakyll server to preview the website ) #site/site
2015-11-06 07:21:02 +03:00
-cd site; hakyll-std/hakyll-std watch # -h hledger.org
2015-07-12 06:29:14 +03:00
2017-04-27 20:00:26 +03:00
# open a browser on the latest site html and reload the page whenever it changes
site-reload :
( sleep 1; open http://localhost:8001) &
livereloadx -p 8001 --static site/_site
2015-07-12 06:29:14 +03:00
# site-view: site \
# $(call def-help,site-view,\
# \
# )
2015-11-06 06:32:17 +03:00
# $(VIEWHTML) site/_site/index.html
2010-05-17 18:33:05 +04:00
2015-07-12 06:29:14 +03:00
# # site-auto:
2015-11-06 06:32:17 +03:00
# # cd site; $(AUTOBUILD) site.hs -o site $(PREFERMACUSRLIBFLAGS) --run preview
2010-07-18 03:09:24 +04:00
2015-07-12 06:29:14 +03:00
# # ensure some old doc versions are in place:
2013-04-06 23:39:35 +04:00
2015-07-12 06:29:14 +03:00
# #olddocs: doc/0.22 doc/0.21
2013-09-10 03:10:43 +04:00
2015-07-12 06:29:14 +03:00
# #doc/0.23:
# # (cd doc; git archive --prefix doc/0.23/ tags/0.23 'doc/MANUAL.md') | tar xf -
2014-01-12 09:27:36 +04:00
2015-07-12 06:29:14 +03:00
# # doc/0.22:
# # git archive --prefix doc/0.22/ tags/0.22 'MANUAL.md' | tar xf -
2013-12-14 07:19:17 +04:00
2015-07-12 06:29:14 +03:00
# # doc/0.21:
# # git archive --prefix doc/0.21/ tags/0.21.3 'MANUAL.md' | tar xf -
2013-03-31 18:58:04 +04:00
2015-07-12 06:29:14 +03:00
# # cleanolddocs:
# # cd doc; rm -rf 0.22 0.21
2009-06-02 10:58:43 +04:00
2010-02-26 03:23:44 +03:00
2015-07-12 06:29:14 +03:00
# pdf: codepdf \
# $(call def-help,pdf,\
# \
# ) #docspdf
2009-06-14 01:37:06 +04:00
2015-07-12 06:29:14 +03:00
# # generate pdf versions of main docs
# # 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
2015-07-12 06:29:14 +03:00
# # # format all code as a pdf for offline reading
# # ENSCRIPT=enscript -q --header='$$n|$$D{%+}|Page $$% of $$=' --highlight=haskell --line-numbers --font=Courier6 --color -o-
# # 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
2010-02-13 23:21:08 +03:00
2015-07-12 06:29:14 +03:00
# # # view all docs and code as pdf
# # PDFS=site/{README,README2,MANUAL,CHANGES,CONTRIBUTORS}.pdf code.pdf
# # viewall: pdf
# # $(VIEWPDF) $(PDFS)
2010-02-13 23:21:08 +03:00
2015-07-12 06:29:14 +03:00
# # # print all docs and code for offline reading
# # printall: pdf
# # $(PRINT) $(PDFS)
2010-02-13 23:21:08 +03:00
2015-07-12 06:29:14 +03:00
# pushdocs: push \
# $(call def-help,pushdocs,\
# push latest docs etc. and update the hledger.org site\
# )
# ssh simon@joyful.com 'make -C/repos/hledger docs'
2009-05-29 12:29:04 +04:00
2015-07-12 06:29:14 +03:00
# EXES=hledger hledger-vty hledger-web
# savehelp: \
# $(call def-help,savehelp,\
# dump all executables command line help into files for review\
# )
# for e in $(EXES); do $$e --help >.HELP_$$e; done
2011-04-22 20:16:31 +04:00
2015-07-12 06:29:14 +03:00
# codedocs: haddock hscolour coverage \
# $(call def-help,codedocs,\
# generate api & other code docs\
# ) #sourcegraph #hoogle
2010-11-20 00:39:17 +03:00
2014-07-08 22:52:06 +04:00
# cf http://www.haskell.org/haddock/doc/html/invoking.html
# --ghc-options=-optP-P is a workaround for http://trac.haskell.org/haddock/ticket/284
HADDOCKFLAGS = \
--haddock-options= '--no-warnings' \
--ghc-options= '-optP-P' \
2015-07-12 06:29:14 +03:00
haddock : \
2015-07-12 22:03:43 +03:00
$( call def-help,haddock, generate haddock docs for the hledger packages )
2016-05-27 18:12:48 +03:00
$( STACK) haddock --no-haddock-deps --no-keep-going # && echo OK
# $(STACK) -v haddock --no-haddock-deps --no-keep-going # && echo OK
2014-07-08 22:52:06 +04:00
2015-07-12 06:29:14 +03:00
# view-haddock: \
# $(call def-help,view-haddock-cli,\
# view the haddock generated for the hledger package\
# )
# $(VIEWHTML) hledger/dist/doc/html/hledger/index.html
2014-07-08 22:52:06 +04:00
2015-07-12 06:29:14 +03:00
# # http://www.cs.york.ac.uk/fp/darcs/hscolour/
# HSCOLOUR=HsColour -css
2015-11-06 06:32:17 +03:00
# hscolour: site/api/src site/api/src/hscolour.css \
2015-07-12 06:29:14 +03:00
# $(call def-help,hscolour,\
# \
# )
# for f in $(HADDOCKSOURCEFILES); do \
2015-11-06 06:32:17 +03:00
# $(HSCOLOUR) -anchor $$f -osite/api/src/`echo $$f | sed -e's%[^/]*/%%' | sed -e's%/%-%g' | sed -e's%\.hs$$%.html%'` ; \
2015-07-12 06:29:14 +03:00
# done
2014-07-08 22:52:06 +04:00
2015-11-06 06:32:17 +03:00
# site/api/src/hscolour.css: site/api/src \
# $(call def-help,site/api/src/hscolour.css,\
2015-07-12 06:29:14 +03:00
# \
# )
2015-11-06 06:32:17 +03:00
# $(HSCOLOUR) -print-css >site/api/src/hscolour.css
2014-07-08 22:52:06 +04:00
2015-11-06 06:32:17 +03:00
# site/api/src: \
# $(call def-help,site/api/src,\
2015-07-12 06:29:14 +03:00
# \
# )
2015-11-06 06:32:17 +03:00
# mkdir -p site/api/src
2014-07-08 22:52:06 +04:00
2015-07-12 06:29:14 +03:00
# sourcegraph: \
# $(call def-help,sourcegraph,\
# \
# )
# for p in $(PACKAGES); do (cd $$p; SourceGraph $$p.cabal); done
# # # generate external api docs for each package
# # allhaddock: cabalhaddock\ --hyperlink-source\ --executables
# # # generate internal code docs for each package
# # allhaddockinternal: cabalhaddock\ --hyperlink-source\ --executables\ --internal
# # # generate hoogle indices for each package
# # allhoogle: cabalhaddock\ --hoogle\ --executables
# #set up the hoogle web interface
# ## 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: ?
# # 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
# #
# #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-/'`
# # hoogle: hoogleindex
# # if test -f $(HOOGLE) ; then \
# # cd site/api && \
# # 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
# #
# #generate a hoogle index
# # hoogleindex:
# # $(HADDOCK) $(HADDOCKFLAGS) -o site/api --hoogle $(MAIN) && \
# # cd site/api && \
# # hoogle --convert=main.txt --output=default.hoo
2009-05-29 12:29:04 +04:00
2017-07-05 10:17:01 +03:00
#
2017-06-22 19:56:59 +03:00
2015-10-20 16:26:09 +03:00
# in subsequent rules, allow automatic variables to be used in prerequisites (use $$)
.SECONDEXPANSION :
2017-08-17 01:25:09 +03:00
########################
2017-08-25 22:01:31 +03:00
# 2017 changelog process:
2017-12-31 05:20:30 +03:00
# at release time, in each package dir, make changes-show >CHANGES.org, edit, move to CHANGES. Eg:
# for p in hledger-lib hledger hledger-ui hledger-web hledger-api; do (cd $p; make -f../Makefile changes-show-from-hledger-1.4 >CHANGES.org); done
# TODO: prints junk after failing help-system.mk include, make changes-show doesn't work from subdir, want to run from top dir; move to Shake
2017-08-17 01:25:09 +03:00
LASTTAG = $( shell git describe --tags --abbrev= 0)
2017-12-31 05:20:30 +03:00
changes-show : $( call def -help ,changes -show , show commits affecting the current directory excluding any hledger package subdirs from the last tag as org nodes newest first )
2017-08-25 22:01:31 +03:00
@make changes-show-from-$( LASTTAG)
2017-08-17 01:25:09 +03:00
2017-12-31 05:20:30 +03:00
changes-show-from-% : #$(call def-help,changes-show-from-REV, show commits affecting the current directory excluding any hledger package subdirs from this git revision onward as org nodes newest first )
2017-08-25 22:01:31 +03:00
@git log --abbrev-commit --pretty= format:'ORGNODE %s (%an)%n%b%h' $* .. -- . ':!hledger' ':!hledger-*' \
| sed -e 's/^\*/-/' -e 's/^ORGNODE/*/' \
| sed -e 's/ (Simon Michael)//'
2018-05-15 19:38:02 +03:00
# would be nice to sort changes by case-insensitive name and reverse date, like
# git ll hledger-1.9.1.. -- hledger* | grep -v doc: | sort -f -k3,3 -k1,1r
2017-08-17 01:25:09 +03:00
2017-08-25 22:01:31 +03:00
# old:
## The last git revision referenced in the change notes.
## (Or, if there are no change notes, the last tag.
## Tries hard to be warning free and run shell commands only when needed.)
#CHANGENOTESLASTREV=$(subst %,,$(subst %%,$(LASTTAG),%$(shell [ -f $(CHANGENOTES) ] && (grep -E '^[a-f0-9]{8}$$' $(CHANGENOTES) | tail -1) )%))
#
## create change notes file if it doesn't exist.. shouldn't happen much.
#$(CHANGENOTES):
# @make changenotes-start
#
#changenotes-template:
# @(\
# echo "* change notes for hledger-$(VERSION)" ;\
# echo "** hledger-lib" ;\
# echo "** hledger" ;\
# echo "** hledger-ui" ;\
# echo "** hledger-web" ;\
# echo "** hledger-api" ;\
# echo "** hledger-install" ;\
# echo "** project" ;\
# echo "** unsorted" ;\
# )
#
#changenotes-start: \
# $(call def-help,changenotes-start, add a new outline named after $(VERSIONFILE) in $(CHANGENOTES). Run after bumping $(VERSIONFILE). )
# @make changenotes-template >>$(CHANGENOTES)
#
## TODO problem: this only checks the last (bottom-most) git rev in the
## change notes file, so after manual editing has begun this may re-add
## commits which are already in the file.
#changenotes-update: $(CHANGENOTES) \
# $(call def-help,changenotes-update, add any not-yet-added(*) commits to $(CHANGENOTES). Run periodically (* it may get this wrong once manual editing has begun). )
# @make changenotes-show-from-$(CHANGENOTESLASTREV) >>$(CHANGENOTES)
# @echo "Latest items in $(CHANGENOTES):"
# @make changenotes-show | tail -10
# @make changenotes-show-last
#
#changenotes-update-from-%: \
## $(call def-help,changenotes-update-from-REV, add commits from this git revision onward to $(CHANGENOTES) )
# @make changenotes-show-from-$* >>$(CHANGENOTES)
#
#changenotes-show-from-%: \
## $(call def-help,changenotes-show-from-REV, show commits from this git revision onward as org nodes )
# @git log --abbrev-commit --reverse --pretty=format:'ORGNODE %s (%an)%n%b%h' $*.. \
# | sed -e 's/^\*/-/' -e 's/^ORGNODE/***/' \
# | sed -e 's/ (Simon Michael)//'
#
#changenotes-show: $(CHANGENOTES) \
# $(call def-help,changenotes-show, show all the org headlines recorded in $(CHANGENOTES) )
# @cat $(CHANGENOTES) | grep '*'
#
## git l is a local alias with output like "2017-08-16 0a0e6d18 tools: make help-SECTION (HEAD -> master)"
#changenotes-show-last: $(CHANGENOTES) \
# $(call def-help,changenotes-show-last, show the last commit recorded in $(CHANGENOTES) )
# @git l -1 $(CHANGENOTESLASTREV)
2017-08-17 01:25:09 +03:00
2015-07-12 06:29:14 +03:00
###############################################################################
2017-08-16 16:00:59 +03:00
$(call def-help-subheading,RELEASING : )
#$(call def-help-subheading,see also developer guide -> how to -> do a release)
2015-07-12 06:29:14 +03:00
2017-08-01 02:12:59 +03:00
# TODO update this:
2015-07-12 06:29:14 +03:00
# # Version numbering. See also .version and Version.hs.
# #
# # hledger's version number appears in:
# # hledger --version
# # hledger's cabal file
# # darcs tags
# # hackage tarball filenames
# # hackage pages
# #
# # Some old version numbering goals:
# # 1 automation, robustness, simplicity, platform independence
# # 2 cabal versions must be all-numeric
# # 3 release versions can be concise (without extra .0's)
# # 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
# # 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)
# #
# # 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.
# #
# # - The .version file must be updated manually before a release.
# #
# # - "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.
2017-08-01 02:12:59 +03:00
# TODO revive these:
2011-06-06 23:06:26 +04:00
2017-08-01 02:12:59 +03:00
# old examples:
# a normal release: echo 0.7 >.version; make release
# a bugfix release: echo 0.7.1 >.version; make release
#release: releasetest bumpversion tagrelease $(call def-help,release, prepare a release and tag the repo )
2011-06-06 23:06:26 +04:00
2017-08-01 02:12:59 +03:00
#publish: hackageupload pushdocs $(call def-help,upload, publish latest hackage packages and docs )
2009-05-29 12:29:04 +04:00
2017-08-01 02:12:59 +03:00
#releaseandpublish: release upload $(call def-help,releaseandupload, prepare a release and publish )
2015-07-12 06:29:14 +03:00
2017-08-01 02:12:59 +03:00
ISCLEAN = git diff-index --quiet HEAD --
2015-09-03 22:42:14 +03:00
2017-08-01 02:12:59 +03:00
# stop if the working directory has uncommitted changes
iscleanwd :
@$( ISCLEAN) || ( echo "please clean the working directory first" ; false )
2009-06-22 23:52:58 +04:00
2017-08-01 02:12:59 +03:00
# stop if the given file(s) have uncommitted changes
isclean-% :
@$( ISCLEAN) $* || ( echo " please clean these files first: $* " ; false )
2009-12-12 05:55:59 +03:00
2018-01-04 21:25:10 +03:00
# @$(ISCLEAN) doc/lib.m4 || (echo "please clean doc/lib.m4 first"; false)
2017-12-31 21:21:31 +03:00
setdate : $( call def -help ,setdate , set date in manuals to current month and year )
2017-08-01 02:12:59 +03:00
perl -pe " s/^(m4_define\({{_monthyear_}}, *{{)[^}]*(}}\)m4_dnl *) $$ /\$ ${ 1 } $( MONTHYEAR) \$ ${ 2 } / " -i doc/lib.m4
2017-12-31 21:21:31 +03:00
updatedate : setdate $( call def -help ,updatedate , set date in manuals to current month and year and commit )
2017-08-01 02:12:59 +03:00
git commit -m " bump manual date to $( MONTHYEAR) " doc/lib.m4
2017-12-31 21:21:31 +03:00
# update a package yaml file's version, -DVERSION, and hledger lower bounds (upper bounds must be changed manually)
2017-08-01 02:12:59 +03:00
%/package.yaml : $( VERSIONFILE )
2017-12-31 21:21:31 +03:00
perl -pe " s/(^version *: *).*/\$ ${ 1 } ' $( VERSION) '/ " -i $@ # version: 'A'
perl -pe " s/(-DVERSION=\")[^\"]+/\$ ${ 1 } $( VERSION) / " -i $@ # -DVERSION="A"
perl -pe " s/(hledger(-\w+)?) *== *((\d+\.)*\d+) * $$ /\$ $1 == $( VERSION) / " -i $@ # hledgerX == A
perl -pe " s/(hledger(-\w+)?) *>=? *((\d+\.)*\d+) * $$ /\$ $1 >= $( VERSION) / " -i $@ # hledgerX >= A
perl -pe " s/(hledger(-\w+)?) *>=? *((\d+\.)*\d+) *&& *< *((\d+\.)*\d+) * $$ /\$ $1 >= $( VERSION) && <\$ $5 / " -i $@ # hledgerX >= A && < B
2017-06-06 19:20:55 +03:00
2017-08-01 02:12:59 +03:00
# update hledger-api's version strings
hledger-api/hledger-api.hs : $( VERSIONFILE )
perl -pe " s/(hledgerApiVersion=)\"((\d+\.)*\d+)\" * $$ /\$ $1 \" $( VERSION) \"/ " -i $@
perl -pe " s/(.*?hledger-api +)((\d+\.)*\d+)(.*) $$ /\$ ${ 1 } $( VERSION) \$ $4 / " -i $@
# update version string used in generated docs
doc/lib.m4 : $( VERSIONFILE )
perl -pe " s/^(m4_define\({{_version_}}, *{{)((\d+\.)*\d+)(}}\)m4_dnl *) $$ /\$ ${ 1 } $( VERSION) \$ ${ 4 } / " -i $@
@echo "please manually check/update _docversionlinks_ in doc/lib.m4"
# XXX obsolete ?
# update version string in manual
#site/manual-start.md: $(VERSIONFILE)
# perl -p -e "s/(this version documents hledger and hledger-web) +[0-9.]+/\1 $(VERSION)/" -i $@
# XXX start with early targets isclean-$(VERSIONSENSITIVEFILES) (fails due to glob) and isdirty-$(VERSIONFILE) ?
setversion : $( VERSIONSENSITIVEFILES ) #$(call def-help,setversion, update version strings & bounds from $(VERSIONFILE) (might need -B) )
2018-01-04 21:25:10 +03:00
@echo "if this is a new major version, please manually update upper bounds in */package.yaml before generating cabal files"
2017-08-01 02:12:59 +03:00
2018-01-04 21:25:10 +03:00
# TODO: combine updateversion/updatecabal
# minor version bump: make setdate setversion gencabal
# major version bump: make setdate setversion, fix upper bounds in package.yamls, make gencabal
# updateversion: setdate setversion $(call def-help,updateversion, update manual date and update version strings & (lower) bounds from $(VERSIONFILE) and commit )
# @read -p "please review changes then press enter to commit $(VERSIONFILE) $(VERSIONSENSITIVEFILES)"
# git commit -m "bump version strings & bounds to $(VERSION)" $(VERSIONFILE) $(VERSIONSENSITIVEFILES)
2017-08-01 02:12:59 +03:00
# (re)generate a cabal file from its package.yaml definition
# XXX to avoid warnings, this hpack should be the same version as stack's built-in hpack
2017-12-30 19:56:10 +03:00
#%.cabal: $$(dir $$@)package.yaml
# hpack --silent $(dir $*)
#
gencabal : $( call def -help ,gencabal , regenerate cabal files from package .yaml files with stack )
2018-04-04 19:55:26 +03:00
$( STACK) build --dry-run --silent --stack-yaml stack-ghc8.2.yaml
2017-08-01 02:12:59 +03:00
2018-04-20 06:49:08 +03:00
gencabal-with-hpack-% :
$( STACK) build --with-hpack hpack-$* --dry-run --silent --stack-yaml stack-ghc8.2.yaml
2018-01-04 21:25:10 +03:00
# updatecabal: gencabal $(call def-help,updatecabal, regenerate cabal files and commit )
# @read -p "please review changes then press enter to commit $(shell ls */*.cabal)"
# git commit -m "update cabal files" $(shell ls */*.cabal)
2017-08-01 02:12:59 +03:00
# we call in shake for this job; so dependencies aren't checked here
genmanuals : Shake #$(call def-help,genmanuals, regenerate embedded manuals (might need -B) )
./Shake manuals
updatemanuals : genmanuals $( call def -help ,updatemanuals , regenerate embedded manuals and commit ( might need -B ) )
2017-12-30 19:56:10 +03:00
@read -p " please review changes then press enter to commit $( shell ls hledger*/hledger*.{ 1,5,info,txt} ) "
2017-12-07 05:16:35 +03:00
git commit -m "update embedded manuals" hledger*/hledger*.{ 1,5,info,txt}
2017-08-01 02:12:59 +03:00
2010-09-10 02:54:34 +04:00
2015-07-12 22:03:43 +03:00
tagrelease : \
$( call def-help,tagrelease, commit a release tag based on $( VERSIONFILE) for each package )
2017-04-01 04:29:41 +03:00
for p in $( PACKAGES) ; do git tag -f $$ p-$( VERSION) ; done
2010-09-10 02:54:34 +04:00
2015-07-12 06:29:14 +03:00
# 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
2009-02-27 05:55:54 +03:00
2017-04-01 04:16:04 +03:00
hackageupload : \
$( call def-help,hackageupload, upload all packages to hackage )
for p in $( PACKAGES) ; do stack upload $$ p; done
2009-02-27 05:55:54 +03:00
2015-07-12 06:29:14 +03:00
# RSYNC=rsync
2010-07-18 03:09:24 +04:00
2015-07-12 06:29:14 +03:00
# pushprofs: \
# $(call def-help,pushprofs,\
# push any new profiles and benchmark results to the public site\
# beware, results will vary depending on which machine generated them\
# )
# $(RSYNC) -azP doc/profs/ simon@joyful.com:/repos/hledger/doc/profs/
2009-02-26 20:37:46 +03:00
2015-07-12 06:29:14 +03:00
# pullprofs: \
# $(call def-help,pullprofs,\
# fetch any new profiles and benchmark results from the public site\
# )
# $(RSYNC) -azP simon@joyful.com:/repos/hledger/doc/profs/ doc/profs/
2013-07-11 02:28:34 +04:00
2015-07-12 06:29:14 +03:00
# compressbinary: \
# $(call def-help,compressbinary,\
# compress the just-built platform binary. make hledgerPLATFORM first. Use\
# the win variant on windows.\
# )
# gzip -9 bin/$(BINARYFILENAME)
2013-01-11 17:32:42 +04:00
2015-07-12 06:29:14 +03:00
# compressbinarywin: \
# $(call def-help,compressbinarywin,\
# \
# )
# cd bin; zip -9 $(BINARYFILENAME).zip $(BINARYFILENAME)
# # push the last-updated platform binary to the public download directory
# # pushlatestbinary:
# # cd bin; $(RSYNC) -aP `ls -t | head -2` simon@joyful.com:/repos/hledger/site/download/
# showreleasestats stats: \
# showreleasedays \
# showunreleasedchangecount \
# showloc \
# showtestcount \
# showunittestcoverage \
# showreleaseauthors \
# showunreleasedcodechanges \
# showunpushedchanges \
# $(call def-help,showreleasestats stats,\
# show project stats useful for release notes\
# )
# # showerrors
2012-10-22 01:09:24 +04:00
2015-07-12 06:29:14 +03:00
# FROMTAG=.
2009-05-30 01:00:38 +04:00
2015-07-12 06:29:14 +03:00
# showreleasedays: \
# $(call def-help,showreleasedays,\
# \
# )
# @echo Days since last release:
# @tools/dayssincetag.hs $(FROMTAG) | head -1 | cut -d' ' -f-1
# @echo
2009-05-29 23:26:09 +04:00
2015-07-12 06:29:14 +03:00
# # XXX
# showunreleasedchangecount: \
# $(call def-help,showunreleasedchangecount,\
# \
# )
# @echo Commits since last release:
# @darcs changes --from-tag $(FROMTAG) --count
# @echo
2015-06-17 23:52:04 +03:00
2017-08-01 02:12:59 +03:00
describe : $( call def -help ,describe , show a precise git -describe version string )
@git describe --tags --match 'hledger-[0-9]*' --dirty
2017-08-17 01:25:09 +03:00
# showreleaseauthors: $(call def-help,showreleaseauthors, show author names since last release)
# @echo Commit authors since last release:
# @git shortlog -sn $(CHANGELOGSTART).. # TODO undefined
2011-04-22 22:47:57 +04:00
2017-08-01 02:12:59 +03:00
cloc : $( call def -help ,cloc , count lines of source code )
2016-01-17 19:52:19 +03:00
@echo Lines of code including tests:
2016-02-20 09:05:41 +03:00
@cloc --exclude-lang= HTML --exclude-dir= .stack-work,.idea,dist,old,bin,doc,site,.tutorial-data,static,angular .
2016-01-17 19:52:19 +03:00
@echo
# `ls $(SOURCEFILES)`
2011-09-25 22:29:23 +04:00
2015-07-12 06:29:14 +03:00
# sloc: \
# $(call def-help,sloc,\
# \
# )
# @sloccount hledger-lib hledger hledger-web
2008-11-24 00:50:38 +03:00
2015-07-12 06:29:14 +03:00
# cloc: \
# $(call def-help,cloc,\
# \
# )
# @echo
# @echo "Lines of code as of `date`:"
# @echo
# @echo "hledger-lib, hledger"
# @cloc -q hledger-lib hledger 2>&1 | grep -v 'defined('
# @echo
# @echo "hledger-web"
# @cloc -q hledger-web 2>&1 | grep -v 'defined('
# @echo
# @echo "hledger-lib, hledger, hledger-web"
# @cloc -q hledger-lib hledger hledger-web 2>&1 | grep -v 'defined('
2009-05-17 18:13:06 +04:00
2015-07-12 06:29:14 +03:00
# showtestcount: \
# $(call def-help,showtestcount,\
# \
# )
# @echo "Unit tests:"
# @hledger test 2>&1 | cut -d' ' -f2
# @echo "Functional tests:"
# @make --no-print functest | egrep '^ Total' | awk '{print $$2}'
# @echo
2013-07-11 02:29:00 +04:00
2015-07-12 06:29:14 +03:00
# showunittestcoverage: \
# $(call def-help,showunittestcoverage,\
# \
# )
# @echo Unit test coverage:
# @make --no-print quickcoverage | grep 'expressions'
# @echo
2009-06-04 05:33:31 +04:00
2015-07-12 06:29:14 +03:00
# # showerrors:
# # @echo Known errors:
# # @awk '/^** errors/, /^** / && !/^** errors/' NOTES.org | grep '^\*\*\* ' | tail +1
# # @echo
# # XXX
# showunpushedchanges showunpushed: \
# $(call def-help,showunpushedchanges showunpushed,\
# \
# )
# @echo "Changes not yet pushed upstream (to `darcs show repo | grep 'Default Remote' | cut -c 17-`):"
# @-darcs push simon@joyful.com:/repos/hledger --dry-run | grep '*' | tac
2010-05-24 02:46:40 +04:00
# @echo
2009-05-17 18:13:06 +04:00
2015-07-12 06:29:14 +03:00
# # XXX
# showunreleasedcodechanges showunreleased showchanges: \
# $(call def-help,showunreleasedcodechanges showunreleased showchanges,\
# \
# )
# @echo "hledger code changes since last release:"
# @darcs changes --from-tag $(FROMTAG) --matches "not (name docs: or name doc: or name site: or name tools:)" | grep '*'
# @echo
# # XXX
# showcodechanges: \
# $(call def-help,showcodechanges,\
# \
# )
# @echo "hledger code changes:"
# @darcs changes --matches "not (name docs: or name site: or name tools:)" | egrep '^ +(\*|tagged)'
# @echo
2009-05-29 12:29:04 +04:00
2015-06-17 23:52:04 +03:00
###############################################################################
2017-08-16 16:00:59 +03:00
$(call def-help-subheading,MISCELLANEOUS : )
2015-03-30 22:02:48 +03:00
2018-05-18 05:39:45 +03:00
watch-% : $( call def -help ,watch -RULE , run make RULE repeatedly when any committed file changes )
2018-05-18 05:10:12 +03:00
@git ls-files | entr -r make $*
2018-05-18 04:09:54 +03:00
2017-08-01 02:12:59 +03:00
Shake : Shake .hs $( call def -help ,Shake , ensure the Shake script is compiled )
./Shake.hs
2015-07-15 01:19:05 +03:00
cabal% : \
$( call def-help,cabalCMD, run cabal CMD inside each hledger package directory )
for p in $( PACKAGES) ; do ( cd $$ p; cabal $* ) ; done
2015-07-12 22:03:43 +03:00
usage : cabalusage stackusage \
$( call def-help,usage, show size of various dirs )
du -sh .git bin data doc extra
du -sh .
2009-05-29 12:29:04 +04:00
2015-07-12 22:03:43 +03:00
stackusage : \
2015-07-15 01:19:05 +03:00
$( call def-help,stackusage, show size of stack working dirs if any )
2015-07-12 22:03:43 +03:00
-du -shc ` find . -name '.stack*' `
2009-05-29 12:29:04 +04:00
2015-07-12 22:03:43 +03:00
cabalusage : \
$( call def-help,cabalusage, show size of cabal working dirs if any )
-du -shc */dist* 2>/dev/null
2014-10-18 21:18:36 +04:00
2017-06-22 17:28:00 +03:00
tag : emacstags -ctags \
2015-07-12 22:03:43 +03:00
$( call def-help,tag, generate tag files for source code navigation ( for emacs) )
2012-03-30 00:41:47 +04:00
2017-06-22 17:28:00 +03:00
# Tag haskell files with hasktags and just list the other main source files
# so they will be traversed by tags-search/tags-query-replace.
2015-07-12 22:03:43 +03:00
emacstags :
2016-01-25 19:21:29 +03:00
rm -f TAGS
hasktags -e $( SOURCEFILES)
2017-08-01 02:12:59 +03:00
for f in Makefile $( WEBCODEFILES) $( HPACKFILES) $( CABALFILES) $( DOCSOURCEFILES) ; do \
2016-01-25 19:21:29 +03:00
printf " \n$$ f,1\n " >> TAGS; \
done
2008-10-03 11:40:28 +04:00
2017-06-22 17:28:00 +03:00
# Tag haskell files with hasktags and everything else not excluded by .ctags
# with (exuberant) ctags.
emacstags-ctags :
hasktags -e $( SOURCEFILES)
ctags -a -e -R
2015-07-12 22:03:43 +03:00
cleantags : \
$( call def-help-hide,cleantags, remove tag files )
rm -f TAGS tags
2014-10-18 21:18:36 +04:00
2015-07-12 22:03:43 +03:00
stackclean : \
$( call def-help-hide,stackclean, remove .stack-work/* in packages ( but not in project) )
2016-05-27 18:12:48 +03:00
$( STACK) clean
2015-07-12 22:03:43 +03:00
Stackclean : \
$( call def-help-hide,Stackclean, remove all stack working dirs )
2016-05-27 18:12:48 +03:00
$( STACK) clean
2015-07-12 22:03:43 +03:00
cleanghco : \
$( call def-help-hide,cleanghc, remove ghc build leftovers )
2015-07-15 03:38:02 +03:00
rm -rf ` find . -name "*.o" -o -name "*.hi" -o -name "*.dyn_o" -o -name "*.dyn_hi" -o -name "*~" | grep -vE '\.(stack-work|cabal-sandbox|virthualenv)' `
2015-07-12 22:03:43 +03:00
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) )
2015-10-20 16:26:09 +03:00
Clean : stackclean cabalclean cleanghc cleantags clean -manpages \
2015-07-12 22:03:43 +03:00
$( 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))
2015-06-17 23:52:04 +03:00
###############################################################################
# LOCAL UNTRACKED CUSTOMISATIONS
2014-10-18 20:30:53 +04:00
2015-06-17 23:52:04 +03:00
- i n c l u d e l o c a l . m k
2015-07-12 22:03:43 +03:00
2017-08-16 16:00:59 +03:00
#$(call def-help-heading,------------------)