From da4c2f9627668535aa11f9293560dbfe0f324b2d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 28 Dec 2015 14:10:08 -0400 Subject: support building with BUILDER=stack to use stack instead of cabal --- Makefile | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 63344bd50..386029829 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ mans=$(shell find doc -maxdepth 1 -name git-annex*.mdwn | sed -e 's/^doc/man/' -e 's/\.mdwn/\.1/') all=git-annex mans docs -CABAL?=cabal # set to "./Setup" if you lack a cabal program +# set to "./Setup" if you lack a cabal program. Or can be set to "stack" +BUILDER?=cabal GHC?=ghc PREFIX?=/usr @@ -15,13 +16,21 @@ endif build: $(all) Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs - if [ "$(CABAL)" = ./Setup ]; then ghc --make Setup; fi - $(CABAL) configure --ghc-options="$(shell Build/collect-ghc-options.sh)" + if [ "$(BUILDER)" = ./Setup ]; then ghc --make Setup; fi + if [ "$(BUILDER)" = stack ]; then \ + $(BUILDER) build -j1; \ + else \ + $(BUILDER) configure --ghc-options="$(shell Build/collect-ghc-options.sh)"; \ + fi # -j1 is used for reproducible build git-annex: Build/SysConfig.hs - $(CABAL) build -j1 - ln -sf dist/build/git-annex/git-annex git-annex + $(BUILDER) build -j1 + if [ "$(BUILDER)" = stack ]; then \ + ln -sf $(shell find .stack-work/ -name git-annex -type f | grep build/git-annex/git-annex) git-annex; \ + else \ + ln -sf dist/build/git-annex/git-annex git-annex; \ + fi man/%.1: doc/%.mdwn ./Build/mdwn2man $@ 1 $< > $@ @@ -89,6 +98,7 @@ docs: mans --exclude='users/*' --exclude='devblog/*' --exclude='thanks' clean: + $(BUILDER) clean rm -rf tmp dist git-annex $(mans) configure *.tix .hpc \ doc/.ikiwiki html dist tags Build/SysConfig.hs \ Setup Build/InstallDesktopFile Build/EvilSplicer \ @@ -206,9 +216,9 @@ ANDROID_FLAGS?= # Uses https://github.com/neurocyte/ghc-android android: Build/EvilSplicer echo "Running native build, to get TH splices.." - if [ ! -e dist/setup/setup ]; then $(CABAL) configure -O0 $(ANDROID_FLAGS) -fAndroidSplice; fi + if [ ! -e dist/setup/setup ]; then $(BUILDER) configure -O0 $(ANDROID_FLAGS) -fAndroidSplice; fi mkdir -p tmp - if ! $(CABAL) build --ghc-options=-ddump-splices 2> tmp/dump-splices; then tail tmp/dump-splices >&2; exit 1; fi + if ! $(BUILDER) build --ghc-options=-ddump-splices 2> tmp/dump-splices; then tail tmp/dump-splices >&2; exit 1; fi echo "Setting up Android build tree.." ./Build/EvilSplicer tmp/splices tmp/dump-splices standalone/no-th/evilsplicer-headers.hs rsync -az --exclude tmp --exclude dist . tmp/androidtree @@ -250,8 +260,8 @@ fast: dist/caballog @$(MAKE) tags >/dev/null 2>&1 & dist/caballog: git-annex.cabal - $(CABAL) configure -f"-Production" -O0 --enable-executable-dynamic - $(CABAL) build -v2 | tee $@ + $(BUILDER) configure -f"-Production" -O0 --enable-executable-dynamic + $(BUILDER) build -v2 | tee $@ # Hardcoded command line to make hdevtools start up and work. # You will need some memory. It's worth it. -- cgit v1.2.3