diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-12-28 14:10:08 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-12-28 14:18:47 -0400 |
commit | da4c2f9627668535aa11f9293560dbfe0f324b2d (patch) | |
tree | 46931229fcd7d5096973565c28f5c1bc33b964ca /Makefile | |
parent | 2c836973e4474ff90f0ec5254057f328130730c6 (diff) |
support building with BUILDER=stack to use stack instead of cabal
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -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. |