summaryrefslogtreecommitdiff
path: root/testsuite/timeout/Makefile
blob: be7023a8b1b6ba64ddd53b16757f9bdd07827ebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
TOP = ..

# If we're cleaning then we don't want to do all the GHC detection hardwork,
# and we certainly don't want to fail if GHC etc can't be found!
# However, we can't just put this conditional in boilerplate.mk, as
# some of the tests have a "clean" makefile target that relies on GHC_PKG
# being defined.
ifneq "$(MAKECMDGOALS)" "clean"
ifneq "$(MAKECMDGOALS)" "distclean"

include $(TOP)/mk/boilerplate.mk

TIMEOUT_PROGRAM = install-inplace/bin/timeout$(exeext)

PREFIX := $(abspath install-inplace)
$(eval $(call canonicalise,PREFIX))

ifneq "$(GCC)" ""
WITH_GCC = --with-gcc=$(GCC)
endif

ifeq "$(filter thr, $(GhcRTSWays))" ""
$(TIMEOUT_PROGRAM): timeout.py
	rm -rf install-inplace
	mkdir install-inplace
	mkdir install-inplace/bin
	cp $< $@
	chmod +x $@
else
$(TIMEOUT_PROGRAM): timeout.hs
	rm -rf install-inplace
	$(TEST_HC) --make Setup
	./Setup configure --with-compiler=$(TEST_HC) \
	                  --with-hc-pkg=$(GHC_PKG) \
	                  $(WITH_GCC) \
	                  --ghc-option=-threaded --prefix=$(PREFIX)
	./Setup build
	./Setup install
endif

boot all :: calibrate.out $(TIMEOUT_PROGRAM)

calibrate.out:
	$(RM) -f TimeMe.o TimeMe.hi TimeMe TimeMe.exe
	$(PYTHON) calibrate "$(GHC_STAGE1)" > $@
# We use stage 1 to do the calibration, as stage 2 may not exist.
# This isn't necessarily the compiler we'll be running the testsuite
# with, but it's really the performance of the machine that we're
# interested in

endif
endif

clean distclean:
	-./Setup clean
	$(RM) -rf install-inplace
	$(RM) -f calibrate.out
	$(RM) -f Setup Setup.exe Setup.hi Setup.o