Dot-ghci needs to be ignored.
[ghc.git] / testsuite / tests / ghci / linking / Makefile
1 TOP=../../..
2 include $(TOP)/mk/boilerplate.mk
3 include $(TOP)/mk/test.mk
4
5 LOCAL_GHC_PKG = '$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF)
6
7 # Test 1: ghci -Ldir -lfoo
8 # with dir/libfoo.a
9
10 .PHONY: ghcilink001
11 ghcilink001 :
12 $(RM) -rf dir001
13 mkdir dir001
14 "$(TEST_HC)" -c f.c -o dir001/foo.o
15 ar cqs dir001/libfoo.a dir001/foo.o
16 echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -Ldir001 -lfoo TestLink.hs
17
18 # Test 2: ghci -Ldir -lfoo
19 # with dir/libfoo.so
20
21 ifeq "$(WINDOWS)" "YES"
22 DLL = $1.dll
23 else
24 DLL = lib$1.so
25 endif
26
27 .PHONY: ghcilink002
28 ghcilink002 :
29 $(RM) -rf dir002
30 mkdir dir002
31 "$(TEST_HC)" -c -dynamic f.c -o dir002/foo.o
32 "$(TEST_HC)" -shared -v0 -o dir002/$(call DLL,foo) dir002/foo.o
33 echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -Ldir002 -lfoo TestLink.hs
34
35 # Test 3: ghci -lstdc++
36 # where libstdc++.so is normally found in a directory private to gcc,
37 # so only gcc can find it (see #5289)
38
39 .PHONY: ghcilink003
40 ghcilink003 :
41 echo ":q" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -lstdc++
42
43 # Test 4:
44 # package P
45 # library-dirs: `pwd`/dir004
46 # extra-libraries: foo
47 # with
48 # dir004/libfoo.a
49
50 LOCAL_PKGCONF004=dir004/local.package.conf
51 PKG004=dir004/pkg.conf
52
53 ghcilink004 :
54 $(RM) -rf dir004
55 mkdir dir004
56 #
57 rm -f $(PKG004)
58 echo "name: test" >>$(PKG004)
59 echo "version: 1.0" >>$(PKG004)
60 echo "id: test-XXX" >>$(PKG004)
61 echo "library-dirs: `pwd`/dir004" >>$(PKG004)
62 echo "extra-libraries: foo" >>$(PKG004)
63 echo "[]" >$(LOCAL_PKGCONF004)
64 '$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF004) register $(PKG004) -v0
65 #
66 "$(TEST_HC)" -c f.c -o dir004/foo.o
67 ar cqs dir004/libfoo.a dir004/foo.o
68 echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -package-conf $(LOCAL_PKGCONF004) -package test TestLink.hs
69
70
71 # Test 5:
72 # package P
73 # library-dirs: `pwd`/dir005
74 # extra-libraries: foo
75 # with
76 # dir005/libfoo.so
77
78 LOCAL_PKGCONF005=dir005/ghcilink005.package.conf
79 PKG005=dir005/pkg.conf
80
81 ghcilink005 :
82 $(RM) -rf dir005
83 mkdir dir005
84 #
85 rm -f $(PKG005)
86 echo "name: test" >>$(PKG005)
87 echo "version: 1.0" >>$(PKG005)
88 echo "id: test-XXX" >>$(PKG005)
89 echo "library-dirs: `pwd`/dir005" >>$(PKG005)
90 echo "extra-libraries: foo" >>$(PKG005)
91 echo "[]" >$(LOCAL_PKGCONF005)
92 '$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF005) register $(PKG005) -v0
93 #
94 "$(TEST_HC)" -c -dynamic f.c -o dir005/foo.o
95 "$(TEST_HC)" -shared -o dir005/$(call DLL,foo) dir005/foo.o
96 echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -package-conf $(LOCAL_PKGCONF005) -package test TestLink.hs
97
98 # Test 6:
99 # package P
100 # extra-libraries: stdc++
101
102 LOCAL_PKGCONF006=dir006/ghcilink006.package.conf
103 PKG006=dir006/pkg.conf
104
105 ghcilink006 :
106 $(RM) -rf dir006
107 mkdir dir006
108 #
109 rm -f $(PKG006)
110 echo "name: test" >>$(PKG006)
111 echo "version: 1.0" >>$(PKG006)
112 echo "id: test-XXX" >>$(PKG006)
113 echo "extra-libraries: stdc++" >>$(PKG006)
114 echo "[]" >$(LOCAL_PKGCONF006)
115 '$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF006) register $(PKG006) -v0
116 #
117 echo ":q" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -package-conf $(LOCAL_PKGCONF006) -package test
118