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