]>
Commit | Line | Data |
---|---|---|
a61fdf0a A |
1 | ## |
2 | # Copyright (c) 2007 Apple 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 | # | |
27 | # Test all the different ways that re-exports can be specified and implemented | |
28 | # | |
29 | ||
30 | ||
31 | run: all | |
32 | ||
33 | all: | |
34 | ||
35 | # -sub_library for 10.4 | |
36 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib -mmacosx-version-min=10.4 | |
37 | ${FAIL_IF_BAD_MACHO} libbar.dylib | |
38 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib -lbar -L. -sub_library libbar -mmacosx-version-min=10.4 | |
39 | ${FAIL_IF_BAD_MACHO} libfoo.dylib | |
40 | otool -lv libfoo.dylib | grep LC_SUB_LIBRARY | ${FAIL_IF_EMPTY} | |
41 | otool -lv libfoo.dylib | grep LC_REEXPORT_DYLIB | ${FAIL_IF_STDIN} | |
42 | ||
43 | # -sub_library for 10.5 | |
44 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib -mmacosx-version-min=10.5 | |
45 | ${FAIL_IF_BAD_MACHO} libbar.dylib | |
46 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib -lbar -L. -sub_library libbar -mmacosx-version-min=10.5 | |
47 | ${FAIL_IF_BAD_MACHO} libfoo.dylib | |
48 | otool -lv libfoo.dylib | grep LC_REEXPORT_DYLIB | ${FAIL_IF_EMPTY} | |
49 | otool -lv libfoo.dylib | grep LC_SUB_LIBRARY | ${FAIL_IF_STDIN} | |
50 | ||
51 | ||
52 | # -sub_umbrella for 10.4 | |
53 | mkdir -p Bar.framework Foo.framework | |
54 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -mmacosx-version-min=10.4 | |
55 | ${FAIL_IF_BAD_MACHO} Bar.framework/Bar | |
56 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -framework Bar -sub_umbrella Bar -mmacosx-version-min=10.4 | |
57 | ${FAIL_IF_BAD_MACHO} Foo.framework/Foo | |
58 | otool -lv Foo.framework/Foo | grep LC_SUB_UMBRELLA | ${FAIL_IF_EMPTY} | |
59 | otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_STDIN} | |
60 | ||
61 | # -sub_umbrella for 10.5 | |
62 | mkdir -p Bar.framework Foo.framework | |
63 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -mmacosx-version-min=10.5 | |
64 | ${FAIL_IF_BAD_MACHO} Bar.framework/Bar | |
65 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -framework Bar -sub_umbrella Bar -mmacosx-version-min=10.5 | |
66 | ${FAIL_IF_BAD_MACHO} Foo.framework/Foo | |
67 | otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_EMPTY} | |
68 | otool -lv Foo.framework/Foo | grep LC_SUB_UMBRELLA | ${FAIL_IF_STDIN} | |
69 | ||
70 | ||
71 | # -umbrella for 10.4 | |
72 | mkdir -p Bar.framework Foo.framework | |
73 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -umbrella Foo -mmacosx-version-min=10.4 | |
74 | ${FAIL_IF_BAD_MACHO} Bar.framework/Bar | |
75 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -framework Bar -mmacosx-version-min=10.4 | |
76 | ${FAIL_IF_BAD_MACHO} Foo.framework/Foo | |
77 | otool -lv Bar.framework/Bar | grep LC_SUB_FRAMEWORK | ${FAIL_IF_EMPTY} | |
78 | otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_STDIN} | |
79 | ||
80 | # -umbrella for 10.5 | |
81 | mkdir -p Bar.framework Foo.framework | |
82 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -umbrella Foo -mmacosx-version-min=10.5 | |
83 | ${FAIL_IF_BAD_MACHO} Bar.framework/Bar | |
84 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -framework Bar -mmacosx-version-min=10.5 | |
85 | ${FAIL_IF_BAD_MACHO} Foo.framework/Foo | |
86 | otool -lv Bar.framework/Bar | grep LC_SUB_FRAMEWORK | ${FAIL_IF_EMPTY} | |
87 | otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_EMPTY} | |
88 | ||
89 | ||
90 | # -reexport_library for 10.4 | |
91 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib -mmacosx-version-min=10.4 | |
92 | ${FAIL_IF_BAD_MACHO} libbar.dylib | |
93 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib -Wl,-reexport_library,libbar.dylib -mmacosx-version-min=10.4 | |
94 | ${FAIL_IF_BAD_MACHO} libfoo.dylib | |
95 | otool -lv libfoo.dylib | grep LC_SUB_LIBRARY | ${FAIL_IF_EMPTY} | |
96 | otool -lv libfoo.dylib | grep LC_REEXPORT_DYLIB | ${FAIL_IF_STDIN} | |
97 | ||
98 | # -reexport_library for 10.5 | |
99 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib -mmacosx-version-min=10.5 | |
100 | ${FAIL_IF_BAD_MACHO} libbar.dylib | |
101 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib -Wl,-reexport_library,libbar.dylib -mmacosx-version-min=10.5 | |
102 | ${FAIL_IF_BAD_MACHO} libfoo.dylib | |
103 | otool -lv libfoo.dylib | grep LC_REEXPORT_DYLIB | ${FAIL_IF_EMPTY} | |
104 | otool -lv libfoo.dylib | grep LC_SUB_LIBRARY | ${FAIL_IF_STDIN} | |
105 | ||
106 | ||
107 | # -reexport-l for 10.4 | |
108 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib -mmacosx-version-min=10.4 | |
109 | ${FAIL_IF_BAD_MACHO} libbar.dylib | |
110 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib -Wl,-reexport-lbar -L. -mmacosx-version-min=10.4 | |
111 | ${FAIL_IF_BAD_MACHO} libfoo.dylib | |
112 | otool -lv libfoo.dylib | grep LC_SUB_LIBRARY | ${FAIL_IF_EMPTY} | |
113 | otool -lv libfoo.dylib | grep LC_REEXPORT_DYLIB | ${FAIL_IF_STDIN} | |
114 | ||
115 | # -reexport-l for 10.5 | |
116 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib -mmacosx-version-min=10.5 | |
117 | ${FAIL_IF_BAD_MACHO} libbar.dylib | |
118 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib -Wl,-reexport-lbar -L. -mmacosx-version-min=10.5 | |
119 | ${FAIL_IF_BAD_MACHO} libfoo.dylib | |
120 | otool -lv libfoo.dylib | grep LC_REEXPORT_DYLIB | ${FAIL_IF_EMPTY} | |
121 | otool -lv libfoo.dylib | grep LC_SUB_LIBRARY | ${FAIL_IF_STDIN} | |
122 | ||
123 | ||
124 | # -reexport_framework for 10.4 | |
125 | mkdir -p Bar.framework Foo.framework | |
126 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -mmacosx-version-min=10.4 | |
127 | ${FAIL_IF_BAD_MACHO} Bar.framework/Bar | |
128 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -Wl,-reexport_framework,Bar -mmacosx-version-min=10.4 | |
129 | ${FAIL_IF_BAD_MACHO} Foo.framework/Foo | |
130 | otool -lv Foo.framework/Foo | grep LC_SUB_UMBRELLA | ${FAIL_IF_EMPTY} | |
131 | otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_STDIN} | |
132 | ||
133 | # -reexport_framework for 10.5 | |
134 | mkdir -p Bar.framework Foo.framework | |
135 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -mmacosx-version-min=10.5 | |
136 | ${FAIL_IF_BAD_MACHO} Bar.framework/Bar | |
137 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -Wl,-reexport_framework,Bar -mmacosx-version-min=10.5 | |
138 | ${FAIL_IF_BAD_MACHO} Foo.framework/Foo | |
139 | otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_EMPTY} | |
140 | otool -lv Foo.framework/Foo | grep LC_SUB_UMBRELLA | ${FAIL_IF_STDIN} | |
141 | ||
142 | ||
143 | # -reexport_framework and -umbrella for 10.4 | |
144 | mkdir -p Bar.framework Foo.framework | |
145 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -umbrella Foo -mmacosx-version-min=10.4 | |
146 | ${FAIL_IF_BAD_MACHO} Bar.framework/Bar | |
147 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -Wl,-reexport_framework,Bar -mmacosx-version-min=10.4 | |
148 | ${FAIL_IF_BAD_MACHO} Foo.framework/Foo | |
149 | otool -lv Bar.framework/Bar | grep LC_SUB_FRAMEWORK | ${FAIL_IF_EMPTY} | |
150 | otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_STDIN} | |
151 | ||
152 | ||
153 | # -reexport_framework and -umbrella for 10.4 | |
154 | mkdir -p Bar.framework Foo.framework | |
155 | ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar" -umbrella Foo -mmacosx-version-min=10.5 | |
156 | ${FAIL_IF_BAD_MACHO} Bar.framework/Bar | |
157 | ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -Wl,-reexport_framework,Bar -mmacosx-version-min=10.5 | |
158 | ${FAIL_IF_BAD_MACHO} Foo.framework/Foo | |
159 | otool -lv Bar.framework/Bar | grep LC_SUB_FRAMEWORK | ${FAIL_IF_EMPTY} | |
160 | otool -lv Foo.framework/Foo | grep LC_REEXPORT_DYLIB | ${FAIL_IF_EMPTY} | |
161 | ||
162 | ${PASS_IFF} /usr/bin/true | |
163 | ||
164 | ||
165 | clean: | |
166 | ||
167 | rm -rf hide libbar.dylib libfoo.dylib Foo.framework Bar.framework |