From: PHO Date: Fri, 7 Aug 2015 07:38:15 +0000 (+0900) Subject: New configuration variable: USE_CABAL_COMMAND X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=HEAD;p=cabal-shared-makefile.git New configuration variable: USE_CABAL_COMMAND --- diff --git a/cabal-package.mk b/cabal-package.mk index 6c96697..65404dc 100644 --- a/cabal-package.mk +++ b/cabal-package.mk @@ -2,6 +2,10 @@ # # Variables: # +# USE_CABAL_COMMAND :: whether to use the cabal(1) command instead +# of ./Setup +# default: "YES" if it's in the PATH, "NO" otherwise. +# # CONFIGURE_ARGS :: arguments to be passed to ./Setup configure # default: --disable-optimization # @@ -9,6 +13,7 @@ # AUTOCONF ?= autoconf +CABAL ?= cabal DARCS ?= darcs DITZ ?= ditz FIND ?= find @@ -21,6 +26,20 @@ RM_RF ?= rm -rf RSYNC ?= rsync SUDO ?= sudo +ifndef USE_CABAL_COMMAND +ifeq ($(shell which $(CABAL) >/dev/null 2>&1; echo $$?),0) +USE_CABAL_COMMAND := YES +else +USE_CABAL_COMMAND := NO +endif +endif + +ifeq ($(strip $(USE_CABAL_COMMAND)),YES) +SETUP_CMD := $(shell which $(CABAL)) +else +SETUP_CMD := ./Setup +endif + CONFIGURE_ARGS ?= --disable-optimization HADDOCK_OPTS ?= --hyperlink-source HLINT_OPTS ?= \ @@ -52,7 +71,7 @@ BUILDINFO_FILE := $(BUILDINFO_IN_FILE:.in=) all: build build: setup-config build-hook - ./Setup build + $(SETUP_CMD) build $(RM_RF) *.tix build-hook: @@ -71,14 +90,14 @@ setup-config: dist/setup-config setup-config-hook $(BUILDINFO_FILE) setup-config-hook: -dist/setup-config: $(CABAL_FILE) Setup $(AUTOCONF_FILE) - ./Setup configure $(CONFIGURE_ARGS) +dist/setup-config: $(CABAL_FILE) $(SETUP_CMD) $(AUTOCONF_FILE) + $(SETUP_CMD) configure $(CONFIGURE_ARGS) $(AUTOCONF_FILE): $(AUTOCONF_AC_FILE) $(AUTOCONF) $(BUILDINFO_FILE): $(BUILDINFO_IN_FILE) configure - ./Setup configure $(CONFIGURE_ARGS) + $(SETUP_CMD) configure $(CONFIGURE_ARGS) Setup: $(SETUP_FILE) $(GHC) --make Setup @@ -94,17 +113,17 @@ clean: clean-hook clean-hook: doc: setup-config - ./Setup haddock $(HADDOCK_OPTS) + $(SETUP_CMD) haddock $(HADDOCK_OPTS) install: build - $(SUDO) ./Setup install + $(SUDO) $(SETUP_CMD) install sdist: setup-config - ./Setup sdist + $(SETUP_CMD) sdist test: build $(RM_RF) dist/test - ./Setup test + $(SETUP_CMD) test if ls *.tix >/dev/null 2>&1; then \ $(HPC) sum --output="merged.tix" --union --exclude=Main *.tix; \ $(HPC) markup --destdir="dist/hpc" --fun-entry-count "merged.tix"; \