]> git.saurik.com Git - apple/dyld.git/blob - unit-tests/test-cases/image-suffix/Makefile
dyld-43.1.tar.gz
[apple/dyld.git] / unit-tests / test-cases / image-suffix / Makefile
1 ##
2 # Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
3 #
4 # @APPLE_LICENSE_HEADER_START@
5 #
6 # This file contains Original Code and/or Modifications of Original Code
7 # as defined in and that are subject to the Apple Public Source License
8 # Version 2.0 (the 'License'). You may not use this file except in
9 # compliance with the License. Please obtain a copy of the License at
10 # http://www.opensource.apple.com/apsl/ and read it before using this
11 # file.
12 #
13 # The Original Code and all software distributed under the License are
14 # distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 # Please see the License for the specific language governing rights and
19 # limitations under the License.
20 #
21 # @APPLE_LICENSE_HEADER_END@
22 ##
23 TESTROOT = ../..
24 include ${TESTROOT}/include/common.makefile
25
26 run : check1 check2 check3 check4 check5 check6 check7 check8
27
28 all : main1 main2 main3 main4 main5 main6 main7 main8
29
30 main : main.c libfoo.dylib
31 ${CC} -I${TESTROOT}/include main.c -o main libfoo.dylib
32
33 libfoo.dylib : foo.c
34 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o $$PWD/libfoo.dylib
35
36 libfoo_debug.dylib : foo.c
37 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -DDEBUG -o $$PWD/libfoo_debug.dylib -install_name $$PWD/libfoo.dylib
38
39 hide/libfoo.dylib : foo.c
40 mkdir -p $$PWD/hide
41 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o $$PWD/hide/libfoo.dylib -install_name $$PWD/libfoo.dylib
42
43 hide/libfoo_debug.dylib : foo.c
44 mkdir -p $$PWD/hide
45 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o $$PWD/hide/libfoo_debug.dylib -install_name $$PWD/libfoo.dylib
46
47 # bar_debug has bar_debug as install name
48 libbar.dylib : foo.c
49 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o $$PWD/libbar.dylib
50
51 libbar_debug.dylib : foo.c
52 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -DDEBUG -o $$PWD/libbar_debug.dylib
53
54 hide/libbar.dylib : foo.c
55 mkdir -p $$PWD/hide
56 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o $$PWD/hide/libbar.dylib -install_name $$PWD/libbar.dylib
57
58 hide/libbar_debug.dylib : foo.c
59 mkdir -p $$PWD/hide
60 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o $$PWD/hide/libbar_debug.dylib -install_name $$PWD/libbar_debug.dylib
61
62 clean:
63 rm -rf libfoo.dylib libfoo_debug.dylib hide libbar.dylib libbar_debug.dylib main1 main2 main3 main4 main5 main6 main7 main8
64
65
66 #
67 # check1: main links with libfoo.dylib sets DYLD_IMAGE_SUFFIX=_debug and dynamically loads libfoo.dylib
68 # (fails on 10.3)
69 #
70 main1 : main.c libfoo.dylib
71 ${CC} -I${TESTROOT}/include main.c -o main1 libfoo.dylib
72
73 check1: main1
74 DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main1 libfoo.dylib
75 DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main1 $$PWD/libfoo.dylib
76
77
78 #
79 # check2: main links with libfoo_debug.dylib and dynamically loads libfoo.dylib
80 #
81 main2 : main.c libfoo_debug.dylib
82 ${CC} -I${TESTROOT}/include main.c -o main2 libfoo_debug.dylib
83
84 check2: main2
85 echo "pwd-1 is ${PWD}"
86 echo "pwd-2 is $$PWD"
87 pwd
88 ./main2 $$PWD/libfoo.dylib
89
90
91 #
92 # check3: main links with libfoo.dylib sets DYLD_LIBRARY_PATH=hide and dynamically loads libfoo.dylib
93 #
94 main3 : main.c libfoo.dylib
95 ${CC} -I${TESTROOT}/include main.c -o main3 libfoo.dylib
96
97 check3: main3
98 DYLD_LIBRARY_PATH=$$PWD/hide && export DYLD_LIBRARY_PATH && ./main3 $$PWD/libfoo.dylib
99
100
101 #
102 # check4: main links with libfoo.dylib sets DYLD_LIBRARY_PATH=hide, DYLD_IMAGE_SUFFIX=_debug and dynamically loads libfoo.dylib
103 # (fails on 10.3)
104 #
105 main4 : main.c libfoo.dylib
106 ${CC} -I${TESTROOT}/include main.c -o main4 libfoo.dylib
107
108 check4: main4
109 DYLD_LIBRARY_PATH=$$PWD/hide && export DYLD_LIBRARY_PATH && DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main4 $$PWD/libfoo.dylib
110
111
112 #
113 # check5: main links with libbar.dylib sets DYLD_IMAGE_SUFFIX=_debug and dynamically loads libbar.dylib
114 # (fails on 10.3)
115 #
116 main5 : main.c libbar.dylib libbar_debug.dylib
117 ${CC} -I${TESTROOT}/include main.c -o main5 libbar.dylib
118
119 check5: main5
120 DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main5 $$PWD/libbar.dylib
121
122
123 #
124 # check6: main links with libbar_debug.dylib and dynamically loads libbar.dylib
125 # (fails on 10.3)
126 #
127 main6 : main.c libbar_debug.dylib
128 ${CC} -I${TESTROOT}/include main.c -o main6 libbar_debug.dylib
129
130 check6: main6
131 DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main6 $$PWD/libbar.dylib
132
133
134 #
135 # check7: main links with libbar.dylib sets DYLD_LIBRARY_PATH=hide and dynamically loads libbar.dylib
136 #
137 main7 : main.c libbar.dylib
138 ${CC} -I${TESTROOT}/include main.c -o main7 libbar.dylib
139
140 check7: main7
141 DYLD_LIBRARY_PATH=$$PWD/hide && export DYLD_LIBRARY_PATH && ./main7 $$PWD/libbar.dylib
142
143
144 #
145 # check8: main links with libbar.dylib sets DYLD_LIBRARY_PATH=hide, DYLD_IMAGE_SUFFIX=_debug and dynamically loads libbar.dylib
146 # (fails on 10.3)
147 #
148 main8 : main.c libbar.dylib
149 ${CC} -I${TESTROOT}/include main.c -o main8 libbar.dylib
150
151 check8: main8
152 DYLD_LIBRARY_PATH=$$PWD/hide && export DYLD_LIBRARY_PATH && DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main8 $$PWD/libbar.dylib