GHC_STAGE1 isn't defined, use other form.
[ghc.git] / testsuite / timeout / Makefile
1 TOP = ..
2
3 # If we're cleaning then we don't want to do all the GHC detection hardwork,
4 # and we certainly don't want to fail if GHC etc can't be found!
5 # However, we can't just put this conditional in boilerplate.mk, as
6 # some of the tests have a "clean" makefile target that relies on GHC_PKG
7 # being defined.
8 ifneq "$(MAKECMDGOALS)" "clean"
9 ifneq "$(MAKECMDGOALS)" "distclean"
10 ifneq "$(MAKECMDGOALS)" "maintainer-clean"
11
12 include $(TOP)/mk/boilerplate.mk
13
14 TIMEOUT_PROGRAM = install-inplace/bin/timeout$(exeext)
15
16 PREFIX := $(abspath install-inplace)
17 $(eval $(call canonicalise,PREFIX))
18
19 ifneq "$(GCC)" ""
20 WITH_GCC = --with-gcc='$(GCC)'
21 endif
22
23 ifeq "$(WINDOWS)" "NO"
24 # Use a python timeout program, so that we don't have to worry about
25 # whether or not the compiler we're testing has built the timeout
26 # program correctly
27 $(TIMEOUT_PROGRAM): timeout.py
28 rm -rf install-inplace
29 mkdir install-inplace
30 mkdir install-inplace/bin
31 cp $< $@.py
32 echo '#!/bin/sh' > $@
33 echo 'exec "${PYTHON}" $$0.py "$$@"' >> $@
34 chmod +x $@
35 else
36 # The python timeout program doesn't work on mingw, so we still use the
37 # Haskell program on Windows
38 $(TIMEOUT_PROGRAM): timeout.hs
39 rm -rf install-inplace
40 '$(TEST_HC)' --make Setup
41 ./Setup configure --with-compiler='$(TEST_HC)' \
42 --with-hc-pkg='$(GHC_PKG)' \
43 --with-hsc2hs='$(HSC2HS)' \
44 $(WITH_GCC) \
45 --ghc-option=-threaded --prefix='$(PREFIX)'
46 ./Setup build
47 ./Setup install
48 endif
49
50 boot all :: calibrate.out $(TIMEOUT_PROGRAM)
51
52 calibrate.out:
53 $(RM) -f TimeMe.o TimeMe.hi TimeMe TimeMe.exe
54 $(PYTHON) calibrate '$(STAGE1_GHC)' > $@
55 # We use stage 1 to do the calibration, as stage 2 may not exist.
56 # This isn't necessarily the compiler we'll be running the testsuite
57 # with, but it's really the performance of the machine that we're
58 # interested in
59
60 endif
61 endif
62 endif
63
64 clean distclean maintainer-clean:
65 test ! -f Setup || ./Setup clean
66 $(RM) -rf install-inplace
67 $(RM) -f calibrate.out
68 $(RM) -f Setup Setup.exe Setup.hi Setup.o
69