e7f9aa49a7b476a9110d4db22c5e617ac726576e
[ghc.git] / bindisttest / Makefile
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 .PHONY: default_target
14
15 default_target: all
16
17 # Ideally we'd just include something to give us variables
18 # for paths and arguments to tools etc, and those set in mk/build.mk.
19 TOP=..
20 include $(TOP)/mk/config.mk
21
22 ifeq "$(TEST_PREP)" "YES"
23 BIN_DIST_TEST_TAR_BZ2 = ../$(BIN_DIST_PREP_TAR_BZ2)
24 else
25 BIN_DIST_TEST_TAR_BZ2 = ../$(BIN_DIST_TAR_BZ2)
26 endif
27
28 all:
29 $(RM) -rf $(BIN_DIST_INST_SUBDIR)
30 $(RM) -rf a/b/c/*
31 $(RM) HelloWorld HelloWorld.o HelloWorld.hi output
32 # We use the a/b/c subdirectory as configure looks for install-sh in
33 # . .. ../.. and we don't want it to find the build system's install-sh.
34 #
35 # NB. tar has funny interpretation of filenames sometimes (thinking
36 # c:/foo is a remote file), so it's safer to bzip and then pipe into
37 # tar rather than using tar -xjf:
38 cd a/b/c/ && bzip2 -cd ../../../$(BIN_DIST_TEST_TAR_BZ2) | $(TAR) -xf -
39 ifeq "$(Windows)" "YES"
40 mv a/b/c/$(BIN_DIST_NAME) $(BIN_DIST_INST_DIR)
41 else
42 cd a/b/c/$(BIN_DIST_NAME) && ./configure --prefix=$(BIN_DIST_INST_DIR)
43 cd a/b/c/$(BIN_DIST_NAME) && $(MAKE) install
44 endif
45 $(BIN_DIST_INST_DIR)/bin/runghc HelloWorld > output
46 $(CONTEXT_DIFF) output expected_output
47 $(BIN_DIST_INST_DIR)/bin/ghc --make HelloWorld
48 ./HelloWorld > output
49 $(CONTEXT_DIFF) output expected_output
50 # Without --no-user-package-conf we might pick up random packages from ~/.ghc
51 $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-conf
52
53 clean distclean:
54 $(RM) -rf $(BIN_DIST_INST_SUBDIR)
55 $(RM) -rf a/b/c/*
56 $(RM) HelloWorld HelloWorld.o HelloWorld.hi output
57
58 # Ignore a load of other standard targets
59 install install-docs doc:
60 @:
61