ghc.mk 2.33 KB
Newer Older
Ian Lynagh's avatar
Ian Lynagh committed
1 2 3 4 5 6 7
# -----------------------------------------------------------------------------
#
# (c) 2009 The University of Glasgow
#
# This file is part of the GHC build system.
#
# To understand how the build system works and how to modify it, see
8 9
#      http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
#      http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
Ian Lynagh's avatar
Ian Lynagh committed
10 11 12 13
#
# -----------------------------------------------------------------------------

ifeq "$(TEST_PREP)" "YES"
14
BIN_DIST_TEST_TAR_COMP = $(BIN_DIST_PREP_TAR_COMP)
Ian Lynagh's avatar
Ian Lynagh committed
15
else
16
BIN_DIST_TEST_TAR_COMP = $(BIN_DIST_TAR_COMP)
Ian Lynagh's avatar
Ian Lynagh committed
17 18 19 20 21
endif

.PHONY: test_bindist
test_bindist:
	"$(RM)" $(RM_OPTS_REC) bindisttest/$(BIN_DIST_INST_SUBDIR)
Ian Lynagh's avatar
Ian Lynagh committed
22
	"$(RM)" $(RM_OPTS_REC) bindisttest/a
Ian Lynagh's avatar
Ian Lynagh committed
23 24 25 26 27 28 29 30 31 32
	"$(RM)" $(RM_OPTS) bindisttest/HelloWorld
	"$(RM)" $(RM_OPTS) bindisttest/HelloWorld.o
	"$(RM)" $(RM_OPTS) bindisttest/HelloWorld.hi
	"$(RM)" $(RM_OPTS) bindisttest/output
# We use the a/b/c subdirectory as configure looks for install-sh in
# . .. ../.. and we don't want it to find the build system's install-sh.
#
# NB. tar has funny interpretation of filenames sometimes (thinking
# c:/foo is a remote file), so it's safer to bzip and then pipe into
# tar rather than using tar -xjf:
Ian Lynagh's avatar
Ian Lynagh committed
33 34 35
	mkdir bindisttest/a
	mkdir bindisttest/a/b
	mkdir bindisttest/a/b/c
36
	cd bindisttest/a/b/c/ && $(TAR_COMP_CMD) -cd ../../../../$(BIN_DIST_TEST_TAR_COMP) | $(TAR_CMD) -xf -
37
	$(SHELL) bindisttest/checkBinaries.sh $(ProjectVersion)
38
ifeq "$(Windows_Host)" "YES"
Ian Lynagh's avatar
Ian Lynagh committed
39 40
	mv bindisttest/a/b/c/$(BIN_DIST_NAME) $(BIN_DIST_INST_DIR)
else
41
	cd bindisttest/a/b/c/$(BIN_DIST_NAME) && ./configure --prefix=$(TOP)/$(BIN_DIST_INST_DIR) --with-gcc="$(WhatGccIsCalled)"
Ian Lynagh's avatar
Ian Lynagh committed
42 43
	cd bindisttest/a/b/c/$(BIN_DIST_NAME) && $(MAKE) install
endif
44
ifeq "$(GhcProfiled)" "NO"
Ian Lynagh's avatar
Ian Lynagh committed
45 46
	$(BIN_DIST_INST_DIR)/bin/runghc bindisttest/HelloWorld > bindisttest/output
	$(CONTEXT_DIFF) bindisttest/output bindisttest/expected_output
47
endif
Ian Lynagh's avatar
Ian Lynagh committed
48 49 50
	$(BIN_DIST_INST_DIR)/bin/ghc --make bindisttest/HelloWorld
	bindisttest/HelloWorld > bindisttest/output
	$(CONTEXT_DIFF) bindisttest/output bindisttest/expected_output
51 52
# Without --no-user-package-db we might pick up random packages from ~/.ghc
	$(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-db
Ian Lynagh's avatar
Ian Lynagh committed
53 54 55

$(eval $(call clean-target,bindisttest,all,$(BIN_DIST_INST_DIR) $(wildcard bindisttest/a/b/c/*) bindisttest/HelloWorld bindisttest/HelloWorld.o bindisttest/HelloWorld.hi bindisttest/output))