8eb4aade1557f585988aa8e2b8b093660860c794
[ghc.git] / testsuite / tests / ghci / linking / dyn / Makefile
1 TOP=../../../..
2 include $(TOP)/mk/boilerplate.mk
3 include $(TOP)/mk/test.mk
4
5 ifeq "$(WINDOWS)" "YES"
6 DLL = lib$1.dll
7 else ifeq "$(DARWIN)" "YES"
8 DLL = lib$1.dylib
9 else
10 DLL = lib$1.so
11 endif
12
13 ifeq "$(WINDOWS)" "YES"
14 EXE = $1.exe
15 else ifeq "$(DARWIN)" "YES"
16 EXE = $1
17 else
18 EXE = $1
19 endif
20
21 ifeq "$(WINDOWS)" "YES"
22 CFLAGS =
23 else
24 CFLAGS = -fPIC
25 endif
26
27 MY_TEST_HC_OPTS = $(filter-out -rtsopts,$(TEST_HC_OPTS)) $(CFLAGS)
28
29 .PHONY: load_short_name
30 load_short_name:
31 rm -rf bin_short
32 mkdir bin_short
33 '$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_short" -shared A.c -o "bin_short/$(call DLL,A)"
34 rm -f bin_short/*.a
35 echo ":q" | "$(TEST_HC)" --interactive -L"./bin_short" -lA -v0
36
37 .PHONY: compile_libAS
38 compile_libAS:
39 '$(TEST_HC)' $(MY_TEST_HC_OPTS) -shared A.c -o $(call DLL,AS)
40 rm -f libAS*.a
41
42 .PHONY: compile_libAB_dep
43 compile_libAB_dep:
44 rm -rf bin_dep
45 mkdir bin_dep
46 '$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dep" -shared A.c -o "bin_dep/$(call DLL,A)"
47 '$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dep" -shared B.c -o "bin_dep/$(call DLL,B)" -lA -L"./bin_dep"
48 rm -f bin_dep/*.a
49
50 .PHONY: compile_libAB_dyn
51 compile_libAB_dyn:
52 rm -rf bin_dyn
53 mkdir bin_dyn
54 '$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dyn" -shared A.c -o "bin_dyn/$(call DLL,A)"
55 '$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "bin_dyn" -shared B.c -o "bin_dyn/$(call DLL,B)" -lA -L"./bin_dyn"
56 rm -f bin_dyn/*.a
57 '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -v0 -o "bin_dyn/$(call EXE,T10955dyn)" -L./bin_dyn -lB -lA T10955dyn.hs -v0
58 LD_LIBRARY_PATH=./bin_dyn ./bin_dyn/$(call EXE,T10955dyn)
59
60 .PHONY: T1407
61 T1407:
62 cat T1407.script | LD_LIBRARY_PATH=. "$(TEST_HC)" -ignore-dot-ghci -v0 --interactive -L.