]> git.saurik.com Git - apple/ld64.git/blame - unit-tests/test-cases/indirect-path-search/Makefile
ld64-77.tar.gz
[apple/ld64.git] / unit-tests / test-cases / indirect-path-search / Makefile
CommitLineData
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##
23TESTROOT = ../..
24include ${TESTROOT}/include/common.makefile
25
26#
27# Test that -F and -L work when finding indirect libraries
28#
29
30
31run: all
32
33all:
34
35# build foo that re-exports bar
36 ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib
37 ${FAIL_IF_BAD_MACHO} libbar.dylib
38 ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib -lbar -L. -sub_library libbar
39 ${FAIL_IF_BAD_MACHO} libfoo.dylib
40
41# build an alternate libbar that also has baz
42 mkdir -p hide
43 ${CC} ${CCFLAGS} -dynamiclib bar.c baz.c -o hide/libbar.dylib -install_name libbar.dylib
44 ${FAIL_IF_BAD_MACHO} hide/libbar.dylib
45
46# build an executable that depends on a symbol in the alternate bar to validate that -L is used for indirect dylibs
47 ${CC} ${CCFLAGS} main.c -o main -lfoo -Lhide -L.
48 ${FAIL_IF_BAD_MACHO} main
49
50
51
52# build Foo.framework that re-exports Bar.framework
53 mkdir -p Bar.framework Foo.framework
54 ${CC} ${CCFLAGS} -dynamiclib bar.c -o Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar"
55 ${FAIL_IF_BAD_MACHO} Bar.framework/Bar
56 ${CC} ${CCFLAGS} -dynamiclib foo.c -o Foo.framework/Foo -F. -framework Bar -sub_umbrella Bar
57 ${FAIL_IF_BAD_MACHO} Foo.framework/Foo
58
59# build an alternate Bar.framework that also has baz
60 mkdir -p hide/Bar.framework
61 ${CC} ${CCFLAGS} -dynamiclib bar.c baz.c -o hide/Bar.framework/Bar -install_name "`pwd`/Bar.framework/Bar"
62 ${FAIL_IF_BAD_MACHO} hide/Bar.framework/Bar
63
64# build an executable that depends on a symbol in the alternate Bar.framework to validate that -F is used for indirect dylibs
65 ${CC} ${CCFLAGS} main.c -o main -Fhide -F. -framework Foo
66 ${FAIL_IF_BAD_MACHO} main
67
68
69
70# build foo that links against bar
71 ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib
72 ${FAIL_IF_BAD_MACHO} libbar.dylib
73 ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib libbar.dylib
74 ${FAIL_IF_BAD_MACHO} libfoo.dylib
75
76# build an alternate libbar that also has baz
77 mkdir -p hide
78 ${CC} ${CCFLAGS} -dynamiclib bar.c baz.c -o hide/libbar.dylib -install_name libbar.dylib
79 ${FAIL_IF_BAD_MACHO} hide/libbar.dylib
80
81# build a flat executable that depends on a symbol in the alternate bar to validate that -L is used for indirect dylibs
82 ${CC} ${CCFLAGS} -flat_namespace main.c -o main -lfoo -Lhide -L.
83 ${PASS_IFF_GOOD_MACHO} main
84
85
86
87
88
89clean:
90
91 rm -rf hide libbar.dylib libfoo.dylib Foo.framework Bar.framework main