Fix a #define
[ghc.git] / bindisttest / ghc.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 # http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 ifeq "$(TEST_PREP)" "YES"
14 BIN_DIST_TEST_TAR_BZ2 = $(BIN_DIST_PREP_TAR_BZ2)
15 else
16 BIN_DIST_TEST_TAR_BZ2 = $(BIN_DIST_TAR_BZ2)
17 endif
18
19 .PHONY: test_bindist
20 test_bindist:
21 "$(RM)" $(RM_OPTS_REC) bindisttest/$(BIN_DIST_INST_SUBDIR)
22 "$(RM)" $(RM_OPTS_REC) bindisttest/a
23 "$(RM)" $(RM_OPTS) bindisttest/HelloWorld
24 "$(RM)" $(RM_OPTS) bindisttest/HelloWorld.o
25 "$(RM)" $(RM_OPTS) bindisttest/HelloWorld.hi
26 "$(RM)" $(RM_OPTS) bindisttest/output
27 # We use the a/b/c subdirectory as configure looks for install-sh in
28 # . .. ../.. and we don't want it to find the build system's install-sh.
29 #
30 # NB. tar has funny interpretation of filenames sometimes (thinking
31 # c:/foo is a remote file), so it's safer to bzip and then pipe into
32 # tar rather than using tar -xjf:
33 mkdir bindisttest/a
34 mkdir bindisttest/a/b
35 mkdir bindisttest/a/b/c
36 cd bindisttest/a/b/c/ && $(BZIP2_CMD) -cd ../../../../$(BIN_DIST_TEST_TAR_BZ2) | $(TAR_CMD) -xf -
37 $(SHELL) bindisttest/checkBinaries.sh $(ProjectVersion)
38 ifeq "$(Windows)" "YES"
39 mv bindisttest/a/b/c/$(BIN_DIST_NAME) $(BIN_DIST_INST_DIR)
40 else
41 cd bindisttest/a/b/c/$(BIN_DIST_NAME) && ./configure --prefix=$(TOP)/$(BIN_DIST_INST_DIR) --with-gcc="$(WhatGccIsCalled)"
42 cd bindisttest/a/b/c/$(BIN_DIST_NAME) && $(MAKE) install
43 endif
44 ifeq "$(GhcProfiled)" "NO"
45 $(BIN_DIST_INST_DIR)/bin/runghc bindisttest/HelloWorld > bindisttest/output
46 $(CONTEXT_DIFF) bindisttest/output bindisttest/expected_output
47 endif
48 $(BIN_DIST_INST_DIR)/bin/ghc --make bindisttest/HelloWorld
49 bindisttest/HelloWorld > bindisttest/output
50 $(CONTEXT_DIFF) bindisttest/output bindisttest/expected_output
51 # Without --no-user-package-conf we might pick up random packages from ~/.ghc
52 $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-conf
53
54 $(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))
55