Skip to content

Commit

Permalink
[ Makefile ] new goal: fast-install-bin, includes tests
Browse files Browse the repository at this point in the history
Re #4738: make sure code in test/Internal compiles as well.
  • Loading branch information
andreasabel committed Jun 6, 2020
1 parent 495f1ec commit 3d2dab5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Makefile
Expand Up @@ -43,12 +43,26 @@ STACK_INSTALL_HELPER = $(STACK_CMD) install Agda --no-haddock --system-ghc
# installation for avoiding recompilation (see Issue #2083 and
# https://github.com/haskell/cabal/issues/1893).

# quicker install: -O0, no tests

QUICK_BUILD_DIR = $(BUILD_DIR)-quick
QUICK_STACK_BUILD_DIR = .stack-work-quick

QUICK_CABAL_INSTALL = $(CABAL_INSTALL_HELPER) --builddir=$(QUICK_BUILD_DIR)
QUICK_STACK_INSTALL = $(STACK_INSTALL_HELPER) --work-dir=$(QUICK_STACK_BUILD_DIR)

# fast install: -O0, but tests

FAST_BUILD_DIR = $(BUILD_DIR)-fast
FAST_STACK_BUILD_DIR = .stack-work-fast

FAST_CABAL_INSTALL = $(CABAL_INSTALL_HELPER) --builddir=$(FAST_BUILD_DIR) \
--enable-tests --ghc-options=-O0 --program-suffix=-fast
FAST_STACK_INSTALL = $(STACK_INSTALL_HELPER) --work-dir=$(FAST_STACK_BUILD_DIR) \
--test --no-run-tests --fast

# ordinary install: optimizations and tests

SLOW_CABAL_INSTALL_OPTS = --builddir=$(BUILD_DIR) --enable-tests
SLOW_STACK_INSTALL_OPTS = --test --no-run-tests

Expand Down Expand Up @@ -103,6 +117,20 @@ else
time $(CABAL_INSTALL) $(CABAL_INSTALL_BIN_OPTS)
endif

.PHONY: fast-install-bin ## Install Agda -O0 and test suites via cabal (or stack if stack.yaml exists).
fast-install-bin:
ifneq ("$(wildcard stack.yaml)","") # if `stack.yaml` exists
@echo "============= Installing using Stack with -O0 and test suites ============"
time $(FAST_STACK_INSTALL) $(STACK_INSTALL_BIN_OPTS)
mkdir -p $(BUILD_DIR)/build/
cp -r $(shell stack path --dist-dir)/build $(BUILD_DIR)
else
# `cabal new-install --enable-tests` emits the error message (bug?):
# cabal: --enable-tests was specified, but tests can't be enabled in a remote package
@echo "============= Installing using Cabal with -O0 and test suites ============"
time $(FAST_CABAL_INSTALL) $(CABAL_INSTALL_BIN_OPTS)
endif

# Andreas, 2020-06-02, AIM XXXII, quick-install-bin seems obsolete since we have quicker-install-bin
# .PHONY: quick-install-bin ## Install Agda via cabal (or stack if stack.yaml exists).
# quick-install-bin: ensure-hash-is-correct
Expand Down

2 comments on commit 3d2dab5

@L-TChen
Copy link
Member

@L-TChen L-TChen commented on 3d2dab5 Jun 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is fast-install-bin (essentially) equivalent to quicker-install-bin?

@andreasabel
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, except that quicker-install-bin also:

  • skips compilation of test/Internal
  • skips building the Agda.{Primitive|Builtin}.* library

In effect, quicker is quicker than fast.

Please sign in to comment.