]> git.saurik.com Git - apple/ld64.git/blame - ld64-134.9/unit-tests/test-cases/symbol-moving/Makefile
ld64-134.9.tar.gz
[apple/ld64.git] / ld64-134.9 / unit-tests / test-cases / symbol-moving / 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 magic $ld$ symbols which tell ld to view exported symbols
28# differently than dyld sees them.
29#
30# In this test case aaa and bbb both moved between libfoo and libar
31# between 10.4 and 10.5.
32#
33
34
35run: all
36
37all:
38 # In this test case aaa and bbb both moved between libfoo and libar
39 # between 10.4 and 10.5.
40 ${CC} ${CCFLAGS} -dynamiclib bar.c bbb.c anotb.c -o libbar.dylib
41 ${FAIL_IF_BAD_MACHO} libbar.dylib
42 ${CC} ${CCFLAGS} -dynamiclib foo.c aaa.c bnota.c -o libfoo.dylib
43 ${FAIL_IF_BAD_MACHO} libfoo.dylib
44 ${CC} ${CCFLAGS} main.c -o main-10.4 libfoo.dylib libbar.dylib -mmacosx-version-min=10.4
45 nm -m main-10.4 | grep _aaa | grep libbar | ${FAIL_IF_EMPTY}
46 nm -m main-10.4 | grep _bbb | grep libfoo | ${FAIL_IF_EMPTY}
47 ${CC} ${CCFLAGS} main.c -o main-10.4a libbar.dylib libfoo.dylib -mmacosx-version-min=10.4
48 nm -m main-10.4a | grep _aaa | grep libbar | ${FAIL_IF_EMPTY}
49 nm -m main-10.4a | grep _bbb | grep libfoo | ${FAIL_IF_EMPTY}
50 ${CC} ${CCFLAGS} main.c -o main-10.5 libfoo.dylib libbar.dylib -mmacosx-version-min=10.5
51 nm -m main-10.5 | grep _aaa | grep libfoo | ${FAIL_IF_EMPTY}
52 nm -m main-10.5 | grep _bbb | grep libbar | ${FAIL_IF_EMPTY}
53 ${CC} ${CCFLAGS} main.c -o main-10.5a libbar.dylib libfoo.dylib -mmacosx-version-min=10.5
54 nm -m main-10.5a | grep _aaa | grep libfoo | ${FAIL_IF_EMPTY}
55 nm -m main-10.5a | grep _bbb | grep libbar | ${FAIL_IF_EMPTY}
56 # In this test case aaa and bbb both moved between subframeworks of Foo and Bar
57 # between 10.4 and 10.5.
58 mkdir -p Frameworks/Foo.framework/Frameworks/subFoo.framework
59 ${CC} ${CCFLAGS} -dynamiclib foo.c aaa.c -o Frameworks/Foo.framework/Frameworks/subFoo.framework/subFoo \
60 -install_name /System/Library/Frameworks/Foo.framework/Frameworks/subFoo.framework/subFoo \
61 -umbrella Foo
62 ${CC} ${CCFLAGS} -dynamiclib bnota.c -o Frameworks/Foo.framework/Foo \
63 -install_name /System/Library/Frameworks/Frameworks/Foo.framework/Foo \
64 Frameworks/Foo.framework/Frameworks/subFoo.framework/subFoo
65 mkdir -p Frameworks/Bar.framework/Frameworks/subBar.framework
66 ${CC} ${CCFLAGS} -dynamiclib bar.c bbb.c -o Frameworks/Bar.framework/Frameworks/subBar.framework/subBar \
67 -install_name /System/Library/Frameworks/Bar.framework/Frameworks/subBar.framework/subBar \
68 -umbrella Bar
69 ${CC} ${CCFLAGS} -dynamiclib anotb.c -o Frameworks/Bar.framework/Bar \
70 -install_name /System/Library/Frameworks/Frameworks/Bar.framework/Bar \
71 Frameworks/Bar.framework/Frameworks/subBar.framework/subBar
72 ${CC} ${CCFLAGS} main.c -o main-10.4 -framework Foo -framework Bar -mmacosx-version-min=10.4 \
73 -F./Frameworks -F./Frameworks/Bar.framework/Frameworks -F./Frameworks/Foo.framework/Frameworks
74 nm -m main-10.4 | grep _aaa | grep " Bar" | ${FAIL_IF_EMPTY}
75 nm -m main-10.4 | grep _bbb | grep " Foo" | ${FAIL_IF_EMPTY}
76 ${CC} ${CCFLAGS} main.c -o main-10.4a -framework Bar -framework Foo -mmacosx-version-min=10.4 \
77 -F./Frameworks -F./Frameworks/Bar.framework/Frameworks -F./Frameworks/Foo.framework/Frameworks
78 nm -m main-10.4a | grep _aaa | grep " Bar" | ${FAIL_IF_EMPTY}
79 nm -m main-10.4a | grep _bbb | grep " Foo" | ${FAIL_IF_EMPTY}
80 ${CC} ${CCFLAGS} main.c -o main-10.5 -framework Foo -framework Bar -mmacosx-version-min=10.5 \
81 -F./Frameworks -F./Frameworks/Bar.framework/Frameworks -F./Frameworks/Foo.framework/Frameworks
82 nm -m main-10.5 | grep _aaa | grep " Foo" | ${FAIL_IF_EMPTY}
83 nm -m main-10.5 | grep _bbb | grep " Bar" | ${FAIL_IF_EMPTY}
84 ${CC} ${CCFLAGS} main.c -o main-10.5a -framework Bar -framework Foo -mmacosx-version-min=10.5 \
85 -F./Frameworks -F./Frameworks/Bar.framework/Frameworks -F./Frameworks/Foo.framework/Frameworks
86 nm -m main-10.5a | grep _aaa | grep " Foo" | ${FAIL_IF_EMPTY}
87 nm -m main-10.5a | grep _bbb | grep " Bar" | ${FAIL_IF_EMPTY}
88 ${PASS_IFF} /usr/bin/true
89
90
91clean:
92
93 rm -rf libbar.dylib libfoo.dylib main-10.4 main-10.5 main-10.4a main-10.5a Frameworks