dyld-635.2.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 PWD = $(shell pwd)
27
28
29 all-check: all check
30
31 check: check1 check2 check3 check4 check5 check6 check7 check8
32
33 all: main1 main2 main3 main4 main5 main6 main7 main8
34
35 main : main.c libfoo.dylib
36 ${CC} -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main libfoo.dylib
37
38 libfoo.dylib : foo.c
39 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o $(PWD)/libfoo.dylib
40
41 libfoo_debug.dylib : foo.c
42 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -DDEBUG -o libfoo_debug.dylib -install_name $(PWD)/libfoo.dylib
43
44 hide/libfoo.dylib : foo.c
45 mkdir -p $(PWD)/hide
46 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o hide/libfoo.dylib -install_name $(PWD)/libfoo.dylib
47
48 hide/libfoo_debug.dylib : foo.c
49 mkdir -p $(PWD)/hide
50 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o hide/libfoo_debug.dylib -install_name $(PWD)/libfoo.dylib
51
52 # bar_debug has bar_debug as install name
53 libbar.dylib : foo.c
54 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o libbar.dylib
55
56 libbar_debug.dylib : foo.c
57 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -DDEBUG -o libbar_debug.dylib
58
59 hide/libbar.dylib : foo.c
60 mkdir -p $(PWD)/hide
61 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o hide/libbar.dylib -install_name $(PWD)/libbar.dylib
62
63 hide/libbar_debug.dylib : foo.c
64 mkdir -p $(PWD)/hide
65 ${CC} -I${TESTROOT}/include foo.c -dynamiclib -o hide/libbar_debug.dylib -install_name $(PWD)/libbar_debug.dylib
66
67 clean:
68 rm -rf libfoo.dylib libfoo_debug.dylib hide libbar.dylib libbar_debug.dylib main1 main2 main3 main4 main5 main6 main7 main8
69
70
71 #
72 # check1: main links with libfoo.dylib sets DYLD_IMAGE_SUFFIX=_debug and dynamically loads libfoo.dylib
73 # (fails on 10.3)
74 #
75 main1 : main.c libfoo.dylib
76 ${CC} -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main1 libfoo.dylib
77
78 check1:
79 DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main1 libfoo.dylib
80 DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main1 $(PWD)/libfoo.dylib
81
82
83 #
84 # check2: main links with libfoo_debug.dylib and dynamically loads libfoo.dylib
85 #
86 main2 : main.c libfoo_debug.dylib
87 ${CC} -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main2 libfoo_debug.dylib
88
89 check2:
90 echo "pwd-1 is ${PWD}"
91 echo "pwd-2 is $(PWD)"
92 pwd
93 ./main2 $(PWD)/libfoo.dylib
94
95
96 #
97 # check3: main links with libfoo.dylib sets DYLD_LIBRARY_PATH=hide and dynamically loads libfoo.dylib
98 #
99 main3 : main.c libfoo.dylib
100 ${CC} -Wno-deprecated-declarations -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main3 libfoo.dylib
101
102 check3:
103 DYLD_LIBRARY_PATH=$(PWD)/hide && export DYLD_LIBRARY_PATH && ./main3 $(PWD)/libfoo.dylib
104
105
106 #
107 # check4: main links with libfoo.dylib sets DYLD_LIBRARY_PATH=hide, DYLD_IMAGE_SUFFIX=_debug and dynamically loads libfoo.dylib
108 # (fails on 10.3)
109 #
110 main4 : main.c libfoo.dylib
111 ${CC} -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main4 libfoo.dylib
112
113 check4:
114 DYLD_LIBRARY_PATH=$(PWD)/hide && export DYLD_LIBRARY_PATH && DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main4 $(PWD)/libfoo.dylib
115
116
117 #
118 # check5: main links with libbar.dylib sets DYLD_IMAGE_SUFFIX=_debug and dynamically loads libbar.dylib
119 # (fails on 10.3)
120 #
121 main5 : main.c libbar.dylib libbar_debug.dylib
122 ${CC} -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main5 libbar.dylib
123
124 check5:
125 DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main5 $(PWD)/libbar.dylib
126
127
128 #
129 # check6: main links with libbar_debug.dylib and dynamically loads libbar.dylib
130 # (fails on 10.3)
131 #
132 main6 : main.c libbar_debug.dylib
133 ${CC} -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main6 libbar_debug.dylib
134
135 check6:
136 DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main6 $(PWD)/libbar.dylib
137
138
139 #
140 # check7: main links with libbar.dylib sets DYLD_LIBRARY_PATH=hide and dynamically loads libbar.dylib
141 #
142 main7 : main.c libbar.dylib
143 ${CC} -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main7 libbar.dylib
144
145 check7:
146 DYLD_LIBRARY_PATH=$(PWD)/hide && export DYLD_LIBRARY_PATH && ./main7 $(PWD)/libbar.dylib
147
148
149 #
150 # check8: main links with libbar.dylib sets DYLD_LIBRARY_PATH=hide, DYLD_IMAGE_SUFFIX=_debug and dynamically loads libbar.dylib
151 # (fails on 10.3)
152 #
153 main8 : main.c libbar.dylib
154 ${CC} -Wno-deprecated-declarations -I${TESTROOT}/include main.c -o main8 libbar.dylib
155
156 check8:
157 DYLD_LIBRARY_PATH=$(PWD)/hide && export DYLD_LIBRARY_PATH && DYLD_IMAGE_SUFFIX=_debug && export DYLD_IMAGE_SUFFIX && ./main8 $(PWD)/libbar.dylib