]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/umbrella-dylib/Makefile
ld64-123.2.tar.gz
[apple/ld64.git] / unit-tests / test-cases / umbrella-dylib / Makefile
1 ##
2 # Copyright (c) 2010 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 out building an umbrella dylib. a and c are co-dependent. b depends on c.
28 #
29
30
31 run: all
32
33 all:
34 # build bootstrap dylib of with all code
35 ${CC} ${CCFLAGS} -dynamiclib a.c b.c c.c -o libBig.stub -install_name /usr/lib/libBig.dylib
36 # link each sub library against bootstrap to intra-Big symbols
37 ${CC} ${CCFLAGS} -dynamiclib a.c -o liba.dylib libBig.stub -install_name /usr/local/lib/big/liba.dylib -umbrella Big
38 ${CC} ${CCFLAGS} -dynamiclib b.c -o libb.dylib libBig.stub -install_name /usr/local/lib/big/libb.dylib -umbrella Big
39 ${CC} ${CCFLAGS} -dynamiclib c.c -o libc.dylib libBig.stub -install_name /usr/local/lib/big/libc.dylib -umbrella Big
40 ${CC} ${CCFLAGS} -dynamiclib -Wl,-reexport_library,liba.dylib -Wl,-reexport_library,libb.dylib -Wl,-reexport_library,libc.dylib -o libBig.dylib -install_name /usr/lib/libBig.dylib
41 # re-link against correct dylibs now that everything is built
42 ${CC} ${CCFLAGS} -dynamiclib a.c -o liba.dylib libc.dylib -install_name /usr/local/lib/big/liba.dylib -umbrella Big
43 dyldinfo -lazy_bind liba.dylib | grep c2 | grep libc | ${FAIL_IF_EMPTY}
44 ${CC} ${CCFLAGS} -dynamiclib b.c -o libb.dylib libc.dylib -install_name /usr/local/lib/big/libb.dylib -umbrella Big
45 ${CC} ${CCFLAGS} -dynamiclib c.c -o libc.dylib liba.dylib -install_name /usr/local/lib/big/libc.dylib -umbrella Big
46 dyldinfo -lazy_bind libc.dylib | grep a2 | grep liba | ${FAIL_IF_EMPTY}
47 ${CC} ${CCFLAGS} -dynamiclib -Wl,-reexport_library,liba.dylib -Wl,-reexport_library,libb.dylib -Wl,-reexport_library,libc.dylib -o libBig.dylib -install_name /usr/lib/libBig.dylib
48 ${CC} ${CCFLAGS} main.c -o main libBig.dylib -L.
49 ${PASS_IFF_GOOD_MACHO} main
50
51
52 clean:
53
54 rm -rf libBig.stub liba.dylib libb.dylib libc.dylib libBig.dylib main