summaryrefslogtreecommitdiff
path: root/testsuite/tests/backpack/cabal/bkpcabal01/Makefile
blob: 01744dae0184b0785066a1ca569084338db1f4e2 (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
60
61
62
63
64
65
66
67
68
69
70
71
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk

SETUP=./Setup -v0
CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=tmp.d --prefix='$(PWD)/inst'

bkpcabal01: clean
	$(MAKE) -s --no-print-directory clean
	'$(GHC_PKG)' init tmp.d
	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
	cp p/P.hs.in1 p/P.hs
	cp q/Q.hs.in1 q/Q.hs
	# typecheck p
	$(CONFIGURE) --cid "p-0.1" p
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# build impl
	$(CONFIGURE) --cid "impl-0.1" impl
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# typecheck q
	$(CONFIGURE) --cid "q-0.1" q
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# build p
	$(CONFIGURE) --cid "p-0.1" p --instantiate-with "H=impl-0.1:H"
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# build q
	$(CONFIGURE) --cid "q-0.1" q --instantiate-with "I=impl-0.1:I"
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# OK, now the crux of the test: recompilation.
	cp p/P.hs.in2 p/P.hs
	cp q/Q.hs.in2 q/Q.hs
	# re-typecheck p
	$(CONFIGURE) --cid "p-0.1" p
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# re-typecheck q (if buggy, this is what would fail)
	$(CONFIGURE) --cid "q-0.1" q
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# re-build p
	$(CONFIGURE) --cid "p-0.1" p --instantiate-with "H=impl-0.1:H"
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# re-build q
	$(CONFIGURE) --cid "q-0.1" q --instantiate-with "I=impl-0.1:I"
	$(SETUP) build
	$(SETUP) copy
	$(SETUP) register
	# build exe
	$(CONFIGURE) --cid "exe-0.1" exe
	$(SETUP) build
	dist/build/exe/exe
ifneq "$(CLEANUP)" ""
	$(MAKE) -s --no-print-directory clean
endif

clean :
	$(RM) -r tmp.d inst dist Setup$(exeext)