2016-10-28 21:15:10 +03:00
|
|
|
|
# One of two project scripts files (Makefile, Shake.hs).
|
2019-02-04 02:56:57 +03:00
|
|
|
|
# This one was a reboot of Makefile.old.
|
|
|
|
|
# It is probably used by hledger developers/contributors but not end-users.
|
2016-10-28 21:15:10 +03:00
|
|
|
|
# It requires GNU Make (https://www.gnu.org/software/make/).
|
2019-04-20 19:25:36 +03:00
|
|
|
|
# Also, some rules may require:
|
2016-10-28 21:15:10 +03:00
|
|
|
|
# - stack (http://haskell-lang.org/get-started, installs libs and runs ghc)
|
|
|
|
|
# - shelltestrunner (hackage, runs functional tests)
|
|
|
|
|
# - quickbench (hackage/stackage, runs benchmarks)
|
2019-05-21 22:32:58 +03:00
|
|
|
|
# - ghcid (hackage/stackage, recompiles and optionally runs tests on file change)
|
2016-10-28 21:15:10 +03:00
|
|
|
|
# - hasktags (hackage, generates tag files for code navigation)
|
2019-04-20 19:25:36 +03:00
|
|
|
|
# - profiterole (hackage/stackage, simplifies profiles)
|
2016-10-28 21:15:10 +03:00
|
|
|
|
# - profiteur (hackage/stackage, renders profiles as html)
|
|
|
|
|
# - hpack (hackage/stackage, generates cabal files from package.yaml files)
|
|
|
|
|
# - perl
|
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)
|
2019-02-04 02:56:57 +03:00
|
|
|
|
# - cabal (v1) build: built with cabal (and maybe a sandbox)
|
2015-07-12 22:03:43 +03:00
|
|
|
|
# (hledger/dist/build/hledger/hledger, installs to ~/.cabal/bin)
|
2019-02-04 02:56:57 +03:00
|
|
|
|
# - ghc-only build: built quickly with ghc only, unoptimised, with DEVELOPMENT flag
|
|
|
|
|
# (hledgerdev)
|
2015-07-12 22:03:43 +03:00
|
|
|
|
#
|
|
|
|
|
# This makefile mostly uses stack to get things done (slow but robust).
|
2019-02-04 02:56:57 +03:00
|
|
|
|
# It may sometimes (still ?) use ghc only, or cabal, when easier.
|
2017-08-01 02:12:59 +03:00
|
|
|
|
|
2020-08-08 22:07:06 +03:00
|
|
|
|
# see also: https://gmsl.sourceforge.io/
|
|
|
|
|
|
2017-08-01 02:12:59 +03:00
|
|
|
|
# XXX do we need this ?
|
|
|
|
|
#SHELL=/bin/bash
|
|
|
|
|
#.SHELLFLAGS="-O extglob -c" # example
|
|
|
|
|
|
2019-02-04 02:56:57 +03:00
|
|
|
|
###############################################################################
|
|
|
|
|
# MAKEFILE HELP SYSTEM
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
2019-02-04 04:10:13 +03:00
|
|
|
|
# This defines the def-help* functions for generating makefile help
|
|
|
|
|
# (see the file for more details), and a "help" target (our default).
|
|
|
|
|
# Every useful rule in this makefile should use def-help to describe itself.
|
|
|
|
|
# "make" or "make help" will show these descriptions.
|
2019-03-06 05:41:51 +03:00
|
|
|
|
-include Makefile.helpsys
|
2015-06-17 23:52:04 +03:00
|
|
|
|
|
2019-02-04 04:10:13 +03:00
|
|
|
|
# Some calls and dummy targets to augment the default help output.
|
|
|
|
|
# Also, help-SUBSTR and SUBSTR-help targets to show only matching help.
|
2019-02-04 02:56:57 +03:00
|
|
|
|
$(call def-help-heading,Main rules in the hledger project Makefile:)
|
|
|
|
|
$(call def-help-subheading,HELP:)
|
|
|
|
|
dummy1: $(call def-help,[help], list documented rules in this makefile )
|
2018-08-18 21:22:15 +03:00
|
|
|
|
help-%: $(call def-help,help-SECTION, list documented rules containing some string )
|
2020-07-10 19:28:46 +03:00
|
|
|
|
@make help 2>&1 | grep -i $*
|
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 $*
|
2019-02-04 02:56:57 +03:00
|
|
|
|
dummy2: $(call def-help,RULE -n, show what RULE would do )
|
2017-08-17 01:25:09 +03:00
|
|
|
|
|
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)
|
2019-07-26 02:48:09 +03:00
|
|
|
|
PROFCMD=stack exec --profile -- hledger 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
|
|
|
|
|
|
2019-02-25 03:22:51 +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)
|
2020-09-08 01:27:46 +03:00
|
|
|
|
|
|
|
|
|
# can override this with an env var, eg:
|
|
|
|
|
# STACK="stack --stack-yaml=stack8.10.yaml" make functest
|
|
|
|
|
STACK ?= stack
|
|
|
|
|
|
2018-04-12 17:14:57 +03:00
|
|
|
|
# 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
|
2019-06-15 04:11:12 +03:00
|
|
|
|
SHELLTESTOPTS=--execdir -j16 --exclude=/_ #--hide-successes
|
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 \
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
2020-12-13 23:15:46 +03:00
|
|
|
|
BINARIES=\
|
|
|
|
|
hledger \
|
|
|
|
|
hledger-ui \
|
|
|
|
|
hledger-web \
|
|
|
|
|
|
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 \
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
|
|
|
|
MAIN=hledger/app/hledger-cli.hs
|
|
|
|
|
|
2019-06-07 01:15:53 +03:00
|
|
|
|
# All source files in the project (plus a few strays like Setup.hs & hlint.hs).
|
|
|
|
|
# Used eg for building tags. Doesn't reliably catch all source files.
|
2015-07-12 22:03:43 +03:00
|
|
|
|
SOURCEFILES:= \
|
2019-06-07 01:15:53 +03:00
|
|
|
|
dev.hs \
|
|
|
|
|
hledger/*hs \
|
|
|
|
|
hledger/app/*hs \
|
|
|
|
|
hledger/bench/*hs \
|
|
|
|
|
hledger/test/*hs \
|
|
|
|
|
hledger/Hledger/*hs \
|
|
|
|
|
hledger/Hledger/*/*hs \
|
|
|
|
|
hledger/Hledger/*/*/*hs \
|
|
|
|
|
hledger-*/*hs \
|
|
|
|
|
hledger-*/app/*hs \
|
|
|
|
|
hledger-*/test/*hs \
|
|
|
|
|
hledger-*/Hledger/*hs \
|
|
|
|
|
hledger-*/Hledger/*/*hs \
|
|
|
|
|
hledger-*/Hledger/*/*/*hs \
|
|
|
|
|
hledger-lib/Text/*/*hs \
|
2019-09-02 17:17:34 +03:00
|
|
|
|
# hledger-*/src/*hs \
|
2019-06-07 01:15:53 +03:00
|
|
|
|
|
|
|
|
|
# show the sorted, unique files matched by SOURCEFILES
|
|
|
|
|
sourcefiles:
|
|
|
|
|
@for f in $(SOURCEFILES); do echo $$f; done | sort | uniq
|
|
|
|
|
|
|
|
|
|
# show the sorted, unique subdirectories containing hs files
|
|
|
|
|
sourcedirs:
|
|
|
|
|
@find . -name '*hs' | sed -e 's%[^/]*hs$$%%' | sort | uniq
|
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:= \
|
2019-02-05 01:44:35 +03:00
|
|
|
|
doc/common.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
|
|
|
|
|
2019-01-25 23:45:21 +03:00
|
|
|
|
COMMANDHELPFILES:= \
|
|
|
|
|
hledger/Hledger/Cli/Commands/*.md \
|
|
|
|
|
|
2020-05-30 05:04:27 +03:00
|
|
|
|
WEBTEMPLATEFILES:= \
|
2015-07-12 22:03:43 +03:00
|
|
|
|
hledger-web/templates/* \
|
2020-05-30 05:04:27 +03:00
|
|
|
|
|
|
|
|
|
WEBCODEFILES:= \
|
2015-07-12 22:03:43 +03:00
|
|
|
|
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 \
|
2019-02-04 03:56:39 +03:00
|
|
|
|
CONTRIBUTING.md \
|
2017-08-01 02:12:59 +03:00
|
|
|
|
$(MANUALSOURCEFILES) \
|
2019-01-25 23:45:21 +03:00
|
|
|
|
$(COMMANDHELPFILES) \
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
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
|
|
|
|
|
|
2019-02-05 05:47:27 +03:00
|
|
|
|
# Two or three-part version string, set as program version in builds made by this makefile.
|
|
|
|
|
# We use hledger CLI's current version (XXX for all packages, which isn't quite right).
|
|
|
|
|
VERSION=$(shell cat hledger/.version)
|
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
|
|
|
|
|
2019-02-04 02:56:57 +03:00
|
|
|
|
# if you have need to try building in less memory
|
|
|
|
|
# GHCLOWMEMFLAGS= #+RTS -M200m -RTS
|
|
|
|
|
|
|
|
|
|
# ghc-only builds need the macro definitions generated by cabal
|
|
|
|
|
# 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
|
2019-02-04 02:56:57 +03:00
|
|
|
|
# or from stack's dist dir:
|
2016-12-31 01:33:14 +03:00
|
|
|
|
#CABALMACROSFLAGS=-optP-include -optP hledger/.stack-work/dist/*/*/build/autogen/cabal_macros.h
|
2015-07-12 06:29:14 +03:00
|
|
|
|
|
2019-02-18 06:50:59 +03:00
|
|
|
|
BUILDFLAGS=\
|
|
|
|
|
-rtsopts \
|
|
|
|
|
$(WARNINGS) \
|
|
|
|
|
$(INCLUDEPATHS) \
|
|
|
|
|
$(GHCLOWMEMFLAGS) $(CABALMACROSFLAGS) \
|
|
|
|
|
-DPATCHLEVEL=$(PATCHLEVEL) \
|
|
|
|
|
-DDEVELOPMENT \
|
|
|
|
|
-DVERSION="\"$(VERSION)\"" \
|
|
|
|
|
# -fhide-source-paths \
|
|
|
|
|
|
2015-07-12 06:29:14 +03:00
|
|
|
|
# PROFBUILDFLAGS:=-prof -fprof-auto -osuf hs_p
|
|
|
|
|
|
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-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
|
|
|
|
|
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
|
|
|
|
|
2020-07-10 19:29:16 +03:00
|
|
|
|
save-hledger-unopt: \
|
|
|
|
|
$(call def-help,save-hledger-fast, build an unoptimised hledger executable named with git describe in bin )
|
|
|
|
|
$(STACK) --verbosity=error install hledger --local-bin-path=bin && mv bin/hledger{,-`git describe --tags`-unopt}
|
|
|
|
|
@echo "built bin/hledger-`git describe --tags`-unopt"
|
|
|
|
|
|
|
|
|
|
save-hledger-unopt-%: \
|
|
|
|
|
$(call def-help,save-hledger-fast-EXT, build an unoptimised hledger executable named with the given extension in bin )
|
|
|
|
|
$(STACK) --verbosity=error install hledger --local-bin-path=bin && mv bin/hledger{,-$*-unopt}
|
|
|
|
|
@echo "built bin/hledger-$*-unopt"
|
|
|
|
|
|
|
|
|
|
save-hledger: \
|
|
|
|
|
$(call def-help,save-hledger, build an optimised hledger executable named with git describe in bin )
|
|
|
|
|
$(STACK) --verbosity=error install hledger --local-bin-path=bin && mv bin/hledger{,-`git describe --tags`}
|
|
|
|
|
@echo "built bin/hledger-`git describe --tags`"
|
|
|
|
|
|
|
|
|
|
save-hledger-%: \
|
|
|
|
|
$(call def-help,save-hledger-EXT, build an optimised hledger executable named with the given suffix in bin )
|
|
|
|
|
$(STACK) --verbosity=error install hledger --local-bin-path=bin && mv bin/hledger{,-$*}
|
|
|
|
|
@echo "built bin/hledger-$*"
|
|
|
|
|
|
2015-07-22 18:52:30 +03:00
|
|
|
|
hledgerprof: \
|
2019-07-26 02:48:09 +03:00
|
|
|
|
$(call def-help,hledgerprof, build a hledger executable with profiling enabled (with stack) )
|
|
|
|
|
$(STACK) build --profile hledger
|
|
|
|
|
# hledger-lib --ghc-options=-fprof-auto
|
|
|
|
|
# @echo "to profile, use $(STACK) exec --profile -- hledger ..."
|
2015-07-13 01:23:42 +03:00
|
|
|
|
|
2015-07-22 18:52:30 +03:00
|
|
|
|
hledgercov: \
|
|
|
|
|
$(call def-help,hledgercov, build "bin/hledgercov" for coverage reports (with ghc) )
|
2019-02-25 03:22:51 +03:00
|
|
|
|
$(STACK) ghc $(MAIN) -fhpc -o bin/hledgercov -outputdir .hledgercovobjs $(BUILDFLAGS)
|
2015-07-22 18:52:30 +03:00
|
|
|
|
|
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
|
|
|
|
# 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) \
|
2019-04-20 19:25:36 +03:00
|
|
|
|
&& profiterole 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
|
|
|
|
|
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 )
|
2019-02-25 03:22:51 +03:00
|
|
|
|
$(STACK) 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'
|
|
|
|
|
|
2020-04-07 04:00:25 +03:00
|
|
|
|
ghcid-web-run: $(call def-help,ghcid-web-run, start ghcid autobuilding and running hledger-web with sample journal on port 5001 )
|
|
|
|
|
ghcid -c 'make ghci-web' --test ':main -f examples/sample.journal --port 5001 --serve'
|
|
|
|
|
|
2018-06-08 16:01:36 +03:00
|
|
|
|
ghcid-test: $(call def-help,ghcid-test, start ghcid autobuilding and running the test command)
|
2019-11-27 23:53:30 +03:00
|
|
|
|
ghcid -c 'make ghci' --test ':main test -- --color=always'
|
2018-06-08 16:01:36 +03:00
|
|
|
|
|
2020-04-07 04:01:02 +03:00
|
|
|
|
ghcid-test-%: $(call def-help,ghcid-test-TESTPATTERN, start ghcid autobuilding and running the test command with this TESTPATTERN)
|
2019-11-27 23:53:30 +03:00
|
|
|
|
ghcid -c 'make ghci' --test ':main test -- --color=always -p$*'
|
2018-08-17 11:37:09 +03:00
|
|
|
|
|
2018-06-08 16:01:36 +03:00
|
|
|
|
ghcid-doctest: $(call def-help,ghcid-doctest, start ghcid autobuilding and running hledger-lib doctests)
|
2019-12-30 22:57:36 +03:00
|
|
|
|
ghcid -c 'cd hledger-lib; $(STACK) ghci hledger-lib:test:doctest' --test ':main' --reload hledger-lib
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
2020-03-01 21:18:22 +03:00
|
|
|
|
GHCIDRESTART=--restart Makefile --restart Makefile.local
|
|
|
|
|
GHCIDRELOAD=--reload t.j --reload t.timedot
|
|
|
|
|
GHCIDCMD=:main -f t.j bal date:today -S
|
|
|
|
|
|
|
|
|
|
ghcid-watch watch: $(call def-help,ghcid-watch, start ghcid autobuilding and running a custom GHCI command with reload/restart on certain files - customise this)
|
|
|
|
|
ghcid -c 'make ghci' --test '$(GHCIDCMD)' $(GHCIDRELOAD) $(GHCIDRESTART)
|
|
|
|
|
|
2019-01-30 20:09:04 +03:00
|
|
|
|
# keep synced with Shake.hs header
|
|
|
|
|
SHAKEDEPS= \
|
|
|
|
|
--package base-prelude \
|
|
|
|
|
--package directory \
|
|
|
|
|
--package extra \
|
2019-01-31 04:55:56 +03:00
|
|
|
|
--package process \
|
2020-05-23 17:05:30 +03:00
|
|
|
|
--package regex \
|
2019-01-30 20:09:04 +03:00
|
|
|
|
--package safe \
|
|
|
|
|
--package shake \
|
|
|
|
|
--package time \
|
2020-09-06 04:21:20 +03:00
|
|
|
|
# --package hledger-lib \ # for Hledger.Utils.Debug
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
2019-01-30 20:09:04 +03:00
|
|
|
|
ghcid-shake: $(call def-help,ghcid-shake, start ghcid autobuilder on Shake.hs)
|
|
|
|
|
stack exec $(SHAKEDEPS) -- ghcid Shake.hs
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
2020-02-26 00:44:06 +03:00
|
|
|
|
# run default GHCI
|
2020-04-07 04:01:02 +03:00
|
|
|
|
STACKGHCI=$(STACK)
|
2020-02-26 00:44:06 +03:00
|
|
|
|
# run latest GHCI for modern features
|
2020-04-07 04:01:02 +03:00
|
|
|
|
#STACKGHCI=stack --stack-yaml=stack8.10.yaml
|
2020-02-26 00:44:06 +03:00
|
|
|
|
|
2018-05-18 05:39:19 +03:00
|
|
|
|
# multi-package GHCI prompts
|
|
|
|
|
ghci: $(call def-help,ghci, start ghci REPL on hledger-lib + hledger)
|
2020-02-26 00:44:06 +03:00
|
|
|
|
$(STACKGHCI) exec -- $(GHCI) $(BUILDFLAGS) hledger/Hledger/Cli/Main.hs
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
2019-06-12 01:09:17 +03:00
|
|
|
|
ghci-prof: $(call def-help,ghci-prof, start ghci REPL on hledger-lib + hledger with profiling/call stack information)
|
2018-05-18 05:39:19 +03:00
|
|
|
|
stack build --profile hledger --only-dependencies
|
2020-02-26 00:44:06 +03:00
|
|
|
|
$(STACKGHCI) exec -- $(GHCI) $(BUILDFLAGS) -fexternal-interpreter -prof -fprof-auto hledger/Hledger/Cli/Main.hs
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
|
|
|
|
ghci-dev: $(call def-help,ghci-dev, start ghci REPL on hledger-lib + hledger + dev.hs script)
|
2020-02-26 00:44:06 +03:00
|
|
|
|
$(STACKGHCI) exec -- $(GHCI) $(BUILDFLAGS) -fno-warn-unused-imports -fno-warn-unused-binds dev.hs
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
|
|
|
|
ghci-ui: $(call def-help,ghci-ui, start ghci REPL on hledger-lib + hledger + hledger-ui)
|
2020-02-26 00:44:06 +03:00
|
|
|
|
$(STACKGHCI) exec -- $(GHCI) $(BUILDFLAGS) hledger-ui/Hledger/UI/Main.hs
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
|
|
|
|
ghci-web: link-web-dirs $(call def-help,ghci-web, start ghci REPL on hledger-lib + hledger + hledger-web)
|
2020-02-26 00:44:06 +03:00
|
|
|
|
$(STACKGHCI) exec -- $(GHCI) $(BUILDFLAGS) hledger-web/app/main.hs
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
2020-11-14 02:03:07 +03:00
|
|
|
|
ghci-web-test: link-web-dirs $(call def-help,ghci-web-test, start ghci REPL on hledger-lib + hledger + hledger-web + hledger-web test suite)
|
|
|
|
|
$(STACKGHCI) exec -- $(GHCI) $(BUILDFLAGS) hledger-web/test/test.hs
|
|
|
|
|
|
2018-05-18 05:39:19 +03:00
|
|
|
|
# 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 \
|
|
|
|
|
|
2018-08-03 20:09:00 +03:00
|
|
|
|
ghci-doctest: $(call def-help,ghci-doctest, start ghci REPL on hledger-lib doctests)
|
2020-02-26 00:44:06 +03:00
|
|
|
|
cd hledger-lib; $(STACKGHCI) ghci hledger-lib:test:doctest
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
2019-01-30 20:09:04 +03:00
|
|
|
|
ghci-shake: $(call def-help,ghci-shake, start ghci REPL on Shake.hs)
|
|
|
|
|
stack exec $(SHAKEDEPS) -- ghci Shake.hs
|
|
|
|
|
|
2020-12-13 23:15:46 +03:00
|
|
|
|
copy-bins-to-%: $(call def-help,copy-bins-to-VER, save ~/.local/bin/hledger* as hledger*-VER)
|
|
|
|
|
V=$*; for B in $(BINARIES); do cp ~/.local/bin/$$B ~/.local/bin/$$B-$$V; done
|
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
|
|
|
|
|
2020-08-20 21:42:17 +03:00
|
|
|
|
test: functest bench \
|
|
|
|
|
$(call def-help,test, run default tests: functional tests (including unit tests) and benchmarks )
|
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
|
2019-12-28 21:56:58 +03:00
|
|
|
|
# When doing build testing, save a little time and output noise by not
|
|
|
|
|
# running tests & benchmarks. Comment this out if you want to run them.
|
|
|
|
|
SKIPTESTSBENCHS=--no-run-tests --no-run-benchmarks
|
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 )
|
2020-06-07 01:18:01 +03:00
|
|
|
|
for F in stack*.yaml; do make --no-print-directory buildplantest-$$F; done
|
2018-10-24 19:47:48 +03:00
|
|
|
|
|
2020-03-31 01:35:53 +03:00
|
|
|
|
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-stack8.2.yaml )
|
2018-10-24 19:47:48 +03:00
|
|
|
|
$(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 )
|
2020-06-07 01:18:01 +03:00
|
|
|
|
for F in stack*.yaml; do make --no-print-directory buildtest-$$F; done
|
2009-03-15 08:15:59 +03:00
|
|
|
|
|
2020-03-31 01:35:53 +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-stack8.2.yaml )
|
2019-12-28 21:56:58 +03:00
|
|
|
|
$(STACK) build --test --bench $(SKIPTESTSBENCHS) --fast --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror --stack-yaml=$*
|
2018-05-18 06:42:14 +03:00
|
|
|
|
|
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. )
|
2020-06-07 01:18:01 +03:00
|
|
|
|
for F in stack*.yaml; do make --no-print-directory incr-buildtest-$$F; done
|
2018-06-04 03:04:02 +03:00
|
|
|
|
|
2020-03-31 01:35:53 +03:00
|
|
|
|
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-stack8.2.yaml. Wont detect warnings in up-to-date modules. )
|
2019-12-28 21:56:58 +03:00
|
|
|
|
$(STACK) build --test --bench $(SKIPTESTSBENCHS) --fast --ghc-options=-Werror --stack-yaml=$*
|
2018-06-04 03:04:02 +03:00
|
|
|
|
|
2020-06-07 01:23:07 +03:00
|
|
|
|
stack-clean-all: $(call def-help,stack-clean-all, do a stack clean --full with all ghc versions for paranoia/troubleshooting )
|
|
|
|
|
for F in stack*.yaml; do $(STACK) clean --full --stack-yaml=$$F; done
|
|
|
|
|
|
2020-06-07 21:51:24 +03:00
|
|
|
|
ghcversions: $(call def-help,ghcversions, show the ghc versions used by all stack files )
|
|
|
|
|
for F in stack*.yaml; do $(STACK) --stack-yaml=$$F --no-install-ghc exec -- ghc --version; done 2>&1 | grep -v 'To install the correct GHC'
|
|
|
|
|
|
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:
|
2020-03-31 01:35:53 +03:00
|
|
|
|
# @($(STACKTEST) --stack-yaml stack8.2.yaml hledger-lib:test:doctest && 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 )
|
2019-12-30 22:57:36 +03:00
|
|
|
|
@($(STACKTEST) hledger-lib:test:doctest && echo $@ PASSED) || (echo $@ FAILED; false)
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
2019-11-29 01:45:10 +03:00
|
|
|
|
unittest: $(call def-help,unittest, run the unit tests in hledger-lib )
|
|
|
|
|
@($(STACKTEST) hledger-lib:test:unittests && 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
|
|
|
|
|
2020-11-16 19:47:41 +03:00
|
|
|
|
#functest: addons hledger/test/addons/hledger-addon
|
|
|
|
|
functest: hledger/test/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) )
|
2020-09-08 01:27:46 +03:00
|
|
|
|
@$(STACK) build --fast hledger
|
2020-11-16 19:47:41 +03:00
|
|
|
|
@($(SHELLTESTSTK) -w `$(STACK) exec -- which hledger` hledger/test/ \
|
2017-03-29 08:10:46 +03:00
|
|
|
|
&& echo $@ PASSED) || (echo $@ FAILED; false)
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
2020-11-16 19:47:41 +03:00
|
|
|
|
functest-%: hledger/test/addons/hledger-addon \
|
2019-06-12 01:09:17 +03:00
|
|
|
|
$(call def-help,functest-PAT, build hledger quickly and run just the functional tests matching PAT )
|
|
|
|
|
@stack build --fast hledger
|
2020-11-16 19:47:41 +03:00
|
|
|
|
@($(SHELLTESTSTK) -w `stack exec -- which hledger` hledger/test/ -i "$*" \
|
2019-06-12 01:09:17 +03:00
|
|
|
|
&& echo $@ PASSED) || (echo $@ FAILED; false)
|
|
|
|
|
|
2016-04-21 17:52:20 +03:00
|
|
|
|
ADDONEXTS=pl py rb sh hs lhs rkt exe com bat
|
2020-11-16 19:47:41 +03:00
|
|
|
|
hledger/test/addons/hledger-addon: \
|
|
|
|
|
$(call def-help,hledger/test/addons/hledger-addon,\
|
2016-04-21 17:52:20 +03:00
|
|
|
|
generate dummy add-ons for testing (hledger-addon the rest)\
|
|
|
|
|
)
|
2020-11-16 19:47:41 +03:00
|
|
|
|
rm -rf hledger/test/addons/hledger-*
|
|
|
|
|
printf '#!/bin/sh\necho add-on: $$0\necho args: $$*\n' >hledger/test/addons/hledger-addon
|
2016-04-21 17:52:20 +03:00
|
|
|
|
for E in '' $(ADDONEXTS); do \
|
2020-11-16 19:47:41 +03:00
|
|
|
|
cp hledger/test/addons/hledger-addon hledger/test/addons/hledger-addon.$$E; done
|
2016-04-21 17:52:20 +03:00
|
|
|
|
for F in addon. addon2 addon2.hs addon3.exe addon3.lhs addon4.exe add reg; do \
|
2020-11-16 19:47:41 +03:00
|
|
|
|
cp hledger/test/addons/hledger-addon hledger/test/addons/hledger-$$F; done
|
|
|
|
|
mkdir hledger/test/addons/hledger-addondir
|
|
|
|
|
chmod +x hledger/test/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
|
|
|
|
|
2017-09-08 20:36:54 +03:00
|
|
|
|
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
|
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 \
|
2019-08-17 20:35:10 +03:00
|
|
|
|
examples/10x10x10.journal \
|
2018-05-18 05:39:19 +03:00
|
|
|
|
examples/100x100x10.journal \
|
|
|
|
|
examples/1000x1000x10.journal \
|
|
|
|
|
examples/1000x10000x10.journal \
|
2019-04-24 17:55:20 +03:00
|
|
|
|
examples/2000x1000x10.journal \
|
|
|
|
|
examples/3000x1000x10.journal \
|
|
|
|
|
examples/4000x1000x10.journal \
|
|
|
|
|
examples/5000x1000x10.journal \
|
|
|
|
|
examples/6000x1000x10.journal \
|
|
|
|
|
examples/7000x1000x10.journal \
|
|
|
|
|
examples/8000x1000x10.journal \
|
|
|
|
|
examples/9000x1000x10.journal \
|
2018-05-18 05:39:19 +03:00
|
|
|
|
examples/10000x1000x10.journal \
|
|
|
|
|
examples/10000x10000x10.journal \
|
|
|
|
|
examples/100000x1000x10.journal \
|
|
|
|
|
examples/1000000x1000x10.journal \
|
2019-04-24 17:55:20 +03:00
|
|
|
|
# examples/ascii.journal \
|
|
|
|
|
# examples/chinese.journal \
|
|
|
|
|
# examples/mixed.journal \
|
2018-05-18 05:39:19 +03:00
|
|
|
|
|
|
|
|
|
examples/sample.journal:
|
|
|
|
|
true # XXX should probably regenerate this
|
|
|
|
|
|
2019-08-17 20:35:10 +03:00
|
|
|
|
examples/10x10x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 10 10 10 >$@
|
|
|
|
|
|
2018-05-18 05:39:19 +03:00
|
|
|
|
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 >$@
|
|
|
|
|
|
2019-04-24 17:55:20 +03:00
|
|
|
|
examples/2000x1000x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 2000 1000 10 >$@
|
|
|
|
|
|
|
|
|
|
examples/3000x1000x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 3000 1000 10 >$@
|
|
|
|
|
|
|
|
|
|
examples/4000x1000x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 4000 1000 10 >$@
|
|
|
|
|
|
|
|
|
|
examples/5000x1000x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 5000 1000 10 >$@
|
|
|
|
|
|
|
|
|
|
examples/6000x1000x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 6000 1000 10 >$@
|
|
|
|
|
|
|
|
|
|
examples/7000x1000x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 7000 1000 10 >$@
|
|
|
|
|
|
|
|
|
|
examples/8000x1000x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 8000 1000 10 >$@
|
|
|
|
|
|
|
|
|
|
examples/9000x1000x10.journal: tools/generatejournal
|
|
|
|
|
tools/generatejournal 9000 1000 10 >$@
|
|
|
|
|
|
2018-05-18 05:39:19 +03:00
|
|
|
|
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 >$@
|
|
|
|
|
|
2020-08-29 23:57:04 +03:00
|
|
|
|
# hledger executables to bench test, can be overridden by env var,
|
|
|
|
|
# eg: BENCHEXES=ledger,hledger-1.18,hledger make bench
|
|
|
|
|
BENCHEXES ?= hledger
|
2016-10-21 05:05:07 +03:00
|
|
|
|
|
2020-08-20 21:42:17 +03:00
|
|
|
|
bench: quickbench
|
|
|
|
|
|
2020-09-10 03:44:14 +03:00
|
|
|
|
quickbench: samplejournals bench.sh $(call def-help,quickbench, benchmark commands in bench.sh with quickbench and $(BENCHEXES))
|
2020-08-20 21:42:17 +03:00
|
|
|
|
@echo; echo "run quick performance benchmarks in bench.sh (approximate, can be skewed):"
|
2020-12-14 20:57:13 +03:00
|
|
|
|
@which -s quickbench && quickbench -w $(BENCHEXES) || echo "quickbench not installed, skipping"
|
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 \
|
2019-08-01 19:30:46 +03:00
|
|
|
|
$(call def-help,quickprof-"CMD", run some command against a standard sample journal and display the execution profile )
|
2019-07-26 02:48:09 +03:00
|
|
|
|
$(STACK) exec --profile -- hledger +RTS $(PROFRTSFLAGS) -RTS $* -f examples/1000x1000x10.journal >/dev/null
|
|
|
|
|
profiterole hledger.prof
|
|
|
|
|
@echo
|
|
|
|
|
@head -20 hledger.prof
|
|
|
|
|
@echo ...
|
2015-07-22 18:52:30 +03:00
|
|
|
|
@echo
|
2019-07-26 02:48:09 +03:00
|
|
|
|
@head -20 hledger.profiterole.txt
|
2015-07-22 18:52:30 +03:00
|
|
|
|
@echo ...
|
|
|
|
|
@echo
|
2019-07-26 02:48:09 +03:00
|
|
|
|
@echo "See hledger.prof, hledger.profiterole.txt, hledger.profiterole.html for more."
|
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-06-17 23:52:04 +03:00
|
|
|
|
###############################################################################
|
2019-02-04 02:56:57 +03:00
|
|
|
|
$(call def-help-subheading,DOCUMENTATION: (see also Shake.hs))
|
2015-07-12 06:29:14 +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 )
|
2020-12-10 01:08:46 +03:00
|
|
|
|
$(STACK) haddock --no-haddock-deps --fast --no-keep-going
|
|
|
|
|
# $(STACK) -v
|
2014-07-08 22:52:06 +04:00
|
|
|
|
|
2020-12-10 01:08:46 +03:00
|
|
|
|
haddock-watch: \
|
|
|
|
|
$(call def-help,haddock-watch, regenerate haddock docs )
|
|
|
|
|
$(STACK) haddock --no-haddock-deps --fast --file-watch
|
|
|
|
|
|
|
|
|
|
haddock-open: \
|
|
|
|
|
$(call def-help,haddock-open,\
|
|
|
|
|
browse the haddock generated for hledger-lib\
|
|
|
|
|
)
|
|
|
|
|
$(VIEWHTML) hledger/dist/doc/html/hledger-lib/index.html
|
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
|
|
|
|
|
|
|
|
|
|
# #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
|
|
|
|
|
2020-02-03 21:38:39 +03:00
|
|
|
|
# flaky
|
2019-09-16 01:39:05 +03:00
|
|
|
|
site-watch: Shake
|
|
|
|
|
$(call def-help,site-watch, open a browser on the website (in ./site) and rerender/reload when manuals or site content changes )
|
2020-01-26 03:54:45 +03:00
|
|
|
|
(ls $(DOCSOURCEFILES) | entr ./Shake -VV manuals) &
|
2019-09-09 23:30:02 +03:00
|
|
|
|
make -C site html-watch
|
2019-03-06 05:41:51 +03:00
|
|
|
|
|
2020-02-03 21:38:39 +03:00
|
|
|
|
manuals-watch: Shake
|
|
|
|
|
$(call def-help,manuals-watch, rerender manuals when their source files change )
|
|
|
|
|
ls $(DOCSOURCEFILES) | entr ./Shake -VV manuals
|
|
|
|
|
|
2019-03-06 05:41:51 +03:00
|
|
|
|
# This rule, for updating the live hledger.org site, gets called by:
|
|
|
|
|
# 1. github-post-receive (github webhook handler), when something is pushed
|
|
|
|
|
# to the main or wiki repos on Github. Config:
|
|
|
|
|
# /etc/supervisord.conf -> [program:github-post-receive]
|
|
|
|
|
# /etc/github-post-receive.conf
|
|
|
|
|
# 2. cron, nightly. Config: /etc/crontab
|
|
|
|
|
# 3. manually (make site).
|
2019-09-16 01:39:05 +03:00
|
|
|
|
# This uses the existing Shake executable without rebuilding it,
|
2019-03-06 18:59:51 +03:00
|
|
|
|
# as we don't want to immediately execute new code from any collaborator.
|
2019-03-06 05:41:51 +03:00
|
|
|
|
.PHONY: site
|
|
|
|
|
site: \
|
|
|
|
|
$(call def-help,site, update the hledger.org website (run on prod) )
|
2019-03-06 20:50:42 +03:00
|
|
|
|
@[ ! -x Shake ] \
|
2019-03-06 18:59:51 +03:00
|
|
|
|
&& echo 'Please run "make Shake" first (manual compilation of Shake.hs is required)' \
|
2019-03-06 20:24:44 +03:00
|
|
|
|
|| ( \
|
|
|
|
|
echo; \
|
2020-01-22 16:47:35 +03:00
|
|
|
|
./Shake -V webmanuals; \
|
2019-08-25 17:57:09 +03:00
|
|
|
|
make -C site html; \
|
2019-03-06 20:24:44 +03:00
|
|
|
|
) 2>&1 | tee -a site.log
|
2018-11-25 04:43:26 +03:00
|
|
|
|
|
2015-07-12 06:29:14 +03:00
|
|
|
|
###############################################################################
|
2017-08-16 16:00:59 +03:00
|
|
|
|
$(call def-help-subheading,RELEASING:)
|
2015-07-12 06:29:14 +03:00
|
|
|
|
|
2019-02-04 03:50:54 +03:00
|
|
|
|
# old/desired release process:
|
|
|
|
|
# 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 and test a release and tag the repo )
|
|
|
|
|
#publish: hackageupload pushtags $(call def-help,upload, publish latest hackage packages and push tags to github )
|
|
|
|
|
#releaseandpublish: release upload $(call def-help,releaseandpublish, release and upload and publish updated docs )
|
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
|
|
|
|
|
2020-06-07 21:50:57 +03:00
|
|
|
|
# update all cabal files based on latest package.yaml files using stack's built-in hpack
|
|
|
|
|
cabal: $(call def-help,cabal, regenerate cabal files from package.yaml files with stack )
|
2018-12-04 02:52:03 +03:00
|
|
|
|
$(STACK) build --dry-run --silent
|
2017-08-01 02:12:59 +03:00
|
|
|
|
|
2020-06-07 21:50:57 +03:00
|
|
|
|
# Update all cabal files based on latest package.yaml files using a specific hpack version.
|
|
|
|
|
# To avoid warnings, this should be the same version as stack's built-in hpack.
|
|
|
|
|
cabal-with-hpack-%:
|
2019-03-06 22:13:04 +03:00
|
|
|
|
$(STACK) build --with-hpack hpack-$* --dry-run --silent
|
2018-04-20 06:49:08 +03:00
|
|
|
|
|
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
|
|
|
|
|
2020-06-07 21:50:57 +03:00
|
|
|
|
# we use shake for this job; so dependencies aren't checked here
|
|
|
|
|
manuals: Shake $(call def-help,manuals, regenerate and commit CLI help and manuals (might need -B) )
|
2017-08-01 02:12:59 +03:00
|
|
|
|
./Shake manuals
|
2020-01-23 01:43:47 +03:00
|
|
|
|
git commit -m ";doc: regen manuals" -m "[ci skip]" hledger*/hledger*.{1,5,info,txt} hledger/Hledger/Cli/Commands/*.txt
|
2010-09-10 02:54:34 +04:00
|
|
|
|
|
2020-12-07 16:45:55 +03:00
|
|
|
|
tag: $(call def-help,tag, make git release tags and for the project and all packages )
|
2020-06-21 18:10:38 +03:00
|
|
|
|
for p in $(PACKAGES); do make -s tag-$$p; done
|
2020-12-07 16:45:55 +03:00
|
|
|
|
make -s tag-project
|
2020-06-21 18:10:38 +03:00
|
|
|
|
|
|
|
|
|
tag-%: $(call def-help,tag-PKG, make a git release tag for PKG )
|
|
|
|
|
git tag -fs $*-`cat $*/.version` -m "Release $*-`cat $*/.version`"
|
|
|
|
|
|
2020-12-07 16:45:55 +03:00
|
|
|
|
tag-project: $(call def-help,tag-project, make a git release tag for the project as a whole )
|
|
|
|
|
git tag -fs `cat .version` -m "Release `cat .version`, https://hledger.org/release-notes.html#hledger-`cat .version | sed -e 's/\./-/g'`"
|
|
|
|
|
|
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
|
|
|
|
# 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
|
|
|
|
|
2020-06-22 18:00:48 +03:00
|
|
|
|
nix-hledger-version: $(call def-help,nix-hledger-version, show which version of hledger has reached nixpkgs)
|
|
|
|
|
@curl -s https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/development/haskell-modules/hackage-packages.nix | grep -A1 'pname = "hledger"'
|
|
|
|
|
|
|
|
|
|
nix-hledger-versions: $(call def-help,nix-hledger-versions, show versions of all hledger packages in nixpkgs)
|
|
|
|
|
@curl -s https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/development/haskell-modules/hackage-packages.nix | grep -A1 'pname = "hledger'
|
|
|
|
|
|
2020-09-10 21:56:55 +03:00
|
|
|
|
make nix-view-commits: $(call def-help,nix-view-commits, show recent haskell commits in nixpkgs)
|
|
|
|
|
@open 'https://github.com/search?l=&o=desc&q=%22automatic+Haskell+package+set+update%22+repo%3ANixOS%2Fnixpkgs+filename%3Ahaskell-packages.nix&s=committer-date&type=Commits'
|
|
|
|
|
|
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 haskell files with hasktags and just list the other main source files
|
|
|
|
|
# so they will be traversed by tags-search/tags-query-replace.
|
2020-06-21 18:10:38 +03:00
|
|
|
|
# etags:
|
2019-01-25 23:45:21 +03:00
|
|
|
|
# rm -f TAGS
|
|
|
|
|
# hasktags -e $(SOURCEFILES)
|
|
|
|
|
# for f in Makefile $(WEBCODEFILES) $(HPACKFILES) $(CABALFILES) $(DOCSOURCEFILES); do \
|
|
|
|
|
# printf "\n$$f,1\n" >> TAGS; \
|
|
|
|
|
# done
|
2008-10-03 11:40:28 +04:00
|
|
|
|
|
2019-01-25 23:45:21 +03:00
|
|
|
|
# Tag:
|
|
|
|
|
# - haskell files, with hasktags
|
|
|
|
|
# - everything else not excluded by .ctags, with (exuberant) ctags
|
|
|
|
|
# - files currently missed by the above, just their names (docs, hpack, cabal..)
|
2020-06-21 18:10:38 +03:00
|
|
|
|
etags:$(call def-help,etags, generate emacs tag files for source code navigation )
|
2017-06-22 17:28:00 +03:00
|
|
|
|
hasktags -e $(SOURCEFILES)
|
|
|
|
|
ctags -a -e -R
|
2019-01-25 23:45:21 +03:00
|
|
|
|
for f in \
|
2020-05-30 05:04:27 +03:00
|
|
|
|
$(WEBTEMPLATEFILES) \
|
2019-01-25 23:45:21 +03:00
|
|
|
|
$(DOCSOURCEFILES) \
|
|
|
|
|
$(HPACKFILES) \
|
|
|
|
|
$(CABALFILES) \
|
2019-01-27 03:22:47 +03:00
|
|
|
|
Shake.hs \
|
2019-01-25 23:45:21 +03:00
|
|
|
|
; do printf "\n$$f,1\n" >> TAGS; done
|
2017-06-22 17:28:00 +03:00
|
|
|
|
|
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: \
|
2020-04-20 23:12:41 +03:00
|
|
|
|
$(call def-help-hide,stackclean, remove .stack-work/ dirs )
|
|
|
|
|
$(STACK) purge
|
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)'`
|
2020-04-20 23:12:41 +03:00
|
|
|
|
#rm -f `fd -I '\.(hi|o|dyn_hi|dyn_o)$'`
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
|
|
|
|
clean: cleanghco \
|
|
|
|
|
$(call def-help,clean, default cleanup (ghc build leftovers) )
|
|
|
|
|
|
2019-09-11 03:25:53 +03:00
|
|
|
|
Clean: stackclean cleanghco cleantags \
|
|
|
|
|
$(call def-help,Clean, thorough cleanup (stack/ghc leftovers/tags) )
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
|
|
|
|
# reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))
|
|
|
|
|
|
2015-06-17 23:52:04 +03:00
|
|
|
|
###############################################################################
|
2019-03-06 05:41:51 +03:00
|
|
|
|
# END
|
2014-10-18 20:30:53 +04:00
|
|
|
|
|
2019-03-06 05:41:51 +03:00
|
|
|
|
# optional local customisations, not in version control
|
|
|
|
|
-include Makefile.local
|
2015-07-12 22:03:43 +03:00
|
|
|
|
|
2019-03-06 05:41:51 +03:00
|
|
|
|
# show a final message in make help
|
2019-02-04 04:01:57 +03:00
|
|
|
|
$(call def-help-heading,)
|
2020-09-05 03:08:32 +03:00
|
|
|
|
$(call def-help-heading,See also ./Shake.hs help)
|